CUPS Printer Server on CoreElec with Docker
This story is about how to share an old USB only printer to local network using CoreElec.
CoreElec is an optimized system for Kodi and it is a “just enough” linux without package system. Therefore, installing the printer drivers (e.g. hplip), even the printer server (CUPS) can’t be done via packages. However, CoreElec supports Docker as a Kodi add-on, so the extra servers and drivers can be set up via docker containers. The pre-recruitment is that the Docker add-on is already installed and running.
SSH to CoreElec, and create&run the docker container for CUPS, change the admin (username) and the password string before running this:
docker run -d -name=cups --net=host -v /var/run/dbus:/var/run/dbus — device /dev/bus --privileged -e CUPSADMIN=”nas” -e CUPSPASSWORD=”nas” --restart unless-stopped tigerj/cups-airprint
If firewall is enabled on the CoreElec, open the 631 port.
Open the cups administration page via port 631 by a browser on the same LAN. Login with same user and password what you specified at the container creation above.
Go to Administration/Add printer. Follow the setup wizard as per your printer. Tick on the Share This Printer to share it via LAN.
The printer should work now via LAN. The printer has to be added first at all clients as well though. The shared printer should appear in the list of network printers automatically but try using the ip address of the CoreElec if it doesn’t appear.
Status: Idle — “Waiting for printer to become available.”
Unfortunately, after a reboot, the printing was not worked, and I saw this status message above in CUPS.
This was my workaround:
SSH to CoreElec and run lsusb. To get the idVendor and idProduct values for the printer, look at the output of lsusb:
Attach to the cups container console:
docker exec -it cups sh
Then create this file using cat:
cat > /etc/udev/rules.d/10-usbprinter.rules2ATTR{idVendor}=="03f0", ATTR{idProduct}=="0117", MODE:="0660", GROUP:="lp"
Reboot the CoreElec (or restart only the container) then the printer should work again