Mount a folder in host into lxd container, nogroup nobody in the container

Hi,

mounted a host folder as:

 lxc config device add fb15 drv1 disk source=/home/sqllyw/test1 path=/home/test1

but when inside the container, the /home/test1 has nogroup.nouser

.0K drwxrwxr-x  2 nobody   nogroup  4.0K Dec 11 05:12 test1

so can not create any file under the folder test1

the container info as follow:

cat /etc/subuid
sqllyw:100000:65536
root:100000:65536
root:1000:1

host:
cat /etc/subgid
root:100000:65536
root:1000:1

architecture: i686
config:
image.architecture: i686
image.description: Ubuntu 18.04 LTS server (20190212.1)
image.os: ubuntu
image.release: bionic
volatile.base_image: 0501fb365b4252ed85a3c3308316cff84c495755322f808588831041be45db61
volatile.eth0.host_name: vethc2fea242
volatile.eth0.hwaddr: 00:16:3e:74:0c:64
volatile.eth1.host_name: mac3b03d2b8
volatile.eth1.hwaddr: 00:16:3e:04:82:18
volatile.eth1.last_state.created: “false”
volatile.eth1.name: eth1
volatile.idmap.base: “0”
volatile.idmap.current: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000},{“Isuid”:false,“Isgid”:true,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000}]’
volatile.idmap.next: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000},{“Isuid”:false,“Isgid”:true,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000}]’
volatile.last_state.idmap: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000},{“Isuid”:false,“Isgid”:true,“Hostid”:1000000,“Nsid”:0,“Maprange”:1000000000}]’
volatile.last_state.power: RUNNING
devices:
drv1:
path: /home/test1
source: /home/sqllyw/test1
type: disk
drv2:
path: /home/test2
source: /home/sqllyw/test2
type: disk
eth1:
nictype: macvlan
parent: enp0s21
type: nic
ephemeral: false
profiles:

  • default
    stateful: false
    description: “”

found a fix:

sudo ls -lh /var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/default/containers/fb15/rootfs/

the user is 1000000.1000000

sudo chown -R 1000000.1000000 test1