Unprivileged LXC Mounting Inconsistencies (mount point pass-through)

GeekyOnion

Active Member
Apr 17, 2020
2
0
41
47
Hi folks! I'm struggling with some strange behavior where I'm attempting to mount some host file systems in the unprivileged guest containers. The reason why it's strange is because it's wildly inconsistent, even in the same guest.

I've found several guides (One, Two) that follow the same set of recommended action, and I've followed it consistently. What's happening is, however, some zfs data sets are correctly being mapped in the guest, and others aren't. Even on the same container, I can swap between two different mounted host data sets, with exactly the same permissions applied, and one maps, but the other doesn't. In the examples below, I show how the same permission configuration works on one dataset (doom-wiki) and maps to "nobody:nogroup" on another dataset, both configured exactly the same on the host, and the guest.

Setting the permissions:
chown -R media:media-share /path/to/dataset
Ensuring that the groups and users on the guest will have good permissions:
chmod -R 770 /path/to/dataset
On each guest container:
groupadd -g 10000 media-share
useradd <containername> -u 1000 -g 10000 -m -s /bin/bash

On host:
pct set <container id> -mp0 /path/to/host/dataset/,mp=/mnt/dataset/
pct set <container id> -mp1 /path/to/host/dataset2/,mp=/mnt/dataset2/

Output of ls -al /doom-pool/doom-data/ on host:
1761932960584.png

Output of ls -al /mnt on guest (/mnt/):
1761933068755.png

Output of ls -al /mnt/doom-wiki on guest (/mnt/doom-wiki):
1761933282610.png

Output of ls -al /mnt/doom-usenet on guest (/mnt/doom-usenet):
1761933347253.png

Can anyone help explain the behavior, or recommend troubleshooting?

(I've validated using stat -c '%u %g' /mnt/dataset (in the various iterations) that the groups and users are showing up correctly in their respective ranges on the host and guest. I'm very confident it's not an inconsistent application of perms.)