[lxc-users] Unable to mount local dir

Paweł A. Gajda mis at pld-linux.org
Mon Sep 26 10:38:41 UTC 2016


I've added local dir (lxc config device add) to running (unprvileged,
default profile) containter and it just works, but after container stop, it
cannot start again with "Permission denied - Failed to mount". Any fix?

$ lxc start pld
 lxc 20160926115846.879 ERROR lxc_utils - utils.c:safe_mount:1692 -
Permission denied - Failed to mount /var/lib/lxd/devices/pld/disk.var-host
onto /usr/lib64/lxc/rootfs/var/host
  lxc 20160926115846.879 ERROR lxc_conf - conf.c:mount_entry:1650 -
Permission denied - failed to mount '/ ' on '/usr/lib64/lxc/rootfs/var/host'
  lxc 20160926115846.879 ERROR lxc_conf - conf.c:lxc_setup:3742 - failed to
setup the mount entries for 'pld'
  lxc 20160926115846.879 ERROR lxc_start - start.c:do_start:834 - failed to
setup the container

Local dir exists and has been mounted by lxd under /var/lib/lxd:
$ ls -ld /var/lib/lxd/devices/pld/disk.var-host
drwxr-xr-x 2 root root 4096 Sep 26 09:57
/var/lib/lxd/devices/pld/disk.var-host

$ mount | grep 'var/lib'
/dev/sdb on /var/lib/lxd type ext4 (rw,relatime,data=ordered)
/dev/sdb on /var/lib/lxd/shmounts type ext4 (rw,relatime,data=ordered)
/dev/sda on /var/lib/lxd/devices/pld/disk.var-host type ext4
(rw,relatime,data=ordered)


Container config:
$ lxc config show pld
name: pld
profiles:
- default
config:
  volatile.base_image:
95847b2a6d2b14caf4ce8147f8848e361eb04f6fa860502e9f78e275dd14e8d5
  volatile.eth0.hwaddr: 00:16:3e:44:85:f0
  volatile.last_state.idmap:
'[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":100000},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":100000}]'
devices:
  hostshare:
    path: /var/host
    source: /var/covar/pld
    type: disk
  root:
    path: /
    type: disk
ephemeral: false

And lxc info:
$ lxc info
environment:
  addresses: []
  architectures:
  - x86_64
  - i686
driver: lxc
driverversion: 2.0.4
kernel: Linux
kernelarchitecture: x86_64
kernelversion: 4.4.19-1
server: lxd
serverversion: "2.2"
storage: dir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20160926/127bcdcc/attachment.html>


More information about the lxc-users mailing list