Mounting block devices inside of a container is a very very unsafe operation and is therefore blocked by the kernel for all unprivileged containers and usually blocked by AppArmor or similar in privileged containers.
Incus has some ways around that, in order of preference:
security.syscalls.intercept.mount=true
andsecurity.syscalls.intercept.mount.fuse=ext4=fuse2fs
. This option is safe and relies onfuse2fs
being present in the container, effectively redirecting unsafe mount calls to the userspace FUSE implementation.security.syscalls.intercept.mount=true
andsecurity.syscalls.intercept.mount.allowed=ext4
. This is unsafe but allows an unprivileged container to mount any ext4 filesystem with full root privileges without having to resort to a privileged container.security.privileged=true
. This is the least safe option as now the entire container is running with full root privileges.