You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! 👋 I am trying to understand this problem related to user namespace capabilities (I think): it seems it isn't related specifically with any OCI spec high-level container runtime, but with namespaces in general. I was wondering why I can't access the device-node/device-file of the Device Mapper under /dev/mapper/control, when calling kpartx -a to add all mappings. I am using unshare with the "-r" flag to map the root user, with a mount-namespace propagation=slave, then I create a nested mount-namespace with propagation=private. In both I am creating a new user namespace, which is the one that have capabilities tied to. I know there is also filesystem permissions to be considered, but does anyone here have any tips to how to solve this?
by starting the first namespace unshare by using sudo, my understanding is that it will propagate to the child namespaces. (I think this term, propagate, is related only to mount, but I am also assuming it for the user namespaces.)
sh-5.2# kpartx -a ./artifacts/foo.qcow2
device-mapper: version ioctl on failed: Permission denied
Incompatible libdevmapper 1.02.198 (2024-05-16) and kernel driver (unknown version).
device mapper prerequisites not met
sh-5.2#
While using Rootless, it returns:
sh-5.2# kpartx ./artifacts/foo.qcow2
/dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
Check that device-mapper is available in the kernel.
Incompatible libdevmapper 1.02.198 (2024-05-16) and kernel driver (unknown version).
mount: could not find any device /dev/loop#
can't set up loopsh-5.2#sh-5.2#
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi! 👋 I am trying to understand this problem related to user namespace capabilities (I think): it seems it isn't related specifically with any OCI spec high-level container runtime, but with namespaces in general. I was wondering why I can't access the device-node/device-file of the Device Mapper under /dev/mapper/control, when calling
kpartx -a
to add all mappings. I am using unshare with the "-r" flag to map the root user, with a mount-namespace propagation=slave, then I create a nested mount-namespace with propagation=private. In both I am creating a new user namespace, which is the one that have capabilities tied to. I know there is also filesystem permissions to be considered, but does anyone here have any tips to how to solve this?Running unshare with Rootfull privileges
; sudo unshare -r --user --mount --propagation=slave --uts --ipc --net --fork --pid --mount-proc /bin/sh
Running unshare with Rootless privileges:
; unshare -r --user --mount --propagation=slave --uts --ipc --net --fork --pid --mount-proc /bin/sh
Then, printing capabilities and id to get the real and effective user group:
Related to filesystem permissions, I also observed that:
Rootless can touch this:
; unshare -r --user --mount --propagation=shared --uts --ipc --net --fork --pid --mount-proc /bin/sh sh-5.2# sh-5.2# sh-5.2# touch hmmm.txt
...but Rootfull can't touch this. Also, since the parent namespace uses sudo, the capability holds.
by starting the first namespace unshare by using sudo, my understanding is that it will propagate to the child namespaces. (I think this term, propagate, is related only to mount, but I am also assuming it for the user namespaces.)
While using Rootless, it returns:
Beta Was this translation helpful? Give feedback.
All reactions