Driverless Printing on Void Linux

 2024-12-19

 Void Linux

This article is the English version of the Japanese article titled ‘Void Linuxでプリンタにネットワーク接続してドライバーレス印刷する’.

Printers can now be used easily on Linux

About 10 years ago, it was a bit of a hassle to use a printer from a Linux desktop. Although the advent of CUPS has greatly simplified the creation of drivers, it was necessary to choose a manufacturer and model that provided drivers for Linux, and there was the hassle of manually installing the driver provided by the manufacturer. Some people may have had the experience of using Windows only for printing because they did not have a printer that was compatible with Linux.

However, with the spread of smartphones, the common sense that a printer is something that is connected to a PC and printed on has changed. It is now commonplace to be able to access a printer directly from a smartphone and print, and it has become a standard function of modern printers. This has created a situation where printers can be used very easily even by people who use Linux. Just as it is now commonplace to be able to print directly from a smartphone, it is now easy to print from a PC with Linux installed.

Author’s environment

This is the author’s environment that was verified when writing this article.

ItemValue
OSVoid Linux
PrinterBrother DCP-J926N
ConnectionNetwork connection

Check if the printer supports driverless printing

First, check if the printer supports driverless printing.

Check on OpenPrinting to see if the printer is a driverless model. If it supports IPP Everywhere or Air Print, it supports driverless printing. These printers often also support Mopira and Wifi Direct. The Brother DCP-J926N that I use supports Air Print, so it supports driverless printing.

If you want to check using a command, use ipptool to check with the following command.

ipptool -tv ipp://<ip_address_or_hostname>:631/ipp/print get-printer-attributes.test | grep -E "ipp-versions-supported|document-format-supported|get-printer-attributes"

This is an example of output from Brother DCP-J926N.

"/usr/share/cups/ipptool/get-printer-attributes.test":
    Get printer attributes using get-printer-attributes                  [PASS]
        ipp-versions-supported (1setOf keyword) = 1.0,1.1,2.0
        document-format-supported (1setOf mimeMediaType) = application/octet-stream,image/urf,image/jpeg,image/pwg-raster,application/vnd.brother-hbp

If the following three points are met, then the printer supports driverless printing.

  • The get-printer-attributes test returns PASS.
  • The IPP version is 2.0 or higher.
  • Either application/pdf, image/urf, or image/pwg-raster is supported.

For color, we also check whether the printer supports image/jpeg.

Installing CUPS

When using printers on Linux, CUPS is almost essential. First, install CUPS. The cups-filters package is not necessarily required when using CUPS, but we will install cups-filters this time.

Execute the following command with root privileges.

xbps-install cups cups-filters
ln -s /etc/sv/cupsd /var/service/

Add an administrator account to the lpadmin group

Add a user with administrator privileges to the lpadmin group so that they can manage CUPS.

gpasswd -a <username> lpadmin

Adding a printer manually

First, let’s look at how to add a printer manually. We will discuss how to automatically detect and add a printer later.

Adding with the lpadmin command

The following command is used to add a Brother printer that prints driverlessly over the network to CUPS. For Brother printers, use the URI format ipp://<hostname>/ipp/port1.

lpadmin -p <printer_name> -E -v ipp://<hostname>/ipp/port1 -m everywhere

With this, you can use the printer without installing a driver.

Adding from the CUPS WEB interface

If you are reluctant to use lpadmin, you can also add it from the WEB screen. Access http://localhost:631/admin and log in with an account that has been added to the lpadmin group.

Select “Add printer”.

fig.1

This time, select ipp as the protocol. For Brother printers, enter the format ipp://<hostname>/ipp/port1.

fig.2

Enter a description and location and press “Continue”.

fig.3

For the driver, select Generic IPP Everywhere.

fig.4

If the printer is added without any problems, it’s OK.

fig.5

Automatically recognize the printer

Using Avahi and cups-browsed, you can automatically add IPP Everywhere-compatible printers to CUPS. Avahi detects printers on the network, and cups-browsed adds the appropriate printer to CUPS. This means that if the printer is IPP Everywhere-compatible, you can simply connect the printer to the network without any special operations.

Installing required packages

Assuming that CUPS is available, install the following packages. The package names are as follows for Ubuntu, Arch, and Void.

  • avahi
  • nss-mdns
  • cups-browsed

The package names may differ depending on the distribution.

Configuring cups-browsed

Edit /etc/cups/cups-browsed.conf as follows. Just remove the comment out.

CreateIPPPrinterQueues All

Enabling avahi-daemon and cups-browsed

Execute the following command with root privileges.

ln -s /etc/sv/avahi-daemon /var/service/
ln -s /etc/sv/cups-browsed /var/service/

This will start the avahi-daemon and cups-browsed services, and the printer that supports driverless printing will be automatically added. If you want to know if avahi has detected the printer, use the following command.

avahi-browse -art

If you want to check if the printer has been added to CUPS, use the following command.

lpstat -v

Example output

device for Brother_DCP_J926N: implicitclass://Brother_DCP_J926N/

The printer that is displayed as “implicticlass” represents the printer managed by cups-browsed.

Conclusion

Because I had been using an old printer that was not driverless, I assumed that when using a printer with Linux, I would have to download a driver from the manufacturer and install it in various ways. When I bought a new printer, I found out that many printers support driverless printing, and I realized that a big step had been made in resolving one of the concerns about using Linux for desktop purposes: the printer connection problem.

References