<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi all,<br><br>I'm working on a project that involves generating a bunch of live images, and I'd love to be able to use LXC to customize the filesystems.<br><br></div>I hacked something together using schroot, but I'd like to migrate it over to unprivileged LXC containers so that the build is cleaner and needs fewer root permissions.<br><br>In my intended build flow, I'd like to be able to do the following:<br></div>1. Mount the baseline .img file as a loop mount (happens with passwordless sudo)<br></div>2. Use bindfs to remount the loop with user-level permissions (passwordless sudo)<br></div>3. Create an unprivileged LXC container using the mounted directory as the rootdir.<br></div>4. Run whatever upgrades/changes are needed inside of the LXC container.<br><br></div>I've been trying to get this work, but I can't get LXC to create a working unprivileged container from an existing directory. Note that I _can_ use unprivileged containers in a general sense - downloaded LXC images work great.<br><br></div>I'm able to reproduce the problem without any bind-mounts or anything like that - basically, I can reproduce my problem with this set of commands:<br><br>    $ lxc-create --name=fedora-base --template=download --dir=fedora-base<br>    $ cp -a fedora-base fedora-custom<br>    $ lxc-create --name=fedora-custom --template=none --dir=fedora-custom<br>    $ lxc-start --name=fedora-custom -F<br><br></div>Everything works great until I try to start the 'fedora-custom' container, which then craps out with the following messages:<br><br>    lxc-start: utils.c: safe_mount: 1742 Permission denied - Failed to mount /dev/null onto /dev/null<br>    lxc-start: conf.c: fill_autodev: 1182 Permission denied - Failed bind mounting device null from host into container<br>    lxc-start: conf.c: lxc_setup: 3783 failed to populate /dev in the container<br>    lxc-start: start.c: do_start: 834 failed to setup the container<br>    lxc-start: sync.c: __sync_wait: 57 An error occurred in another process (expected sequence number 3)<br>    lxc-start: start.c: __lxc_start: 1354 failed to spawn 'fedora-custom'<br>    lxc-start: tools/lxc_start.c: main: 344 The container failed to start.<br>    lxc-start: tools/lxc_start.c: main: 348 Additional information can be obtained by setting the --logfile and --logpriority options.<br><br></div>Can anybody help shed some light on what's going on? I know that I'm doing _something_ wrong, but I don't have any idea what :(<br><br></div>-Nick<br></div>