I have a need to mount an encrypted external drive within a container.
LXD 4.0.5 LTS on Ubuntu 20.0.4 LTS installed using snap.
I’ve got through the luksOpen & AppArmor issues so the drive will decrypt, but now I can’t get the decrypted disk to mount. I’m getting permission denied against the target directory.
There are no apparmor or other issues showing in dmesg or journalctl, on either the container or host.
The mountpoint within the container was created inside the container. I’ve tried creating it in the host and mapping that as a disk device into the container, and I get the same result.
Is there a module I need to load or some other simple missing thing?
Would upgrading to the latest LXD fix this?
Thanks
David
in the container:
# /bin/mount --verbose /dev/mapper/disk
mount: /mnt/disk: permission denied.
# ls -l /mnt/
drwxr-xr-x 2 root root 4096 Mar 3 14:01 disk
# cat /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
/dev/mapper/disk /mnt/disk btrfs defaults,rw,noauto,nodev,noexec,nosuid,relatime 0 2
container config:
config:
security.idmap.isolated: "true"
security.privileged: "true"
linux.kernel_modules: dm_crypt,btrfs,dm_mod,cryptd,crypto_simd,dm_multipath,sha256,sha512,aes_ti,sha3_generic
raw.apparmor: |
mount fstype=btrfs options=(rw, nosuid, nodev, noexec, relatime) /mnt/*,
mount fstype=btrfs options=(rw, nosuid, nodev, noexec, relatime) /mnt/*/,
mount fstype=btrfs options=(rw, nosuid, nodev, noexec, relatime) /dev/mapper/disk,
mount fstype=btrfs options=(rw, nosuid, nodev, noexec, relatime) /dev/mapper/disk/,
mount fstype=btrfs options=(rw, nosuid, nodev, noexec, relatime) /dev/dm*,
p.s. this has too many lines as I’ve been adding extra things while I try and get it to work - I’ll prune once it’s working.
pps. I can decrypt & mount the disk on the host without trouble.