BPI-R2 cups config in LXC container

I’m in lxc-container, but should give up with it and probably listen to you testing without it! I’ve addded deb package, which you’ve uploaded to gdrive. I see now following in config :

cat /boot/config-5.4.51-bpi-r2-main | grep -i 'usb_support\|ohci_hcd\|uhci_hcd\|usb_printer'
# CONFIG_MEDIA_USB_SUPPORT is not set
CONFIG_USB_SUPPORT=y
# CONFIG_USB_OHCI_HCD is not set
# CONFIG_USB_UHCI_HCD is not set
CONFIG_USB_PRINTER=m

Output of lpinfo :

root@debianprinter:~# lpinfo -v
network beh
file cups-brf:/
network lpd
network http
network ipp
network socket
network ipps
network https

I tested with the backend :

root@debianprinter:~# /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;FID: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;MDL:Epson Stylus SX230;CLS:PRINTER;DES:EPSON Epson Stylus SX230;CID:EpsonRGB;FID:FXN,DPN,WFN,ETN,AFN,DAN;" ""

There is a browser config on port 631, I’ve been trying to find my epson printer here, but with no luck!

except the browser-config it seems cups recognizes your printer…maybe you need a userlevel driver (ppd or similar) for it?

I’ve found this one :

root@debianprinter:~# lpinfo -m |grep SX230
escpr:0/cups/model/epson-inkjet-printer-escpr/Epson-Stylus_SX230-epson-escpr-en.ppd Epson Stylus SX230, Epson Inkjet Printer Driver (ESC/P-R) for Linux

This should be a ppd driver for my printer.

Another solution would be epsons driver page, but no package founded for arm, just source rpm : http://download.ebz.epson.net/dsc/du/02/DriverDownloadInfo.do?LG2=EN&CN2=SG&CTI=4&PRN=ME%20OFFICE%20530&OSC=LX

Do you think,that the ppd driver should work from only in cli?

i don’t know how printers exactily work in linux, but i guess you need a special driver like i for HP to get it working…it seems no kernel issue anymore

Have you ever made deb package from source rpm? I’ve found rpm package for x86 32bit and 64bit, but no arm! :frowning:

you need to compile first code (maybe unpack source-rpm) to arm-binaries, packing to deb is similar to my manual way for kernel in build.sh (search for deb-function)

After a month I can tell you, the problem is with lxc version 3. In version 2 I’m able to passtrough usb to container, but in version 3 it simply didn’t want to work. Outside of lxc cups works, so the solution was modifying kernel configuration! Sorry for the late answer, hadn’t much time recently!

Which option was missing?

Exactly what you’ve mentioned :

CONFIG_USB_PRINTER

So, I wanted just thank you! :+1: :slightly_smiling_face:

could you share your lxc and cups-config/tests (how to check if passthrough works) for users want doing the same?

Yes, I would share! Should I open a new topic?

Perhaps I wasn’t clear, only outside of LXC works it now. On BPI-R2 there is version 3.x of LXC, and it would be to much work downgrading to 2.x (there is another 4 containers with transmission+flexget, openvpn+fail2ban+iptables, radioripping for more channels, pi-hole) . I use another arm board ( cubieboard2 with debian 9 ) with lxc version of 2.x . I have configured usb camera with motion in lxc with usb passtrough, so I’m only thinking here could I apply cups with success…

it’s still related to r2, cups and lxc…share it here. LXC version is based on OS…not the device (buster may have 3.x where jessie/strecth may have 2.x). but you do not have to convert anything…just share what you have done for getting printer working in LXC-container (/var/lib/lxc/containername/config and cups-config in container)

Hello Frank!

I haven’t forgot cups, but I’ve been busy recently. I couldn’t make it work in LXC (I tried it after our last conversation), but only could on host outside of container! What’s missed in the beginning, was kernel module : CONFIG_USB_PRINTER

After you’ve compiled it, was taken, and simply installed cups from apt repository. To check if printer can be recognised run :

/usr/lib/cups/backend/usb

Output should be similar to mine expect last line depending on type of printer:

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;FID: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;MDL:Epson Stylus SX230;CLS:PRINTER;DES:EPSON Epson Stylus SX230;CID:EpsonRGB;FID:FXN,DPN,WFN,ETN,AFN,DAN;" ""

If something went wrong, you get this as last line, and should check kernel config :

DEBUG: Failed to open device, code: -4

To reach webinterface from everywhere in LAN should run :

cupsctl WebInterface=yes
cupsctl --remote-admin --remote-any

And now you should have acces to it, and ready for add printer, share it, etc…

There is an android app called Let’s print droid, I use it frequently for printing over wifi.

I guess it’s configuration issue on usb passthrough (write permissions?) Which errors do you get inside container?

With backend I get that one :

DEBUG: Failed to open device, code: -4

To lxc config I wrote this :

lxc.cgroup.devices.allow = c 181:* rw
lxc.mount.entry = /dev/usb/lp0 dev/usb/lp0 none bind,optional,create=file

To group lp added root.

you could try binding usb-node (/dev/bus/usb/X/Y) instead of the LP-node and rwm (additional “m”)

like stated here (also used for printer):

Unfortunately, it didn’t help!

I’ve tried followings:

lxc.cgroup.devices.allow = c 181:* rwm
lxc.mount.entry = /dev/usb/lp0 dev/usb/lp0 none bind,optional,create=dir
lxc.cgroup.devices.allow = c 189:* rwm
lxc.mount.entry = /dev/bus/usb/001/005 dev/bus/usb/001/005 none bind,optional,create=dir

Of course I’ve tested it with this option too :

none bind,optional,create=file

But something has changed, because I got following output :

DEBUG: Failed to open device, code: -1

Do you have same rights in container as outside? Same user and group (uid/gid may differ)

Maybe lp can only mapped once (host blocking client. So you could try unloading lp on host and load in client (need to copy to container)

Same rights :

root@debianprinter:/# ls -l /dev/bus/usb/001/005
crw-rw-r-- 1 root lp 189, 4 Sep 21 09:04 /dev/bus/usb/001/005
root@debianprinter:/# ls -l /dev/usb/lp0
crw-rw---- 1 root lp 180, 0 Sep 21 09:04 /dev/usb/lp0
root@debianprinter:/# exit
root@bpi-r2:/var/lib/lxc/debian_printer$ ls -l /dev/bus/usb/001/005
crw-rw-r-- 1 root lp 189, 4 Sep 21 09:04 /dev/bus/usb/001/005
root@bpi-r2:/var/lib/lxc/debian_printer$ ls -l /dev/usb/lp0
crw-rw---- 1 root lp 180, 0 Sep 21 09:04 /dev/usb/lp0

root@bpi-r2:/var/lib/lxc/debian_printer$ cat /etc/group | grep lp
lp:x:7:furumc,root
lpadmin:x:118:
root@debianprinter:/# cat /etc/group | grep lp
lp:x:7:furumc,root
lpadmin:x:113:

How do you mean unload lp on host?

Right,unloading on host (and disabling the mount/binding for lp0),only passing usb to container and loading module in container (need to copy into it to same path)