BPI-R2 cups config in LXC container

Hello guys,

I’ve been facing with an issue in the last few days. OS is :

5.4.27-bpi-r2-main, Debian 10 Buster

I attach an usb printer called EPSON Stylus SX230 to bpi-r2, and recognizes :

root@bpi-r2:/home/script$ lsusb Bus 001 Device 003: ID 04b8:0881 Seiko Epson Corp. PX-404A [ME OFFICE 535]

LXC Container runs on debian ( name is debian_printer, has hostname and fqdn ) , has fixed ip. I’m able to give usb device to it :

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

and in lxc looks the same :

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

root@debianprinter:/# ls -l /dev/bus/usb/001/003 crw-rw-rw- 1 root root 189, 2 Jul 14 10:36 /dev/bus/usb/001/003

I’ve changed group ownership to lp, lpadmin, didn’t help.

The main goal would be, that cups could manage the printer, but unable to see it! With the backend I see following :

"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;” “” "

Cups is configured, and can reach web interface.

I’ve no idea, what’s the problem - maybe usbcore kernel module’s missing?

Has somebody tried making printer server from BPI-R2?

It is possible that kernel module(s) are missing…but last time i have configured cups manually was ages before :slight_smile:

You have write-access through cgroup? Maybe there is any command to test printer from cmdline without cups (to check from host). Maybe you can try to copy your sd to another and install cups without lxc?

Looks like only libusb is needed

https://wiki.archlinux.org/index.php/CUPS/Troubleshooting#Conflict_with_usblp

Have to look if it is included…did not found it on 5.4…

maybe CONFIG_USB_PRINTER? could you try setting it and try to access your printer without lxc on first step?

This seems to be more recent and complete

http://www.linuxfromscratch.org/blfs/view/svn/pst/cups.html

So i guess only the usb_printer option is missing (usb ports on r2 except otg are usb3=xhci)

Regarding linuxfromscratch I should recompile my kernel with USB support. I haven’t done it before, could you please advise me hints where to start? I remember I saw your wiki, and there was some explanation, wasn’t it?

just clone my repo on github to your client-pc and compile kernel like it is stated in readme

I’ve just compiled a kernel with usb printer support. In the end, there is 4 choice menu, and I can only choose 1 - why can’t make deb package? Anyway, tomorrow I will make a backup and unpack compiled tar.gz file onto BPI-BOOT and BPI-ROOT.

you mean this choice?

===========================================
1) pack
2) install to SD-Card
3) deb-package
4) upload
choice [1234]:

what does happen if you press 3? works in my test…have added usb-option and pushed, so that travis should build it…find it in github-releases

Till now I haven’t time to deal with it, but it seems me working. I’ve forgotten making a directory, that’s why couldn’t build a deb package. I go further with settings on page :

http://www.linuxfromscratch.org/blfs/view/svn/pst/cups.html” But cups unable to find it furthermore… I think I’ll install your deb package, and see what’s happening.

I get this output from bpi-r2 itself ( not in container ) :

"[ 7754.011653] usb 1-1: new high-speed USB device number 3 using xhci-mtk [ 7754.217940] usb-storage 1-1:1.2: USB Mass Storage device detected [ 7754.231448] scsi host0: usb-storage 1-1:1.2 [ 7755.274369] scsi 0:0:0:0: Direct-Access EPSON Storage 1.00 PQ: 0 ANSI: 2 [ 7755.293608] sd 0:0:0:0: Power-on or device reset occurred [ 7755.365858] sd 0:0:0:0: [sdb] Attached SCSI removable disk "

Maybe only card reader detected? Is it possible? I’ve installed your package, and kernel version’s changed to Linux bpi-r2 5.4.51-bpi-r2-main.

i guess you need to load usblp module

modprobe usblp

I’ve tried :

modprobe: FATAL: Module usblp not found in directory /lib/modules/5.4.51-bpi-r2-main

and no loaded usb modul founded with lsmod.

I’ve a debian 10 x86 vbox vm where I crosscompiled kernel. Lot of usb modules are loaded here, and cups can see attached usb device. I’m not sure, but maybe some other kernel moduls are missing from bpi-r2?

in 5.4-main (5.4.51) i have a

./drivers/usb/class/usblp.ko

it should be there also in the latest build…my local repo is sync with origin

Sorry Frank, it was my mistake! In your deb package there is usblp, and I can apply it with modprobe! But unfortunately the problem still exist. :frowning: , cups can’t recognize the usb printer.

On bpi-r2 :

root@bpi-r2:~$ lsmod | grep usb
usblp                  24576  0
root@bpi-r2:~$ ls -l /dev/bus/usb/003/003
crw-rw-r-- 1 root lp 189, 258 Jul 18 15:00 /dev/bus/usb/003/003

On X_86 Debian10 with kernel 4.19.0-9-amd64 :

root@debian-10-gui:~# lsmod |grep usb
usblp                  24576  0
usb_storage            73728  1 uas
usbhid                 57344  0
hid                   135168  2 usbhid,hid_generic
usbcore               294912  8 ohci_hcd,ehci_pci,usbhid,usblp,usb_storage,ehci_hcd,ohci_pci,uas
scsi_mod              249856  6 sd_mod,usb_storage,uas,libata,sg,sr_mod
usb_common             16384  1 usbcore

root@debian-10-gui:~# ls -l /dev/bus/usb/001/002
crw-rw-r--+ 1 root lp 189, 1 Jul 18 14:56 /dev/bus/usb/001/002

What’s your oppinion? Is something missing?

i guess there is something missing for cups…not kernel as you have the device mapped to lp-group

i made a quick test (but have no experience with cups itself)

Last login: Fri Jul 17 12:38:11 UTC 2020 on ttyS0                               
Linux bpi-r2 5.4.51-bpi-r2-main #104 SMP Wed Jul 15 19:56:27 CEST 2020 armv7l   
                                                                                
The programs included with the Debian GNU/Linux system are free software;       
the exact distribution terms for each program are described in the              
individual files in /usr/share/doc/*/copyright.                                 
                                                                                
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent               
permitted by applicable law.                                                    
root@bpi-r2:~#                                            
[   42.887845] usb 1-1: new high-speed USB device number 2 using xhci-mtk       
[   43.293976] usblp 1-1:1.1: usblp0: USB Bidirectional printer dev 2 if 1 alt A
[   43.304099] usbcore: registered new interface driver usblp
root@bpi-r2:~# ls /dev/usb/lp0                                                  
/dev/usb/lp0

For me it differs a little :

[72598.866846] usb 3-1: new high-speed USB device number 3 using xhci-mtk
[72599.082586] usblp 3-1:1.1: usblp0: USB Bidirectional printer dev 3 if 1 alt 0 proto 2 vid 0x04B8 pid 0x0881
[72599.105694] usb-storage 3-1:1.2: USB Mass Storage device detected
[72599.128544] scsi host2: usb-storage 3-1:1.2

looks like your printer creates also an mass-storage-device, but you need the lp0 device which should be there too

If i know how i can configure my printer the fast way i can try it…

Yes Frank, you have right, as always! :slight_smile:

I have also /dev/usb/lp0 device.

I thought it has been solved, but it’s not! :frowning: For a minute I’m sure I saw my printer and could install it!

I saw a previously to x86 attached printer, and not usb attached one!

I see this in your output, but not in mine! There is no usbcore modul loaded in my kernel! If I load it with modprobe usbcore, nothing happens! lsmod doesn’t show it!

I did only a bootup without modprobe and then connecting the printer…maybe it is only a message because the module was loaded by usb-core

I guess you can ignore this if you have the /dev/usb/lp0

Yes, I have /dev/usb/lp0, but doesn’t want to work with cups! What you adviced me before on linuxfromscratch, I saw this configuration :

Device Drivers  --->
  [*] USB support  --->                          [CONFIG_USB_SUPPORT]
    <*/M>  OHCI HCD (USB 1.1) support            [CONFIG_USB_OHCI_HCD]
    <*/M>  UHCI HCD (most Intel and VIA) support [CONFIG_USB_UHCI_HCD]
    <*/M>  USB Printer support                   [CONFIG_USB_PRINTER]

But in my kernel it shows :

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

Maybe ohci and uhci should be compiled too?

Ohci and uhci is protocol support for usb1.1 and usb2. You could try to add them

have added them locally and uploaded deb on my gdrive: https://drive.google.com/drive/folders/1WnmFOaHjXp8oSYinGaL7khKlA4l21Dmc?usp=sharing

You are still outside of lxc-container with cups?

How do you test with cups if printer is recognized?

https://wiki.ubuntu.com/DebuggingPrintingProblems

Seems to be lpinfo -v

root@bpi-r2:~# lpinfo -v
network beh
file cups-brf:/
network http
network lpd
network socket
network ipps
network ipp
network https
serial serial:/dev/ttyS0?baud=115200
serial serial:/dev/ttyS1?baud=115200
[  694.386962] usblp0: removed
serial serial:/dev/ttyS2?baud=11[  694.396177] usblp 1-1:1.1: usblp0: USB Bidirectional printer dev 2 if 1 alt 0 p
roto 2 vid 0x03F0 pid 0x3B2A
5200
direct usb://HP/Color%20LaserJet%20MFP%20M277dw?serial=VNB8H4H0YY&interface=1
network socket://192.168.0.200

so i guess cups see my printer…ohci/ehci are not loaded…only usblp

after i installed hplip, i can “install” the printer (if i made this right):

/usr/sbin/lpadmin -p HP_M277dw -E -v hp:/usb/HP_Color_LaserJet_MFP_M277dw?serial=VNB8H4H0YY

i see this printer then with “hpinfo -i”, but this is HP specific