I am trying to mount a samba share on a debian 12 (6.1.0-16-amd64) host inside a Ubuntu 22.04 Container.
dpkg -l | grep lxd
ii lxd 5.0.2-5 amd64 Powerful system container and virtual machine manager - daemon
ii lxd-agent 5.0.2-5 amd64 LXD guest agent
ii lxd-client 5.0.2-5 amd64 Powerful system container and virtual machine manager - client
I am following the guides that worked on older versions.
But with id shifting on newer kernels I am a bit lost. When I try to add the mounted smb share, I get the following error.
lxc config device add name lxdshare disk shift=true source=/mnt/path/ path=/mnt/test
Error: Failed to start device "lxdshare": Required idmapping abilities not available
I can add the device without the shift parameter. But then I don’t have write permissions.
Do I have to disable id shifting completely to make it work?
If you can add a disk device without shift, maybe try setting up idmap for container? For default ubuntu user with UID 1000 and GID 1000 that would be:
Are there any other options for mounting SMB/CIFS shares in an unprivileged container? I couldn’t get smbnetfs to work, the project hasn’t been updated in many years, and the project has little documentation.
Yes, I did happen to watch this video before asking my question. The video doesn’t specify whether the container was privileged or unprivileged, though I suspect it was privileged. I tried unsuccessfully to mount an SMB/CIFS share in an unprivileged container:
derek@proxmox:~$ incus exec faithful-colt bash
root@faithful-colt:~# mount --types cifs --options defaults,credentials=/root/credentials.txt --verbose //192.168.0.2/Archive Mounts/Archive
mount.cifs kernel mount options: ip=192.168.0.2,unc=\\192.168.0.2\Archive,user=derek,domain=WORKGROUP,pass=********
mount error(1): Operation not permitted
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
In this similar video, Don Hui at Novaspirit Tech creates a privileged Proxmox container that connects to an SMB/CIFS share. I would really prefer not to create numerous privileged containers just so that they can connect to my NAS file system.