inconsistent ownerships with bind mounts in privileged containers

airplanez

New Member
Jul 5, 2023
2
0
1
So I am working with a privileged container to make things easier but still am running into a weird problem with incorrect folder ownership of bind mounted folders or their contents

Problems I'm seeing:
  1. Bind mounting some directories seems to work just fine
  2. Bind mounting parent directories of those that worked in #1 show the wrong ownerships and also empty directories
  3. Sometimes files/folders owned by host user (uid 1000) show up as owned by root in the container rather than their true UID/GID.


Container Config:
Code:
arch: amd64
cores: 8
hostname: test
memory: 4096
mp0: /mnt/tank/dataz,mp=/mnt/dataz
mp1: /mnt/tank/dataz/htpc/media/movies,mp=/mnt/plex/movies
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=82:94:AD:FC:38:FB,ip=dhcp,type=veth
ostype: debian
rootfs: nvme-zfs:subvol-110-disk-0,size=8G
swap: 512



Inside the container (mp0) [does NOT work]:

Code:
root@lxc:/mnt/dataz# ls -l
total 13
drwxr-xr-x 2 root root 2 Jan 25 08:57 appdata
drwxr-xr-x 2 root root 2 Jan 25 08:52 docs
drwxr-xr-x 2 root root 2 Jul  3 23:44 htpc
drwxr-xr-x 4 1000 1000 5 Jun 27 11:29 portableApps
drwxr-xr-x 7 1000 1000 8 Jun 28  2022 src
drwxr-xr-x 2 root root 3 Jul  5 07:15 tmp
drwxr-xr-x 2 root root 2 Jul 23  2020 vm
drwxr-xr-x 4 root root 4 Jun 24 08:49 vz



Inside the container (mp1) [works perfectly]:

Code:
root@lxc:/mnt/plex/movies# ls -l
total 313
drwxrwxrwx  8 1000 1000  19 Oct 31  2018  One
drwxrwxrwx  6 1000 1000  11 Oct 30  2018  Two
drwxrwxrwx  8 1000 1000  12 Oct 30  2018  Three
...


On the host:

Code:
root@pve:/mnt/tank/dataz# ls -l
total 85
drwxrwxr-x   3 user1000 user1000   3 Jun 27 00:54 appdata
drwxr-xr-x   4 user1000 user1000   7 Jun 22 20:30 docs
drwxrwxrwx   5 user1000 user1000   5 Jul  4 23:49 htpc
drwxr-xr-x   4 user1000 user1000   5 Jun 27 04:29 portableApps
drwxrwxr-x   4 user1000 user1000   4 Jun 30  2022 s3
drwxr-xr-x   7 user1000 user1000   8 Jun 28  2022 src
drwxr--r--+ 37 user1000 user1000 192 Jul  4 21:25 tmp
drwxrwxrwx   2 user1000 user1000   3 Jun 26 17:16 vm
drwxr-xr-x   5 user1000 user1000   5 Jun 24 01:29 vz
...

All of these folders were created as zfs datasets without any extra attributes so they should all inherit:

Code:
tank/dataz                          2.64T  20.7T     6.33G  /mnt/tank/dataz
tank/dataz/appdata                   112K  20.7T      112K  /mnt/tank/dataz/appdata
tank/dataz/docs                     83.0M  20.7T     83.0M  /mnt/tank/dataz/docs
tank/dataz/htpc                     1.71T  20.7T      112K  /mnt/tank/dataz/htpc
tank/dataz/htpc/media               1.71T  20.7T     39.4G  /mnt/tank/dataz/htpc/media
tank/dataz/htpc/media/movies         466G  20.7T      465G  /mnt/tank/dataz/htpc/media/movies
...


The container is privileged so everything from the host should be passing to the containers exactly as-is. What could possibly be happening here? Is there some sort of invisible UID/GID attribute getting set on the host? I've tried using getfacl to see if anything has been set on these objects but everything is the same.

I'm losing my mind. Would I need to set something like lxc.mount.entry for the container config? Even so, that wouldn't explain why certain subdirectories seem to mount just fine but others do not.


Has anyone ever run into this?
 
UPDATE 7/5/2023:
I discovered on some discussions that seem to be related to recursive zfs datasets. I am linking them as they may be useful to know in case someone else is hitting this:
Honestly seems like a straight up bug on the lxc side of things since recursive datasets are probably fairly common. Unfortunately,
I have not had any luck getting things to work. Hopefully someone has figured this out.
 

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!