Installing CUPS on PVE’s LXC Container System

Introduction:

At home, I use a Canon LBP6030 USB printer connected to a Padavan system on a router (Youku1) to enable wireless printing. However, wireless printing can only be achieved on the Windows platform, and on systems such as macOS and IOS from Apple, it cannot be achieved, causing some inconvenience.

I came across this post on SMZDM N1刷armbian變身打印服務器, which can install CUPS software as a printer server system, and thus the following content was recorded.


Table of Contents:


Requirements:
  • Platform that can install CUPS software

    Such as armbian, ubuntu, centos, etc. I chose the Debian Linux platform.

  • Printer driver that supports the platform

    If the driver that supports the platform can be found on OpenPrinting, this step can be ignored.

Return to Table of Contents


Installation of LXC container system (Debian) on PVE

LXC provides an operating system-level virtualization environment that is installed on a system based on Linux.

The free PVE virtual server makes it easy to create a new Linux system (i.e., a canned system) with a shared kernel.

Download the CT template:

Create the LXC system:

The newly created LXC system does not need to be started yet.

Return to Table of Contents


Passing through USB ports to LXC:

Connect the USB port of the printer Canon LBP6030 to the USB port of the PVE host.

Use lsusb to check the connected USB devices:

lsusb

We can see that Device 003 on Bus 001 is Canon.

Check thedevice number of Canon on the Bus 001:

ls -al /dev/bus/usb/001

Allow LXC to access the USB device on PVE through cgroup.

cat >> '/etc/pve/lxc/100.conf' << EOF
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/bus/usb/001 dev/bus/usb/001 none bind,optional,create=dir
EOF

The ID of LXC is 100, and the configuration file path is /etc/pve/lxc/100.conf.

The device inside 189:* rwm is allowed to be read, written, and mounted.

Mount the entire Bus 001 USB port. The advantage of this is that even if the device number changes due to unplugging the USB port of the printer multiple times, the mounting will not be affected.

Start the newly created LXC container.

Check if it has been mounted in the LXC container’s Console:

dmesg | grep -in 'canon'
1617:[3489934.461195] usb 1-1: Manufacturer: Canon,Inc.
1837:[3494585.821378] usb 1-1: Manufacturer: Canon,Inc.

Seeing Manufacturer: Canon, Inc. means that the USB printer has successfully connected to the LXC container.

Return to Table of Contents


Installation of CUPS software and printer driver on LXC (Debian)

CUPS (Common UNIX Printing System) is a printing system supported in Fedora Core3 that mainly uses IPP (Internet Printing Protocol) to manage print jobs and queues, but also supports communication protocols such as LPD (Line Printer Daemon), SMB (Server Message Block), and AppSocket. From Baidu

Install the CUPS software:

sudo apt update && sudo apt install -y cups

Enable remote access to CUPS:

sudo cupsctl --remote-any

Add the current user to the lpadmin group:

sudo usermod -aG lpadmin $USER

If the printer that is supported can be found on OpenPrinting, this step can be ignored.

Download and install the printer driver for Canon LBP6030:

wget https://gdlp01.c-wss.com/gds/0/0100005950/10/linux-UFRIILT-drv-v500-uken-18.tar.gz \
&& tar xzvf linux-UFRIILT-drv-v500-uken-18.tar.gz \
&& sudo dpkg -i ./linux-UFRIILT-drv-v500-uken/64-bit_Driver/Debian/cnrdrvcups-ufr2lt-uk_5.00-1_amd64.deb \
&& rm -rf linux-UFRIILT-drv-v500-uken linux-UFRIILT-drv-v500-uken-18.tar.gz

Enter the following address in a browser: https://10.1.1.253:631/admin/

The IP address of the LXC system is: 10.1.1.253

Print test page:

Installing CUPS software completes the configuration of the printer server system.

Return to Table of Contents


Installation and testing of printer on multiple platforms

After the deployment of CUPS software, multiple platforms can share printers. In the following example, I tested wireless printing functionality on Windows7, Windows10, macOS, iOS, and Android.

Installing Printer on Windows 10:

Installing Printer through Search

Manual Installation of Printer

If the printer cannot be found through search or on a different network segment, manual installation of the printer is required.

Open the CUPS interface by entering http://10.1.1.253:631 in a browser and copy the path.

Paste the path # Note that it cannot be https.

Return to Table of Contents

Installing Printer on Windows 7:

Manually install the printer and prepare the corresponding Windows driver in advance.

Note that the pasted path cannot be https.

Select the Windows driver that was prepared in advance.

Return to Table of Contents

Installing Printer on macOS:

Return to Table of Contents

Installing Printer on Android:

The tested Android device is the OnePlus 6, and the “Mopria Print Service” app is installed from the software store.

Return to Table of Contents

Installing Printer on Linux (Deepin):

Return to Table of Contents


Conclusion:

I believe that the most difficult part is the installation of the printer driver. If the manufacturer and model are found on OpenPrinting, the process should be relatively simple.

The advantage of using PVE’s LXCcontainer with CUPS installed is that it makes managing printers on a network much easier, especially for multiple users and devices. Overall, the installation process for printers on different operating systems varies, but with the right steps and information, it can be accomplished successfully.

Manually install printers using software like zero-tier, which can enable remote (cross-regional) printing. For example, you can directly access your home printer from work to print documents.


References:

USB Passthrough to an LXC (Proxmox)

OpenPrinting

N1刷armbian變身列印伺服器,支援全平臺無線列印@PC掃描