Notes on trying to make a printer work in Ubuntu 22.04

19 Aug 2024

I have a Brother laser printer that was working fine in Ubuntu 10.04, but wasn't even findable once I upgraded to Ubuntu 22.04. This is a record of my fumblings and evantual success.

This part failed, so don't do this; I'm just recording my failure for posterity:

Navigate to http://localhost:631/printers/

Select "Administration" tab

Under "Printers" heading, press "Add Printer" button

When prompted for a username and password, use the Unix username and password that you are logged in as.

Under Discovered Network Printers, select the driverless version of your printer. Mine was "Brother HL-L5100DN series (driverless) (Brother HL-L5100DN series)".

The next page will present information that you do not need to change. Press the "Continue" button.

The next page will show a selected printer model. For me, "Brother HL-L5100DN series - IPP Everywhere TM" was already selected. Press the "Add Printer" button.

The next page will allow you to add banners. Don't use banners. Press the "Set Default Options" button.

Now we have a printer, but unfortunately the name "ipp://Brother%20HL-L5100DN%20series._ipp._tcp.local/" can't be found because of the ".local" at the end.

Worse, it seems that the connection string cannot be edited once the printer is set up. Apparently, setting up nss-mdns is the solution, so let's try that.

# systemctl status avahi-daemon.service

Lots of stuff prints out from the above command, but it looks like mDNS is already running via Avahi.

In the file /etc/nsswitch.conf, there is this line:

hosts:          files mdns4_minimal [NOTFOUND=return] dns

Try changing it to this line:

hosts:          mymachines mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns

But that did not work, so let's change it back.

This is interesting:

# host BrotherLaserPrinter
BrotherLaserPrinter.lan has address 192.168.1.235
# host BrotherLaserPrinter.local
Host BrotherLaserPrinter.local not found: 2(SERVFAIL)

In that case, let's add this line to our /etc/hosts file:

192.168.1.235   BrotherLaserPrinter BrotherLaserPrinter.lan BrotherLaserPrinter.local

Great, but now I'm getting garbage. Apparently, the ipp stuff does not work very well!

OK, let's try to download the "driver install tool" for my make and model from the brother website:

Brother Driver Install Tool Link

Now:

$ cd Downloads/
$ mkdir tmp
$ cp linux-brprinter-installer-2.2.4-1.gz tmp
$ cd tmp
$ gunzip linux-brprinter-installer-2.2.4-1.gz
# su -
# bash linux-brprinter-installer-2.2.4-1
Input model name ->HL-L5100DN

You are going to install following packages.
   hll5100dnlpr-3.5.1-1.i386.deb
   hll5100dncupswrapper-3.5.1-1.i386.deb

OK? [y/N] ->y

... license stuff ...

Do you agree? [Y/n] ->y

... more license stuff ...

Do you agree? [Y/n] ->y


Will you specify the Device URI? [Y/n] ->y



0: lpd
1: ipps
2: beh
3: http
4: hp
5: ipp
6: cups-brf:/
7: https
8: socket
9: hpfax
10: dnssd://Brother%20HL-L5100DN%20series._ipp._tcp.local/?uuid=e3248000-80ce-11db-8000-b42200aec8a3
11: ipp://Brother%20HL-L5100DN%20series._ipp._tcp.local/
12: lpd://BrotherLaserPrinter/BINARY_P1
13 (I): Specify IP address.
14 (A): Auto. (dnssd://Brother%20HL-L5100DN%20series._ipp._tcp.local/?uuid=e3248000-80ce-11db-8000-b42200aec8a3)

select the number of destination Device URI. ->13

 enter IP address ->192.168.1.235
lpadmin -p HLL5100DN -v lpd://192.168.1.235/BINARY_P1 -E
Test Print? [y/N] ->y

wait 5s.
lpr -P HLL5100DN /usr/share/cups/data/testprint
apt-get install libusb-0.1-4
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libccid libwpe-1.0-1 libwpebackend-fdo-1.0-1
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  libusb-0.1-4
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 17.7 kB of archives.
After this operation, 62.5 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 libusb-0.1-4 amd64 2:0.1.12-32build3 [17.7 kB]
Fetched 17.7 kB in 1s (34.3 kB/s)
Selecting previously unselected package libusb-0.1-4:amd64.
(Reading database ... 219159 files and directories currently installed.)
Preparing to unpack .../libusb-0.1-4_2%3a0.1.12-32build3_amd64.deb ...
Unpacking libusb-0.1-4:amd64 (2:0.1.12-32build3) ...
Setting up libusb-0.1-4:amd64 (2:0.1.12-32build3) ...
Processing triggers for libc-bin (2.35-0ubuntu3.8) ...
Hit Enter/Return key.

And that worked!

So, seeing as we have specified an IP address that was assigned via DHCP, we should either go back and re-do the above with a static IP address, or we should tell our router to lease that DHCP address to our printer forever. (I did option number two: lease that DHCP address to my laser printer forever.)