# Does LPD still work on FreeBSD 12.0?



## vmb (Sep 12, 2019)

I have been having problems getting LPD to work on FreeBSD 12.0 . I must admit it has been some years since I have used LPD specifically for printing but I have spent quite a lot of time trying to get this working on bare metal and virtual machines and I consistently get the same result.

My test printer is an old but fully functional Brother MFC-660CN. It works flawlessly with it's 32-bit Brother supplied 'driver' pack for Ubuntu and also with 64 bit Windows 10. It prints serving a JetDirect service on port 9100 and also with IPP. I have enabled all services in the printer and my desire is to use the Brother built in print server queues 'TEXT_P1' and 'POSTSCRIPT_P1' with LPD.

My problem is that my local host running LPD is spooling the print job to disk but it is not forwarding it to the Brother printer. I have tried various combinations of lp=, rm= and rp= and nothing seems to work.

I have just built a fresh VM from scratch and done nothing else but set up /etc/printcap to try to print and it still doesn't work. My test hosts are on the same network segment/IP range as the printer.

Here is my simple printcap to test lpd printing to the network printer...

```
root@testlpd:~ # cat /etc/printcap
lp|line printer:\
    :sh:\
    :lp=9100@10.1.252.9:\
    :rp=TEXT_P1:\
    :sd=/var/spool/output/lpd:\
    :lf=/var/log/lpd-errs:
```

Checking the lpd service is running...

```
root@testlpd:~ # service lpd status
lpd is running as pid 1214.
```

Checking that lpd service is running as root...

```
root@testlpd:~ # ps -U root | grep lpd
1214  -  Is    0:00.00 /usr/sbin/lpd
1235  0  R+    0:00.00 grep lpd
```

Try printing the printcap file again as a test...

```
root@testlpd:~ # lp /etc/printcap
```

Check the local print queue that the job has been spooled...

```
root@testlpd:~ # lpc status all
lp:
    queuing is enabled
    printing is enabled
    2 entries in spool area
    printer idle
```

No output from printer using FreeBSD 12.0. Try printing from Ubuntu (CUPS) and Win10, OK.

Now this is where it gets interesting and where I also cannot progress from.
The print queue utility lpq reports that the lpd daemon is not present, or is it looking for another daemon?
It also reports no host to connect to so I telnet to the printer from the FreeBSD host to check connectivity is still OK.

```
root@testlpd:~ # lpq
testlpd: Warning: no daemon present
Rank   Owner      Job  Files                                 Total Size
1st    root       0    /etc/printcap                         122 bytes
2nd    root       1    /etc/printcap                         122 bytes

lpq: lp: no remote host to connect to
```

I can connect to the printer with telnet (all services still enabled)...

```
root@testlpd:~ # telnet 10.1.252.9
Trying 10.1.252.9...
Connected to mfc660cn...........
Escape character is '^]'.

Welcome. Type <return>, enter password at # prompt
```


I am stuck. It would be helpful to know if anyone is using lpd successfully on FreeBSD 12.0?


----------



## Martin Paredes (Sep 15, 2019)

As root, run the command `lpc restart lp`

Read the manual lpc(8), it talks about the message that lpq is displaying "no daemon present"

Also, I am not sure, but when using JetDirect (the standard TCP/IP 9100 'raw' port printing), you can't specify destinations (rp=TEXT_P1), if you want to use the destinations, try using LPD/LPR protocol (port 515) with the next printcap


```
lp|line printer:\
    :sh:\
    :lp=:\
    :rm=10.1.252.9:\
    :rp=TEXT_P1:\
    :sd=/var/spool/output/lpd:\
    :lf=/var/log/lpd-errs:
```

Edited: clarifying the alternative with LPD/LPR.


----------



## gpw928 (Sep 15, 2019)

When you use "rp=", I would expect the "remote printer" daemon to be listening on port 515.  That is different to port 9100, used by JetDirect, as is the telnet test you used (which would have gone to port 23).  Martin's answer looks sound.


----------



## olli@ (Sep 15, 2019)

LPD works fine here with FreeBSD 12 and an “HP Color LaserJet Pro M252dw” (wireless). My /etc/printcap looks like this:

```
lp|laserjet:\
        :sh:\
        :rm=laserjet:\
        :sd=/var/spool/output/laserjet:lf=/var/log/lpd-errs:
```
“laserjet” is the DNS name of the Wifi address of the printer (it has a static IP address). With the command `lpr somefile.pdf` I can send a PDF file directly to the printer. No need to install additional software like CUPS or apsfilter or anything else.


----------

