[PVE-User] Share an usb device with a forced dev entry between proxmox and lxc

Guillaume proxmox at shadowprojects.org
Mon Jan 16 15:58:44 CET 2017


I found the issue.

On the container, dev elements aren't created by lxc and if you create 
them by hand, they will disappear after a reboot.

So, i create them at each boot using /etc/rc.local (in the container) :

mknod -m 666 /dev/ttyUSB0 c 188 0
mknod -m 666 /dev/ttyUSB1 c 188 1
mknod -m 666 /dev/ttyUSB2 c 188 2
mknod -m 666 /dev/usbsms0 c 188 0
mknod -m 666 /dev/usbsms1 c 188 1
chown root:dialout /dev/ttyUSB* /dev/usbsms*

And i keep the lxc.cgroup.devices.allow and lxc.mount.entry lines in my 
container configuration file.


Le 16/01/2017 à 15:40, Guillaume a écrit :
> Starting the container in debug mode gives me this :
>
>       lxc-start 20170116153758.481 WARN     lxc_conf - 
> conf.c:mount_entry_on_absolute_rootfs:1864 - ignoring mount point 
> '/dev/ttyUSB0'
>       lxc-start 20170116153758.481 WARN     lxc_conf - 
> conf.c:mount_entry_on_absolute_rootfs:1864 - ignoring mount point 
> '/dev/ttyUSB1'
>       lxc-start 20170116153758.481 WARN     lxc_conf - 
> conf.c:mount_entry_on_absolute_rootfs:1864 - ignoring mount point 
> '/dev/ttyUSB2'
>       lxc-start 20170116153758.482 WARN     lxc_conf - 
> conf.c:mount_entry_on_absolute_rootfs:1864 - ignoring mount point 
> '/dev/usbsms0'
>       lxc-start 20170116153758.482 WARN     lxc_conf - 
> conf.c:mount_entry_on_absolute_rootfs:1864 - ignoring mount point 
> '/dev/usbsms1'
>
> What does this mean ?
>
> Le 12/01/2017 à 13:01, Guillaume a écrit :
>> Hello,
>> I'm trying to share an usb 4g key between a proxmox 4.server and a 
>> lxc container.
>>
>> Device is as follow on the server :
>> Bus 001 Device 037: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 
>> HSDPA Modem / E230/E270/E870 HSDPA/HSUPA Modem
>>
>> I created this udev rule on the server to have a fixed endpoint in 
>> /dev :
>> /etc/udev/rules.d/10-usbsms.rules
>> ACTION=="add", KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="12d1", 
>> ATTRS{idProduct}=="1003", GROUP="dialout", MODE="0666", 
>> SYMLINK+="usbsms%n"
>>
>> Result in /dev :
>> crw-rw-rw-  1 root dialout 188,   0 Jan 12 12:40 ttyUSB0
>> crw-rw-rw-  1 root dialout 188,   1 Jan 12 12:40 ttyUSB1
>> crw-rw-rw-  1 root dialout 188,   2 Jan 12 11:17 ttyUSB2
>> ...
>> drwxr-xr-x  2 root root          60 Dec 20 10:47 usb
>> lrwxrwxrwx  1 root dialout        7 Jan 12 12:40 usbsms0 -> ttyUSB0
>> lrwxrwxrwx  1 root dialout        7 Jan 12 12:40 usbsms1 -> ttyUSB1
>>
>> On my container configuration file, i mount the device :
>> lxc.aa_profile: unconfined
>> lxc.cgroup.devices.allow: c 188:* rwm
>> lxc.cgroup.devices.allow: c 189:* rwm
>> lxc.mount.entry: /dev/bus/usb/001 dev/bus/usb/001 none 
>> bind,optional,create=dir
>> lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file
>> lxc.mount.entry: /dev/ttyUSB1 dev/ttyUSB1 none bind,optional,create=file
>> lxc.mount.entry: /dev/ttyUSB2 dev/ttyUSB2 none bind,optional,create=file
>> lxc.mount.entry: /dev/usbsms0 /dev/usbsms0 none 
>> bind,optional,create=file
>> lxc.mount.entry: /dev/usbsms1 /dev/usbsms1 none 
>> bind,optional,create=file
>>
>> Here's the result on my container :
>> ~# lsusb
>> Bus 006 Device 002: ID 03f0:1027 Hewlett-Packard Virtual keyboard and 
>> mouse
>> Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>> Bus 001 Device 037: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 
>> HSDPA Modem / E230/E270/E870 HSDPA/HSUPA Modem
>> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>> Bus 005 Device 006: ID 0c45:7401 Microdia TEMPer Temperature Sensor
>> Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>> Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>> Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>> Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>>
>> ~# ll /dev
>> total 4
>> drwxr-xr-x  8 root root       560 Jan 12 12:54 ./
>> drwxr-xr-x 22 root root      4096 Jan 12 12:54 ../
>> ...
>> crw-rw-rw-  1 root dialout 188, 0 Jan 12 12:40 ttyUSB0
>> crw-rw-rw-  1 root dialout 188, 1 Jan 12 12:40 ttyUSB1
>> crw-rw-rw-  1 root dialout 188, 2 Jan 12 11:17 ttyUSB2
>> ...
>>
>> No /dev/usbsms* entries.
>>
>> And if i try to create a udev rules on the container side instead :
>> SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", 
>> GROUP="dialout", MODE="0666", SYMLINK+="usbsms%n"
>>
>> I got nothing either in /dev
>>
>> Any hint ?
>> Thanks,
>>
>
> _______________________________________________
> pve-user mailing list
> pve-user at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-user




More information about the pve-user mailing list