Answer the question
In order to leave comments, you need to log in
How to forward a USB printer to an LXD container?
Before that, I used LXC containers on ubuntu 14.04, where I wrote printer forwarding in the configuration file in the form:
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
Answer the question
In order to leave comments, you need to log in
The final solution has been found!
It turned out to forward, install and force the HP LaserJet 1000 printer (win-printer) to print from the LXD container.
So, for the standard, we take the config from Ubuntu 14.04 on which everything worked and try to do the same, but in LXD.
To forward a USB printer to an LXD container (in my example I use an HP LaserJet 1000 printer, the container is pre-deployed based on Ubuntu 16.04 and is called "print"), you need to do the following:
To do this, on the host, enter lsusb
[email protected]:~# 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
[email protected]:~# lxc exec print -- bash
[email protected]:~# 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
[email protected]:~# ll /dev/bus/usb/003
итого 0
drwxr-xr-x 2 root root 80 Июл 14 21:00 ./
drwxr-xr-x 6 root root 120 Июл 14 21:00 ../
crw-rw-r-- 1 root root 189, 256 Июл 14 21:00 001
crw-rw-r-- 1 root lp 189, 257 Июл 15 10:56 002
[email protected]:~# cat /etc/group | egrep lp
lp:x:7:
[email protected]:~# lxc config device add print lj1000 unix-char path=/dev/bus/usb/003/002 mode=0664 gid=7
Device lj1000 added to print
[email protected]:~# lxc config device add print lp0 unix-char path=/dev/usb/lp0 gid=7
Device lp0 added to print
[email protected]:~# lxc config set print boot.autostart true
[email protected]:~# lxc config set print boot.autostart.delay 5
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question