[Lxc-users] problem opening usb device in container

kirimaks kirimaks at dagotel.ru
Tue Sep 11 06:52:09 UTC 2012


On 09/10/2012 02:17 PM, kirimaks wrote:
> Hello, all
>
>
> I have a problem accessing my usb SMARGO smart reader from container. 
> Accessing it from the host system is all  fine.
> The access is done through libusb-1.0.9 and the OS is gentoo.
>
>
> I managed to trace the problem down to the open() system call in 
> libusb which opens the device in question. It returns -1 in container
> and sets errno to 1 (EPERM). I got stuck  here because 'man open' does 
> not provide any clues (at least for me).  It  says:
>
> ...
> EPERM  The O_NOATIME flag was specified, but the effective user ID of 
> the caller did not match the owner of the file and the caller was not 
> privileged (CAP_FOWNER).
> ...
>
> and the system call is:
>
> ...
> hpriv->fd = open(filename, O_RDWR);
> ...
>
>
> The device can be seen under container (/dev/bus/usb/005/002) :
>
> oscam oscam-svn # ls -l /dev/bus/usb/005/
> total 0
> crw-rw-r-- 1 root usb 189, 512 Sep 10 09:54 001
> crw-rw-r-- 1 root usb 189, 513 Sep 10 12:21 002
> oscam oscam-svn # lsusb
> Bus 005 Device 002: ID 0403:6001 Future Technology Devices 
> International, Ltd FT232 USB-Serial (UART) IC
> Bus 008 Device 002: ID 046e:5577 Behavior Tech. Computer Corp.
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 003 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 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
> Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>
>
> Log from oscam (insignificant,  since the problem is somewhere between 
> libusb and underlying container):
>
>  libusb_open unknown error : -1
> 2012/09/10 13:29:06  904EB18 r Smartreader device 005:002 not found
> 2012/09/10 13:29:06  904EB18 r card [smartreader] Cannot open device: 
> 005:002
> 2012/09/10 13:30:06  904EB18 r card [smartreader] Using 0x82 as 
> endpoint for smartreader hardware detection
> 2012/09/10 13:30:06  904EB18 r coulnd't open device 005:002
>
>
> Container configuration in host OS:
>
> lxc.arch = i686
> lxc.utsname = oscam
> lxc.network.type = veth
> lxc.network.flags = up
> lxc.network.link = br0
> lxc.rootfs = /var/containers/oscam/oscam
> lxc.tty = 1
> lxc.pts= 128
> lxc.cap.drop = sys_module mknod mac_override sys_boot
> lxc.cgroup.devices.deny = a
> lxc.cgroup.devices.allow = c 1:3 rw
> lxc.cgroup.devices.allow = c 1:5 rw
> lxc.cgroup.devices.allow = c 1:9 rw
> lxc.cgroup.devices.allow = c 1:8 r
> lxc.cgroup.devices.allow = c 136:* rw
> lxc.cgroup.devices.allow = c 5:2 rw
> lxc.cgroup.devices.allow = c 4:1 rwm
> lxc.cgroup.devices.allow = c 4:0 rwm
> lxc.cgroup.devices.allow = c 5:0 rwm
> lxc.cgroup.devices.allow = c 5:1 rwm
> lxc.cgroup.devices.allow = c 10:200 rwm
>
> Once again, everything works just fine in host OS.
>
> What am I missing?
>
>
> Regards,
>
> Kirimaks
>





More information about the lxc-users mailing list