[systemd-devel] How to grant systemd-nspawn access to USB device?
Greg KH
gregkh at linuxfoundation.org
Wed Mar 9 14:50:04 UTC 2022
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
More information about the systemd-devel
mailing list