Solved Network printing issue...

I recently acquired a Brother HL-L2300D laser printer. It only has a USB interface.
I plugged it into the USB socket on my OpenWRT router (ip address 192.168.0.2) and installed p910nd print server software[1]
I connected to the printer from a Linux desktop (Linux Mint) and tested everything. All worked as expected[2]
I then reviewed Handbook chapter 11 Printing
I created the new spool directory.
I added an extra entry to /etc/printcap:

Code:
# added by mg 14 dec 2023
# Brother HL-L2300D attached to Openwrt router
lp4|laser2|Brother HL-L2300D:\
        :rm=9100@192.168.0.2:\
        :rp=raw:\
        🇸🇭\
        :mx#0:\
        :sd=/var/spool/lpd/lp4:\
        :lf=/var/log/lpd-errs:\
        :if=/usr/local/libexec/broif:

I restarted the printing subsystem
# lpc restart all

I tried to print to the printer:
# lpr -Plp4 /etc/printcap
No output

I examined /var/spool/lpd/lp4. There were a number of files[3]
I examined /var/log/lpd-errs. There was a non specific error message [4]

I have in the past tried to install CUPS but I have found it causes problems with Samba and I don't want
to cause further problems with a production system.

I've searched online for answers without success.

Advice please.










[1]https://openwrt.org/docs/guide-user/services/print_server/p910ndprinterserver

[2]Printer manager settings - socket://192.168.0.2:9100

[3]
Code:
root@pr5:/home/user2 # ls -lrt /var/spool/lpd/lp4
total 27
-rw-rw-r--  1 root    daemon     0 Dec 14 10:59 errs.iMcNNh2
-rw-rw-r--  1 root    daemon     0 Dec 14 11:00 errs.kQERMN0
-rw-rw-r--  1 root    daemon     0 Dec 14 11:32 errs.Ng0DGI3
-rw-rw-r--  1 root    daemon     0 Dec 14 11:32 errs.KgnNPvd
-rw-rw-r--  1 root    daemon     0 Dec 14 11:35 errs.shTfofW
-rw-rw-r--  1 root    daemon     0 Dec 14 11:35 errs.geo7KqQ
-rw-rw-r--  1 root    daemon    33 Dec 14 11:46 status
-rw-rw----  1 root    daemon  1078 Dec 14 15:53 dfA006pr5.blank.blank
-rw-rw----  1 daemon  daemon   101 Dec 14 15:53 cfA006pr5.blank.blank
-rw-rw-r--  1 root    daemon     0 Dec 14 15:53 errs.0IwlrlK
-rw-rw----  1 root    daemon  1078 Dec 14 15:54 dfA007pr5.blank.blank
-rw-rw----  1 daemon  daemon   101 Dec 14 15:54 cfA007pr5.blank.blank
-rw-rw-r--  1 root    daemon     0 Dec 14 15:54 errs.ooiXFJZ
-rw-rw-r--  1 root    daemon     0 Dec 15 06:06 errs.HUGqV6T
-rw-rw----  1 user2   daemon  1078 Dec 15 11:22 dfA008pr5.blank.blank
-rw-rw----  1 daemon  daemon   102 Dec 15 11:22 cfA008pr5.blank.blank
-rw-rw-r--  1 root    daemon     0 Dec 15 11:22 errs.Wpnh4fQ
-rw-r--r--  1 root    daemon     4 Dec 15 11:23 .seq
-rw-rw----  1 root    daemon  1078 Dec 15 11:23 dfA009pr5.blank.blank
-rw-rw----  1 daemon  daemon   101 Dec 15 11:23 cfA009pr5.blank.blank
-rw-rw-r--  1 root    daemon     5 Dec 15 11:23 lock
-rw-rw-r--  1 root    daemon     0 Dec 15 11:23 errs.oSXygXC
The files length 1078 have the text from the file I tried to print.
The files length 101 have contents like:
Code:
Hpr5.blank.blank
Proot
Cpr5.blank.blank
fdfA006pr5.blank.blank
UdfA006pr5.blank.blank
N/etc/printcap
[4]
Code:
Dec 14 11:37:14 pr5 lpd[1368]: mail sent to user root about job <unknown> on printer lp4 (ACCESS)
Dec 14 11:37:14 pr5 lpd[1368]: lp4: job could not be printed (cfA000pr5.blank.blank)
Dec 15 06:06:52 pr5 lpd[705]: lpd startup: logging=0
 
Several comments.
I believe tha the HL-L 2300 is a GDI printer and print/brlaser should be a more capable filter.
The Brlaser site says the HL-L 2300D is supported:
Brlaser github


The handbook describes using netcat to test the connection:
Code:
# nc netlaser 9100 < sample.txt
You have to setup your /etc/hosts to resolve the netlaser address on your LAN. to test but unfortunately, it will print unformated, random text without the correct filter.

The last issue is that cups-filter is broken - we used to be able to use it with lpr. Currently lpr is best used with printers that have a ghostscript driver (PCL5, PCL6......) or a postscript printer.

Your best bet is to use cups/brlaser and duplicate your setup in Linux Mint.
 
Last edited:
Thank you for your helpful reply. I appreciate your taking the time. Unfortunately because I'm reluctant to install CUPS I'm unable to resolve the issue.
 
OK, I've set up a spare system (14.0).
I consulted the CUPS page in the handbook but ran into problems accessing the web interface for systems on the same network. I've tried various setting in /usr/local/etc/cups/cupsd.conf and I briefly had access to the 'admin' page but I changed something and can't get it back. Would some kind soul care to share a working cupsd.conf?
 
I was coming back to edit my reply. In OpenBSD there have been some code commits to cups-filters and I retried lpr setup using foomatic-rip described here:
pkg-readme for cups-filters

Initially, the print job did not go through:
Code:
#!/bin/sh

${LOCALBASE}/bin/a2ps -BRq --columns=1 -o - | \
    ${PREFIX}/bin/foomatic-rip -q -P samsung-ml2850d

Apparently it is dying at a2ps because it worked when a2ps was removed:

Code:
#!/bin/sh

 ${PREFIX}/bin/foomatic-rip -q -P samsung-ml2850d

FreeBSD's lpr may work for you using foomatic-rip (Not documented in FreeBSD's Handbook) - there were prior FreeBSD forum posts that it worked. forum search for "oko foomatic-rip"

Quick instructions;
1. Look for the brlaser*ppd (/usr/local/share/cups/model/?) and if you find it, make a copy.
Remove cups and install print/cups-filters and print/brlaser
2. Hopefully brlaser will install a ppd in /usr/local/share/cups/model. This will need to be copied to a location that foomatic-rip will access.
In OpenBSD it is /etc/foomatic/direct (default) but FreeBSD may utilize /usr/local/etc/foomatic/direct - or use the --ppd option to specify the path
to the ppd
foomatic-rip(1)
3. If not you can either generate a ppd with foomatic-ppdfile with a brlaser driver. The brlaser driver has been added to the latest version of ghostscript:
Ghostscript github
It is some work but once you generate the ppd it should work until foomatic-rip breaks.
4. You should be able to setup duplex and envelope printing as separate drivers.

If you stay with cups there is a suggested configuration described in an OpenBSD pkg-readme:
OpenBSD brlaser pkg-readme
The FreeBSD PLIST does not include a similar readme.
 
Thanks for that, but I'm now trying to get CUPS working, with notably little success. It seems I can't come up with a cupsd.conf which allows me to use the web gui interface. At the moment I'm trying to copy the cupsd.conf from an Ubuntu server installation.
 
When I have used cups, localhost:631 has always worked out of the box. There are 2 potential pitfalls:
1. The cups server is not running
2. Possibly the browser needs to have it's storage cache cleared.

What I would do is uninstall the cups package and double check that the /usr/local/etc/ configuration directories are deleted. The reinstall, enable cups in /etc/rc.conf, reboot and try to access with your browser.

In these instructions, you should not have to provide any /etc/devfs.rules since you are printing over the local network.
 
You seem to have headed down two dry gulches...

For lpr/lpd on your FreeBSD system, I would have tried a printcap something like this:
Code:
p4|laser2|Brother HL-L2300D:\
        :lp=9100@192.168.0.2:\
        :mx#0:\
        :sd=/var/spool/lpd/lp4:\
        :lf=/var/log/lpd-errs:\
        :rp=<insert name of printer on OpenWRT router here>:
Alternatively, for CUPS on your FreeBSD system, I would have used the "IPP Everywhere" protocol, supported by virtually all modern printers. I have a Brother HL-L5200DW connected to a Linux host (192.168.1.26) using CUPS, and also use CUPS with IPP Everywhere on my FreeBSD host, to send print jobs to the Linux host. The FreeBSD CUPS printer is configured like this:
Code:
Description:    Brother_HL-L5200DW_series
Location:       Phil's Office
Driver: series - IPP Everywhere - IPP Everywhere (grayscale, 2-sided printing)
Connection:     ipp://192.168.1.26:631/printers/Brother_HL-L5200DW_series
Defaults:       job-sheets=none, none media=iso_a4_210x297mm sides=one-sided
I'm not completely certain that either of the above approached will work for you, but they may advance your situation.
 
Aha, success. I used a minimal cupsd.conf and am now able to reach the cups gui over the local network:
LogLevel info Port 631 <Location /> Order Deny,Allow Deny From All Allow From 127.0.0.1 Allow From 192.168.0.* </Location> BrowseAddress 192.168.0.255
 
And finally, the ppd file that Linux Mint installs refers to a filter rastertobrlaser, which is a Linux binary. There is an open source driver I came across on Github but modifying it to work on FreeBSD is outside my very limited skill set. So solved, at least for now.
 
Actually rastertobrlaser is provided by print/brlaser - not a linux binary.

FreeBSD Makefile for brlaser - with PLIST

Edit, just occured to me, now that print/ghostscript10 supports the brlaser driver, you should be able to use sDEVICE=brlaser in a print filter in LPR.

Create an executable /usr/local/libexec/ps2brlaser with
Code:
#!/bin/sh
/usr/local/bin/gs -dSAFER -dNOPAUSE -dBATCH -q -sDEVICE=brlaser -sOutputFile=- -

Reference: 11.5.3.3
 
Last edited:
you don't really need cups
just set up a filter for lpd
look at /usr/share/examples/printing (ifhp) change -sDEVICE
also you need to fix the else branch of the ifhp script by piping the text thru a2ps then gs
 
a2ps works like print/enscript. Both will output a postscript file (.ps) on the input of plain text (.txt) So the handbook examples using enscript should also work. a2ps, will also use ImageMagick to convert image formats (*jpeg, *png) to postscript.

If your printing starts with a postscript file or *.pdf, you should not need a2ps/enscript.

I put together a Thread 50607 that allows you to fine tune your print filters. Key points are
1. brlaser is supported as a ghostscript driver although it was not listed by gs -h: GitHub Ghostscript-printer-app
2. You can specify resolution and pagesize in the filter and create multiple filters for the same printers. I believe your printer supports duplex which would save a few trees.
Ghostscript Page size

Ghostscript Raster output devices
 
Back
Top