User Namespace not working properly in ZFS
Description
Problem/Justification
Impact
Activity
Bug Clerk February 21, 2025 at 11:12 PM
This issue has now been closed. Comments made after this point may not be viewed by the TrueNAS Teams. Please open a new issue if you have found a problem or need to re-engage with the TrueNAS Engineering Teams.
Ameer Hamza February 21, 2025 at 11:12 PMEdited
Tested on both 25.04-BETA and the latest Gold Eye Nightlies but couldn’t reproduce the issue, uid
/gid
mapping for shared files appears to work correctly. One observation is that the ticket description indicates the idmapped
mount flag was set, but this wasn’t observed across multiple Incus config options I tested, including legacy shared zfs dataset. Closing this after discussing with @William Gryzbowski, as the issue also no longer seems reproducible in his environment. This might be tied to a specific Incus setup, but hard to confirm without a reproduction scenario.
William Gryzbowski February 20, 2025 at 4:57 PM
User namespace works on 24.10.1, to narrow it down further
William Gryzbowski February 20, 2025 at 4:47 PM
Same issue reproduce on 25.04-BETA.1, suspicious on regression from zfs 2.2.6 to 2.3.
William Gryzbowski February 20, 2025 at 4:07 PM
This was in 25.10.0-MASTER-20250218-005630
I will try 25.04-BETA.1 next
Within the container:
[root@test ~]# mount|grep /test tank/.ix-virt/containers/test on / type zfs (rw,relatime,idmapped,xattr,posixacl,casesensitive) tank/test on /test type zfs (rw,noatime,idmapped,xattr,posixacl,casesensitive) [root@test ~]# ls -ln /test/ total 4 -rw-r--r-- 1 0 0 0 Jan 27 17:08 bar drwxrwxrwx 2 0 0 3 Jan 27 16:49 dir -rw-r--r-- 1 1000 1000 0 Jan 27 17:08 foo -rw-r--r-- 1 1001 1001 0 Feb 20 14:07 foo2 -rw-r--r-- 1 1002 1002 0 Feb 20 14:08 foo3 -rw-r--r-- 1 0 0 0 Feb 20 14:08 test -rw-r--r-- 1 0 0 0 Feb 20 14:18 test2 [root@test ~]# stat /test/foo File: /test/foo Size: 0 Blocks: 1 IO Block: 512 regular empty file Device: 38h/56d Inode: 2 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/almalinux) Gid: ( 1000/almalinux) Access: 2025-01-27 17:08:11.662104297 +0000 Modify: 2025-01-27 17:08:11.662104297 +0000 Change: 2025-02-20 14:07:39.924641915 +0000 Birth: 2025-01-27 16:42:06.149876075 +0000 [root@test ~]# stat /test/foo2 File: /test/foo2 Size: 0 Blocks: 1 IO Block: 131072 regular empty file Device: 38h/56d Inode: 4 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1001/ UNKNOWN) Gid: ( 1001/ UNKNOWN) Access: 2025-02-20 14:07:25.300674319 +0000 Modify: 2025-02-20 14:07:25.300674319 +0000 Change: 2025-02-20 14:07:44.364632074 +0000 Birth: 2025-02-20 14:07:25.300674319 +0000
In the host (12733 is the container pid init):
2147000+ 12733 0.0 0.0 237868 7040 ? Ss 06:40 0:00 /sbin/init root@truenas[~]# cat /proc/12733/uid_map 0 2147000001 1000 1000 1000 1 1001 2147001002 457751 root@truenas[~]# ls -ln /mnt/tank/test total 4 -rw-r--r-- 1 0 0 0 Jan 27 09:08 bar drwxrwxrwx 2 0 0 3 Jan 27 08:49 dir -rw-r--r-- 1 1000 1000 0 Jan 27 09:08 foo -rw-r--r-- 1 1001 1001 0 Feb 20 06:07 foo2 -rw-r--r-- 1 1002 1002 0 Feb 20 06:08 foo3 -rw-r--r-- 1 0 0 0 Feb 20 06:08 test -rw-r--r-- 1 0 0 0 Feb 20 06:18 test2 root@truenas[~]# stat /mnt/tank/test/foo File: /mnt/tank/test/foo Size: 0 Blocks: 1 IO Block: 512 regular empty file Device: 0,56 Inode: 2 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ UNKNOWN) Gid: ( 1000/ UNKNOWN) Access: 2025-01-27 09:08:11.662104297 -0800 Modify: 2025-01-27 09:08:11.662104297 -0800 Change: 2025-02-20 06:07:39.924641915 -0800 Birth: 2025-01-27 08:42:06.149876075 -0800 root@truenas[~]# stat /mnt/tank/test/foo2 File: /mnt/tank/test/foo2 Size: 0 Blocks: 1 IO Block: 131072 regular empty file Device: 0,56 Inode: 4 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1001/ UNKNOWN) Gid: ( 1001/ UNKNOWN) Access: 2025-02-20 06:07:25.300674319 -0800 Modify: 2025-02-20 06:07:25.300674319 -0800 Change: 2025-02-20 06:07:44.364632074 -0800 Birth: 2025-02-20 06:07:25.300674319 -0800
Same/similar was done using ext4 and it seems to work as expected.