Solved lpd apparently not running

D

Deleted member 9563

Guest
After installing FreeBSD 10.1-RELEASE on two systems which were previously running 9.1, this time with packages instead of ports, I can no longer print. The printer still works with:
Code:
% nc XER 9100 < prtst.txt
so I know it is not a hardware problem. I have followed Warren Block's excellent instructions (same as the Handbook) in exactly the same way as I did with the previous installation. I have even tried the same files as I used on the previous installation (in case I made a typo or something), but to no avail.

I have lpd_enable="YES" in /etc/rc.conf Nevertheless, it looks like lpd is not starting. Doing it by hand appears to work:
Code:
#  service lpd start
Starting lpd.
But I'm guessing lpd dies immediately because I see this:

Code:
% lpr file.txt
lpr: Unable to connect to /var/run/printer: No such file or directoy
lpr: Check to see if the master 'lpd' process is running.
jobs queued, but cannot start daemon.

%  printf "This is a test\r\n\f" | lpr
lpr: Unable to connect to /var/run/printer: No such file or directory
lpr: Check to see if the master 'lpd' process is running.
jobs queued, but cannot start daemon.
I have no idea about /var/run/printer. It is indeed not there, and I don't know what it is supposed to be. Perhaps this is related to me running KDE and using a GUI terminal. Anybody have any ideas?

Additional information:
Code:
%  ps l`cat /usr/spool/lpd.lock`
cat: /usr/spool/lpd.lock: No such file or directory
%  ls -lg /usr/ucb/lpr
ls: /usr/ucb/lpr: No such file or directory
 
lpd(8) will not start without a valid /etc/printcap. It checks with chkprintcap(8) first, and I think it also checks for the presence of queue directories. What is the output of chkprintcap? What happens when, as root, you run lpd? What are the contents of /etc/printcap?
 
There is no output of chkprintcap. The contents of /etc/printcap:

Code:
lp:\
  :lp=9100@XER:\
  :sh:\
  :mx#0:\
  :sd=/var/spool/lpd/lp:\
  :lf=/var/log/lpd-errs:
 
I forgot to add that I've been trying all combinations as both root and user. The result is always the same:
Code:
Unable to connect to /var/run/printer
And always #service lpd start reports as starting, but does not show up as a process.

I've spent many hours searching forums and advice, and it seems my situation is unique. According to the man page there are some associated files:
Code:
/etc/printcap printer description file
/var/spool/* spool directories
/var/spool/*/minfree minimum free space to leave
/dev/lp* line printer devices
/var/run/printer socket for local requests
/etc/hosts.equiv lists machine names allowed printer access
/etc/hosts.lpd lists machine names allowed printer access, but not
under same administrative control.
I understand these are not all relevant, but perhaps I should create some of them by hand.

Note that this is on the same hardware that I ran 9.1 on and it's a fresh install, up to date, and fully patched. Because of that I was surprised to find that flock(2) was not installed, but that the lpd(8) man page said it was needed. I installed it, but it made no difference - even after rebooting.
 
No output from chkprintcap is good, it means no problems were found. Does /var/spool/lpd/lp exist?
 
Code:
/var/spool/lpd/lp SCO#  ls -lr
total 596
-rw-rw----  1 ole  daemon  202704 31 Jan 20:49 dfA013SCO.lan.cgs
-rw-rw----  1 ole  daemon  80 31 Jan 19:15 dfA012SCO.lan.cgs
-rw-rw----  1 root  daemon  80 31 Jan 19:14 dfA011SCO.lan.cgs
-rw-rw----  1 ole  daemon  80 31 Jan 19:12 dfA010SCO.lan.cgs
-rw-rw----  1 ole  daemon  80 31 Jan 18:20 dfA009SCO.lan.cgs
-rw-rw----  1 ole  daemon  80 31 Jan 16:53 dfA008SCO.lan.cgs
---snip---
 
Code:
#  lpc status all
lp:
  queuing is enabled
  printing is enabled
  12 entries in spool area
  printer idle

CUPS is not installed.
 
I don't want to sound like I'm not doing my bit here. I've spent many hours on this and not made any headway, so I'm extremely grateful for your help. :)

I just did a bit more exploration. There are two machines of comparable architecture here which have a new installations of FreeBSD 10.1-RELEASE. So as to avoid confusion, I'm limiting my answers here to only one, which is my regular desktop box. The other, my partner's, I usually administer via SSH and install stuff on after it works on mine. It is of course possible that I've screwed up something in the process here, but I do think I've kept it quite clean regarding lpd.

I just checked that other machine to see how it responded to the same basic installation, ie. spool directory w/ permissions, and basic chkprintcap file. It appears that lpd is running, but that it won't print either.
Code:
# service lpd status
lpd is running as pid 1342.
#root@TOP:/var/spool/lpd/lp # cat status
sending to xer
This is for the other (similar) machine, which will apparently run lpd, but still not print.

I could be tempted to think that there is a printer or network problem, except for the following:

1/ netcat works to send txt and pdf files to the printer.
2/ the printer is pingable by the name XER.
3/ I have tried using both XER and the 192.168.1.141 address.
4/ a laptop running Win7 connected to the lan can print just fine.
 
We should probably back up and establish that there are no customizations like securelevel or some firewall between this machine and the printer. Even with a Windows machine printing, that does not rule out the firewall, because Windows printing is wildly different from the LPD standard.
 
Thanks Warren. I'll be really busy until tomorrow. (need to print minutes and agendas, but will use nc - lol). As soon as I'm free, I'll post some clear information about the setup (including network) so we can start over.
 
In response to your last questions:
SCO# pgrep lpd

SCO# lpc restart all
lp:
no daemon to abort
printing enabled
lpc: Unable to connect to /var/run/printer: No such file or directory
lpc: Check to see if the master 'lpd' process is running.
couldn't restart daemon
SCO# cat rc.conf | grep lpd
lpd_enable="YES"


The problem is that lpd will never run. It says it starts, but isn't there.

PS: I got all my print jobs done just fine with nc. (Saved my butt tonight.)
 
I want to clarify where I'm at and what I'm working with. There are two computers which both have a fresh install (and updated) of FreeBSD 10.1-RELEASE. Base system was installed, followed by xorg then kde4 followed by miscellaneous programs. I double checked and CUPS is not installed.

With all my testing (and detailed following of your how-to) the result is always the same. This computer, SCO, will not run lpd. The other computer, TOP, will run lpd. Neither will print except with netcat.

I have made small changes to /etc/printcap, but below is what it is at now. Although the printer responds to XER, I put the address and port in there in order to eliminate any DNS issues that lpd may have. The network topology regarding the printer and these two machines is simple: both machines are on the same router, and there is a dumb switch at the other computer to add the printer. Local DNS is provided by a hosts file on the router, but XER is now in the individual hosts files as well.
Code:
SCO#  cat printcap
lp:\
  :lp=9100@192.168.1.141:\
  :sh:\
  :mx#0:\
  :sd=/var/spool/lpd/lp:\
  :lf=/var/log/lpd-errs:
SCO#  lpc status lp
lp:
  queuing is enabled
  printing is enabled
  2 entries in spool area
  printer idle
Like I said earlier, I'll limit myself to dealing with SCO, but TOP may nevertheless be of interest since it is almost the same installation which exhibits slightly different behaviour. I think it is telling that both these computers printed fine on the same network setup when they were running FreeBSD 9.1-RELEASE.

Edit to add:
Code:
SCO#  sysctl -n kern.securelevel
-1
There is no securelevel listed in /etc/rc.conf and I don't know where it is coming from.
 
I'm running 10.1 and have not changed my printing setup in a long time, and it still works. Are there any messages in /var/log/lpd-errs?

So far, we've only seen the permissions of the entries in the spool. What is the output of ls -ld /var/spool/lpd/lp?
 
Your success with 10.1 and lpd is encouraging.

Messages in /var/log/lpd-errs
Code:
Jan 31 18:20:30 SCO lpd[1328]: lpd startup: logging=0
Jan 31 18:20:30 SCO lpd[1328]: /var/spool/output/lpd.lock: No such file or directory
Jan 31 18:48:12 SCO lpd[1392]: lpd startup: logging=0
Jan 31 18:48:12 SCO lpd[1392]: /var/spool/output/lpd.lock: No such file or directory
Code:
SCO%  ls -ld /var/spool/lpd/lp
drwxrwx---  2 daemon  daemon  512  4 Feb 02:35 /var/spool/lpd/lp
 
Now that's kind of interesting. Where is the output in /var/spool/output/lpd coming from?
I don't know. There's no such directory.
Code:
SCO#  ls -la
total 12
drwxr-xr-x  3 root  wheel  512 29 Jan 20:35 .
drwxr-xr-x  25 root  wheel  512  4 Feb 17:10 ..
drwxr-xr-x  3 root  wheel  512 29 Jan 20:35 lpd
That started at some point and I don't know what I did then. As far as I know the system should be back to normal regarding any lpd adjustments on my part. I did install apsfilter in my earlier attempts, but decided to not use it until I got the basics going first because I probably have no need for it anyway. Here is the top of the lpd-errs file:
Code:
SCO#  less lpd-errs
Jan 20 19:59:24 SCO newsyslog[432]: logfile first created
Jan 27 22:51:33 SCO lpd[1883]: lpd startup: logging=0
Jan 27 22:54:45 SCO lpd[623]: lpd startup: logging=0
Jan 27 23:53:48 SCO lpd[1301]: lpd startup: logging=0
Jan 28 00:01:20 SCO lpd[626]: lpd startup: logging=0
Jan 29 20:39:06 SCO lpd[6855]: lpd startup: logging=0
Jan 29 20:39:06 SCO lpd[6855]: /var/spool/output/lpd.lock: No such file or directory
Jan 29 20:56:23 SCO lpd[6915]: lpd startup: logging=0
Jan 29 20:56:23 SCO lpd[6915]: /var/spool/output/lpd.lock: No such file or directory
Jan 29 20:58:16 SCO lpd[6933]: lpd startup: logging=0
 
It would be coming from a config file. Maybe you mixed the configurations from my web article and the Handbook? They might not be consistent with each other.

Let's do this. Erase /var/log/lpd-errs: echo "" > /var/log/lpd-errs. Then run lpd(8): lpd and show the new /var/log/lpd-errs.
 
OK, so now we have (whole file):
Code:
SCO#  cat /var/log/lpd-errs

Feb  4 20:56:52 SCO lpd[1675]: lpd startup: logging=0
Feb  4 20:56:52 SCO lpd[1675]: /var/spool/output/lpd.lock: No such file or directory

Edit to add: Regarding config files, I only have one that I know of, and that is the /etc/printcap. It is very simple (as shown above).
 
I think that is coming from a file somewhere. As root, try find /etc | xargs grep /var/spool/output.
 
I did install apsfilter in my earlier attempts, but decided to not use it until I got the basics going first because I probably have no need for it anyway.
I used to use print/apsfilter and what I recall is that it set up the print directories in /var differently than W. Blocks guide. Could the differences you see between SCO and TOP be due to running apsfilter setup on just one? One problem with apsfilter is it does not setup JetDirect Network printer properly. This can be worked around by editing the printcap to have the lp entry. Here is my old apsfilter printcap:
Code:
# APS1_BEGIN:printer1
# - don't delete start label for apsfilter printer1
# - no other printer defines between BEGIN and END LABEL
lp|hp5l|ljet4;r=300x300;q=medium;c=gray;p=letter;m=auto:\
  :lp=9100@192.168.1.2:\
  :rp=raw:\
  :if=/etc/apsfilter/basedir/bin/apsfilter:\
  :sd=/var/spool/lpd/hp5l:\
  :lf=/var/spool/lpd/hp5l/log:\
  :af=/var/spool/lpd/hp5l/acct:\
  :mx#0:\
  :sh:
# APS1_END - don't delete this
 
I think that is coming from a file somewhere. As root, try find /etc | xargs grep /var/spool/output.
It looks like my inactive configs is all that comes up.
Code:
SCO#  find /etc | xargs grep /var/spool/output
/etc/printcap.save:#  :lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:
/etc/printcap.save:#  :rm=lphost:sd=/var/spool/output/lphost:lf=/var/log/lpd-errs:\
/etc/printcap.save:#  :lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:
/etc/printcap.old:#  :lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:
/etc/printcap.old:#  :rm=lphost:sd=/var/spool/output/lphost:lf=/var/log/lpd-errs:\
/etc/printcap.old:#  :lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:
 
Back
Top