lxc.cgroup.devices.allow = c 189:* rwm lxc.mount.entry = /dev/bus/usb/003 dev/bus/usb/003 none bind,optional,create=dir lxc.mount.entry = /dev/usb/lp0 dev/usb/lp0 none bind,optional,create=file
root@aspire-5520g:~# lsusb Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 004: ID 0bda:8197 Realtek Semiconductor Corp. RTL8187B Wireless Adapter Bus 001 Device 003: ID 5986:0102 Acer, Inc Crystal Eye Webcam Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 002: ID 03f0:0517 Hewlett-Packard LaserJet 1000 Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
root@aspire-5520g:~# ls -l /dev/bus/usb/003/002 crw-rw-r-- 1 root lp 189, 257 15 16:02 /dev/bus/usb/003/002
root@aspire-5520g:~# cat /etc/group | egrep lp lp:x:7:
root@aspire-5520g:~# ls -l /dev/usb/lp0 crw-rw---- 1 root lp 180, 0 15 16:02 /dev/usb/lp0
/etc/udev/rules.d/10-printer.rules
file: /etc/udev/rules.d/10-printer.rules
following content: SUBSYSTEM=="usb", ATTR{manufacturer}=="Hewlett-Packard", ATTR{product}=="hp LaserJet 1000", SYMLINK+="lj1000" KERNEL=="lp[0-9]", SUBSYSTEM=="usbmisc", SYMLINK+="%k"
Remember that udev does not support line wrapping in any form. Do not break the lines in your rules, as udev interprets your one rule as several rules, and will not work as expected.(For more detailed information on writing udev rules, I recommend referring here or to the original here )
lj1000
and lp0
, which are necessary for further correct transfer of the printer to the container and its normal operation regardless of the connection bus on the host system. root@aspire-5520g:~# lxc config device add print lj1000 unix-char path=/dev/bus/usb/003/002 mode=0664 gid=7 lj1000 print root@aspire-5520g:~# lxc config device add print lp0 unix-char path=/dev/usb/lp0 gid=7 lp0 print
root@aspire-5520g:~# lxc config device add print lj1000 unix-char path=/dev/lj1000 mode=0664 gid=7 lj1000 print root@aspire-5520g:~# lxc config device add print lp0 unix-char path=/dev/lp0 gid=7 lp0 print
root@aspire-5520g:~# lxc exec print -- apt update && apt upgrade -y && apt install hplip -y root@aspire-5520g:~# lxc exec print -- hp-setup -i
Source: https://habr.com/ru/post/306074/
All Articles