[systemd-devel] How to grant systemd-nspawn access to USB device?

Kevin P petrilli.kevin at gmail.com
Wed Mar 9 15:08:44 UTC 2022


Hello Greg and thanks for answering :)
I never used strace, so I couldn't figure from the output, but further
research led me to this post:
http://www.pclinuxos.com/forum/index.php?topic=135714.0
So I just tried (on the host):
chmod o+rw /dev/bus/usb/001/005
And it is now working. I was not expecting this to be the solution.

Thank you!
Kevin P.


Il giorno mer 9 mar 2022 alle ore 15:50 Greg KH <gregkh at linuxfoundation.org>
ha scritto:

> On Wed, Mar 09, 2022 at 03:04:00PM +0100, Kevin P wrote:
> > Good evening everyone.
> > I would like a nspawn container on my Raspberry Pi (Raspbian, systemd
> 247)
> > to access a RTL2838 DVB-T USB stick.
> > Inside the container, dump1090 will run and feed aircraft data (piaware
> and
> > adsbexchange projects).
> >
> > lsusb gives:
> > Bus 001 Device 005: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838
> DVB-T
> >
> > file /dev/bus/usb/001/005 returns:
> > /dev/bus/usb/001/005: character special (189/4)
> >
> > And finally grep 189 /proc/devices shows:
> > 189 usb_device
> >
> > I edited both the .nspawn file and the .service file, of which I'm
> > reporting the relevant parts below.
> > /etc/systemd/nspawn/ads-b.nspawn
> > [Files]
> > Bind=/dev/bus/usb/001/005
> >
> > systemd-nspawn at ads-b.service
> > [Service]
> > DeviceAllow=/dev/bus/usb/001/005 rwm
> > DeviceAllow=usb_device rwm
> >
> > However I feel like I am doing something wrong, as starting dump1090 from
> > within the container returns permission denied.
> > I'll gladly take any advice :)
>
> Odds are the program wants to access the device node for the driver, not
> the "raw" USB device /dev/bus/usb/*, right?
>
> What does strace show is failing exactly when you run the program?
>
> thanks,
>
> greg k-h
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220309/8ac9bccd/attachment.htm>


More information about the systemd-devel mailing list