Public bug reported:

I'm doing something like this in my lxc config:

config:
  raw.idmap: both 1000 1000
devices:
  foo:
    path: /home/ubuntu/foo
    source: /home/<user>/foo
    type: disk

This is to make /home/ubuntu/foo map to my host's /home/<user>/foo.

However, if I do this before starting the container for the first time,
then /home/ubuntu inside the container ends up owned by root. The ubuntu
user cannot write to it, which causes various problems.

Presumably this is because at the time that cloud-init attempts to
create the ubuntu user, /home/ubuntu already exists, so it leaves it
alone. But this breaks my use case.

I wonder if there's a way that cloud-init could detect and accomodate
this situation?

Workaround: I can fix this with:
  runcmd:
    - chown ubuntu. /home/ubuntu

Using a 16.04 host, lxd 2.0.8-0ubuntu1~ubuntu16.04.2, and a Xenial guest
with cloud-init 0.7.8-49-g9e904bb-0ubuntu1~16.04.4.

** Affects: cloud-init (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1665943

Title:
  Home directory has wrong ownership if created by lxd in arranging a
  mount first

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1665943/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to