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

Setting up a HP Laserjet 1300 on Linux
Posted on 05-29-2002 18:48:00 UTC | Updated on 05-29-2002 18:48:00 UTC
Section: /software/cups/ | Permanent Link

Got a new HP LaserJet 1300. Set it up on the W2k box. Shared it on the network. I needed to print to it from my Linux machines so I setup CUPS (apt-get install cupsys - the best open source printing solution IMHO). The problem I seemed to be having was that I was using SMB printing from the Linux workstation and CUPS needed the device URI for SMB. I was getting the error in the CUPS log "SMB tree connect failed: NT_STATUS_ACCESS_DENIED" with the URI I was using. This is a SAMBA (SMB) error which almost always means permission problems or username password problem. I was not supplying a U and P so I went to find the correct parameters for SMB URI's. After some quick googling I found the correct line for SMB device URI should be: "smb://windowsusername:password@workgroup/workstation/printersharename" (without quotes). Printer fired right up after that.

To get the printing working right I installed the package "gs-esp" (ghostscript esp) on Debian.

Next job was to get OpenOffice.org to print a word doc (Yuck!) to the new laser. Since I use KDE I just used Kprinter. In the KDE menu there is an OpenOffice.org group with a program called "OpenOffice.org Printer Administration" . In there just click "New Printer" then "Add a Printer" selected the laserjet4 (which works great for most laserjets). Then the important part was next. Enter the command for appropriate for this device which for Kprinter is: "kprinter --stdin". The document printed right up after that. Good stuff. I use the same kprinter line to print from xpdf also.

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