How do I pass an optical drive into LXC container?

enigma_0z

New Member
Sep 29, 2025
1
0
1
Title says it all. I'm trying to put a (USB) Blu-Ray/DVD/CD drive on to an LXC container in my Proxmox VE. No matter what I do, it seems I can't mount it, and dmesg is exceptionally unhelpful. I can't really seem to locate even any logs which would indicate what the problem is.

1) Where might I go for some failure logs/analysis? The container says to check dmesg(1) but on an unprivileged container it can't open dmesg (duh) and on a privileged container, dmesg only says "/dev/sr0: Can't open blockdev"

2) What is the proper way to pass a block device into an LXC container; preferably unprivileged, but if one way works and the other doesn't I'll take that. This isn't a high-security environment, it's a home lab. Details follow.

Specifically, I am building a local web service which provides some means to rip discs directly to my media server via a direct attached drive. The tools which do the ripping need direct (low level) access to the block devices, not just for reading, but for operations like eject, load tray, etc. I've tried both the direct passthrough via the UI, ala:

Code:
dev0: /dev/sr0,gid=24 # Mountable block device
dev1: /dev/sg4,gid=24 # Raw "SCSI" device
dev2: /dev/bus/usb/002/002,mode=0664 # USB device associated with the drive

I've also tried a more esoteric configuration, which I got from here, like this:
Code:
lxc.cgroup2.devices.allow: c 189:129 rwm
lxc.cgroup2.devices.allow: c 11:0 rwm
lxc.cgroup2.devices.allow: c 21:4 rwm
lxc.mount.entry: /dev/sr0 dev/sr0 none bind,optional,create=file,gid=25,uid=0
lxc.mount.entry: /dev/sg4 dev/sg4 none bind,optional,create=file,gid=25,uid=0
lxc.mount.entry: /dev/bus/usb/002/002 dev/bus/usb/002/002 none bind,optional,create=file,uid=0,gid=0

With both options, /dev/sr0 shows up correctly but any time I try to mount it I get the following error:

Code:
$ sudo mount /dev/sr0 /mnt/sr0
mount: /mnt/sr0: permission denied.
       dmesg(1) may have more information after failed mount system call.
and dmesg just says

Code:
[3745122.476147] /dev/sr0: Can't open blockdev
 
With both options, /dev/sr0 shows up correctly but any time I try to mount it I get the following error:

$ sudo mount /dev/sr0 /mnt/sr0 mount: /mnt/sr0: permission denied. dmesg(1) may have more information after failed mount system call.
Mounting in an unprivileged container is not allowed.

There is however still a way to achieve what you want in an unprivileged container using FUSE:
  1. Enable the FUSE feature on the container. (Found under Options -> Features in the Web UI)
  2. Install fuseiso inside the container.
  3. Run fuseiso /dev/sr0 /mnt/sr0 to mount the optical disk.