BPI-R2 cups config in LXC container

Sorry Frank, I’m unsure how to do that technically! Would you mind explaining it?

get path of lp-module (tested commands on my ubuntu-laptop, so kernel-name differs)

$ find /lib/modules/$(uname -r) -iname 'lp.ko'
/lib/modules/5.4.52-custom/kernel/drivers/char/lp.ko

then unload lp-module

modprobe -r lp

copy to lxc-container (untested because i have no lxc here on my laptop, just change name of container in containerroot-var)

containerroot=/var/lib/lxc/containername/rootfs
mkdir -p $containerroot/lib/modules/$(uname -r)/kernel/drivers/char/
cp /lib/modules/$(uname -r)/kernel/drivers/char/lp.ko $containerroot/lib/modules/$(uname -r)/kernel/drivers/char/

go inside your container and run

modprobe lp

i found also a video…maybe it helps

currently have not much time because i started to upgrade (reinstall) my main-router with buster (still running stretch). have outsourced non-router-functionality in lxc, but it is still some porting work (network,dialin,firewall, routing, lxc-host-setup, vpn, host-scripts,…)

@furumc have you tried using the module in container? Any success? Btw. Do you use normal container or a non-priviledged one?

Hello Frank!

Sorry for the late answer, but I’ve been recently busy with family issues! I tested it once, and worked! I’ll make a configuration and write it down in a short guide soon!

As I promised, here is the config for cups in lxc, not 100% but works!

I’ve created a container, and added a fix ip from bridge, and installed cups with apt.

Config under /var/lib/lxc/debian_printer/config :

lxc.net.0.type = veth
lxc.net.0.name = eth0
lxc.net.0.hwaddr = 00:02:4e:c5:3c:a3
lxc.net.0.link = br0
lxc.mount.auto = proc:rw sys:rw cgroup-full:rw:force
lxc.apparmor.profile = generated
lxc.apparmor.allow_nesting = 1
lxc.rootfs.path = dir:/home/WDC/lxc/debian_printer/rootfs
# Common configuration
lxc.include = /usr/share/lxc/config/debian.common.conf
# Container specific configuration
lxc.tty.max = 4
lxc.uts.name = debian_printer
lxc.arch = armhf
lxc.pty.max = 1024
lxc.start.auto = 1

If you want to reach web interface from LAN, type following in container :

cupsctl WebInterface=yes

cupsctl --remote-admin --remote-any

After container started, I could only add usb printer from host with ( I know there is an opportunity to implement it in config but didn’t worked for me ) :

lsusb | grep Epson

Bus 003 Device 003: ID 04b8:0881 Seiko Epson Corp. PX-404A [ME OFFICE 535]

lxc-device -n debian_printer add /dev/usb/lp0

lxc-device -n debian_printer add /dev/bus/usb/003/003

When everything went fine, check printer in container :

/usr/lib/cups/backend/usb
DEBUG: Loading USB quirks from “/usr/share/cups/usb”. DEBUG: Loaded 172 quirks. DEBUG: list_devices DEBUG: libusb_get_device_list=5 DEBUG2: Printer found with device ID: MFG:EPSON;CMD:ESCPL2,BDC,D4,D4PX,ESCPR1;MDL:Epson Stylus SX230;CLS:PRINTER;DES:EPSON Epson Stylus SX230;CID:EpsonRGB;FI D:FXN,DPN,WFN,ETN,AFN,DAN; Device URI: usb://EPSON/Stylus%20SX230?serial=4E3854593030333331&interface=1 direct usb://EPSON/Stylus%20SX230?serial=4E3854593030333331&interface=1 “Epson Stylus SX230” “Epson Stylus SX230” “MFG:EPSON;CMD:ESCPL2,BDC,D4,D4PX,ESCPR1;MD L:Epson Stylus SX230;CLS:PRINTER;DES:EPSON Epson Stylus SX230;CID:EpsonRGB;FID:FXN,DPN,WFN,ETN,AFN,DAN;” “”

On port 631 runs cups, now you should reach (ip:port) it in browser and add your printer.

looks like you still use lp-modules on host and passing the 2 devices into container, right? what is different to prior version?

Exactly!

I’ve found on LXC documentation site this option:

I think this line should be the key…

1 Like

you could try if it still work if you disable this and restart container

I tried disabling it, and after restart it still worked. It’s a phenomenom! :roll_eyes:

Rights on backend :

ls -l /usr/lib/cups/backend/usb  
-rwx------ 2 root lp 26020 Apr 25  2020 /usr/lib/cups/backend/usb

Frank, did you test it in your environment?

Any success?

Not yet because of missing time…still on the way migrating my mainrouter to buster…

$ uptime 
 16:15:01 up 3 days, 21:42
$ uname -r
5.4.66-bpi-r2-main

looks good so far :wink: