pantz.org banner
lpq lp cannot chdir to spooling directory
Posted on 03-10-2013 18:45:47 UTC | Updated on 03-10-2013 18:48:03 UTC
Section: /software/cups/ | Permanent Link

Had a friend send me this little gem that had them perplexed for a while. Eventually they figured it out.

The Problem

On one our Ubuntu servers lpq was reporting it could not see our printers. CUPs was already configured with all the printers. We verified CUPSd daemon was started and we could print to all printers using the web interface at http://127.0.0.1:631 on the local machine.

The problem is the command line interface tool "lpq" and "lprm" were throwing the following errors:

user@ubuntu# lpq
lpq: lp: cannot chdir to spooling directory
user@ubuntu# lprm
lprm: lp: cannot chdir to spooling directory

The confusing part is lpr, lpq, lprm and lpstat are all part of the "lpr" Ubuntu package. You can verify your install using "dpkg --get-selections | grep lpr". What we needed was the exact same lpr, lpq, lprm and lpstat binaries which are made to work with CUPSd.

The Fix

lpr is a stand alone package. lpr only works with the lp print system, not with cups. To replace "lpr" we have to install "cups-bsd" to work with cupsd.
user@ubuntu# sudo apt-get install cups-bsd

The following extra packages will be installed:
  libfile-copy-recursive-perl update-inetd
The following packages will be REMOVED:
  lpr
The following NEW packages will be installed:
  cups-bsd libfile-copy-recursive-perl update-inetd
0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded.

As you can see the old "lpr" package was removed and cups-bsd was installed. cups-bsd replaces the binaries lpr, lpq, lprm and lpstat and works with CUPSd. Now using lpq works as expected with the previously configured cups printers.

user@ubuntu:~# lpq
printer is ready
no entries

Reddit!

Related stories


RSS Feed RSS feed logo

About


3com

3ware

alsa

alsactl

alsamixer

amd

android

apache

areca

arm

ati

auditd

awk

badblocks

bash

bind

bios

bonnie

cable

carp

cat5

cdrom

cellphone

centos

chart

chrome

chromebook

cifs

cisco

cloudera

comcast

commands

comodo

compiz-fusion

corsair

cpufreq

cpufrequtils

cpuspeed

cron

crontab

crossover

cu

cups

cvs

database

dbus

dd

dd_rescue

ddclient

debian

decimal

dhclient

dhcp

diagnostic

diskexplorer

disks

dkim

dns

dos

dovecot

drac

dsniff

dvdauthor

e-mail

echo

editor

emerald

encryption

ethernet

expect

ext3

ext4

fat32

fedora

fetchmail

fiber

filesystems

firefox

firewall

flac

flexlm

floppy

flowtools

fonts

format

freebsd

ftp

gdm

gmail

gnome

google

gpg

greasemonkey

greylisting

growisofs

grub

hacking

hadoop

harddrive

hba

hex

hfsc

html

html5

http

https

hulu

idl

ie

ilo

intel

ios

iperf

ipmi

iptables

ipv6

irix

javascript

kde

kernel

kickstart

kmail

kprinter

krecord

kubuntu

kvm

lame

ldap

linux

logfile

lp

lpq

lpr

maradns

matlab

memory

mencoder

mhdd

mkinitrd

mkisofs

moinmoin

motherboard

mouse

movemail

mplayer

multitail

mutt

myodbc

mysql

mythtv

nagios

nameserver

netflix

netflow

nginx

nic

ntfs

ntp

nvidia

odbc

openbsd

openntpd

openoffice

openssh

openssl

openvpn

opteron

parted

partimage

patch

perl

pf

pfflowd

pfsync

photorec

php

pop3

pop3s

ports

postfix

power

procmail

proftpd

proxy

pulseaudio

putty

pxe

python

qemu

r-studio

raid

recovery

redhat

router

rpc

rsync

ruby

saltstack

samba

schedule

screen

scsi

seagate

seatools

sed

sendmail

sgi

shell

siw

smtp

snort

solaris

soundcard

sox

spam

spamd

spf

spotify

sql

sqlite

squid

srs

ssh

ssh.com

ssl

su

subnet

subversion

sudo

sun

supermicro

switches

symbols

syslinux

syslog

systemd

systemrescuecd

t1

tcpip

tcpwrappers

telnet

terminal

testdisk

tftp

thttpd

thunderbird

timezone

ting

tls

tools

tr

trac

tuning

tunnel

ubuntu

unbound

vi

vpn

wget

wiki

windows

windowsxp

wireless

wpa_supplicant

x

xauth

xfree86

xfs

xinearama

xmms

youtube

zdump

zeromq

zic

zlib