[SOLVED] LXC CIFS: unmount not working - block devices are not permitted on filesystem

TheHellSite

Active Member
Mar 4, 2020
78
53
38
I am facing a strange problem with my Arch Linux LXC running Jellyfin.

I mounted my media shares in the LXC which is working fine.
However, during every reboot, poweroff or stop of the LXC I need to kill the pve-process of the whole container because it simply won't shutdown.

At first I thought it was because I was mounting the shares using /etc/fstab instead of a systemd unit. But switching it over to a systemd unit didn't help.
After that I thought it was because Jellyfin is stopped after the system is trying to unmount my CIFS shares, but the syslog is showing the opposite (right) behaviour.

mount media systemd unit
Code:
/etc/systemd/system/mnt-media.mount
===================================
[Unit]
Description=Mount media share r/w at boot.
After=mnt-media.mount nss-lookup.target
BindsTo=mnt-media.mount

[Mount]
What=//NAS/nas/Media
Where=/mnt/media
Type=cifs
Options=_netdev,noatime,uid=jellyfin,gid=jellyfin,user=rw_smb_user,pass=x,iocharset=utf8
ForceUnmount=true
TimeoutSec=30

[Install]
WantedBy=multi-user.target

relevant syslog
Code:
        Dec 03 12:46:58 JELLY-LXC systemd[1]: Unmounting Mount media share r/o at boot....
Dec 03 12:46:58 JELLY-LXC systemd[1]: Stopping Record System Boot/Shutdown in UTMP...
        Dec 03 12:46:58 JELLY-LXC umount[127]: umount: /mnt/media: block devices are not permitted on filesystem.
        Dec 03 12:46:58 JELLY-LXC systemd[1]: mnt-media.mount: Mount process exited, code=exited, status=32/n/a
        Dec 03 12:46:58 JELLY-LXC systemd[1]: Failed unmounting Mount media share r/w at boot..
 

Attachments

  • entire_syslog.txt
    30 KB · Views: 2
Last edited:
How did you configure your LXC? For unprivileged LXCs mounting NFS/SMB inside the LXC shouldn't work by default. For privileged LXCs that should work if you enable the NFS/CIFS feature but then you get problems with systemd because the newer linuxes need nesting to be able to access /dev and /proc and that isn't recommended because privileged LXCs are so insecure.
 
The LXC is configured like this: priviliged=1,nesting=1,cifs=1
The CIFS share is working great within the LXC and doesn't create any problems whatsoever, apart from the reboot/shutdown issue.

Are priviliged LXCs really THAT unsafe?
The reason I went with an priviliged LXC instead of an unpriv. LXC (mapping the CIFS share from the PVE host to the LXC guest using bind mounts) is because I want to keep my PVE instance as stock as possible without manually altering too many config files.

Even though it might be unsafe shouldn't it still work without that strange bug I am facing?
 
Last edited:
Privileged LXCs are so unsafe because there so no user remapping. Your LXCs root used is the same root of your complete host. So if something gets wrong inside that LXC there is not much isolation. And with nesting you allow your LXC to access your /proc and /dev so the root user of the LXC may format all the disks in your server and stuff like that.
 
Last edited:
Jup, thats the way I'm doing it with my Docker LXCs. Just a bit annoying because the guest is relying on a specific config of the host in order to be able to started. So just setting up a fresh PVE host and restoring guests from backups isn't working.
 
This is why I was refusing to use unpriv. LXCs. I even tried the bind mounts before and it worked.

And since the changes are only necessary on the host and not in the LXC I think it would be nice to have this as a feature available in the web GUI.
This would make it a lot easier... I will open a feature request.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!