Troubleshooting Raspberry Pi as a print server configuration

pytugu
2 min readMay 3, 2023

--

Here I will share the issues I found during the configuration of my Raspberry Pi as a print server.

Photo by Harrison Broadbent on Unsplash

Error message #1: “Failed to create /var/spool/cups/tmp/.hplip”

The error message “Failed to create /var/spool/cups/tmp/.hplip” indicates that the CUPS printing system is unable to create a temporary directory for HP printer drivers. Here are the steps you can take to resolve this error:

  1. Open a terminal on your Raspberry Pi or SSH into it.
  2. Create the temporary directory by running the following command:
sudo mkdir /var/spool/cups/tmp/.hplip

3. Set the correct permissions for the directory by running the following command:

sudo chown -R lp:lp /var/spool/cups/tmp/.hplip

4. Restart the CUPS service by running the following command:

sudo systemctl restart cups

After performing these steps, try adding your HP printer again to see if the error has been resolved.

If the error persists, you can try uninstalling and reinstalling the HPLIP package by running the following commands:

sudo apt-get purge hplip sudo apt-get install hplip

This will remove any existing HP printer drivers and reinstall them. Once the installation is complete, restart the CUPS service and try adding your HP printer again.

Error message #2: “Bad Request — CUPS v2.2.10”

I got his error when trying to reach Raspberry Pi print server from my PC, in the same network, through a web browser.

By default cups servers HTTP requests only with HTTP Host header equal to “localhost”. To allow it servicing requests for additional HTTP host headers use ServerAlias directive as described in the man cupsd.conf documentation. If you add the following line to the cups configuration file, the issue should be solved, but be warned that this is not the safest solution:

ServerAlias *

You may add, instead of “*”, only the name you want to call, for example “printserver01”.

Error message #3: “Forbidden — CUPS v2.2.10"

After solving error message #2, I got this one, again, when trying to reach Raspberry Pi print server from my PC, in the same network, through a web browser.

I had to allow my system to access the CUPS server by including the following directive in the /etc/cups/cupsd.conf file:

<Location />
Allow from <client_ip_address>
Order allow,deny
</Location>

where <client_ip_address> is the IP address of the system you want to connect to CUPS Web UI.

I hope this article was useful for you.

Thank you for reading and see you soon.

--

--