Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 543674

Summary: app-emulation/lxc-1.1.1 unpriv download-gentoo template fails to delete /sys/fs/cgroup/*/<username>/<lxcname> on lxc-start without foreground mode
Product: Gentoo Linux Reporter: diamond
Component: Current packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED UPSTREAM    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description diamond 2015-03-18 06:37:09 UTC
I'm using https://wiki.gentoo.org/wiki/LXC#Configuring_unprivileged_LXC
I create cgroups manually (openrc there) using script as was shown in P.S. on the wiki page. So, I got under my user:

$ cat /proc/self/cgroup 
10:perf_event:/lxc
9:blkio:/lxc
8:net_cls:/lxc
7:freezer:/lxc
6:devices:/lxc
5:memory:/lxc
4:cpuacct:/lxc
3:cpu:/lxc
2:cpuset:/lxc
1:name=openrc:/lxc

$ grep lxc /etc/sub* 2>/dev/null   
/etc/subgid:lxc:100000:65537
/etc/subuid:lxc:100000:65537

$ lxc-create -t download -n alpha -f ~/.config/lxc/guest.conf -- --list
Setting up the GPG keyring
Downloading the image index

---
DIST    RELEASE ARCH    VARIANT BUILD
---
centos  6       amd64   default 20150318_02:16
centos  6       i386    default 20150318_02:16
debian  jessie  amd64   default 20150317_22:42                                                       
debian  jessie  armel   default 20150317_22:42                                                       
debian  jessie  armhf   default 20150317_22:42                                                       
debian  jessie  i386    default 20150317_22:42                                                       
debian  sid     amd64   default 20150317_22:42                                                       
debian  sid     armel   default 20150317_22:42                                                       
debian  sid     armhf   default 20150317_22:42                                                       
debian  sid     i386    default 20150317_22:42                                                       
debian  wheezy  amd64   default 20150317_22:42                                                       
debian  wheezy  armel   default 20150317_22:42                                                       
debian  wheezy  armhf   default 20150317_22:42                                                       
debian  wheezy  i386    default 20150317_22:42                                                       
gentoo  current amd64   default 20150316_14:12                                                       
gentoo  current armhf   default 20150317_14:12                                                       
gentoo  current i386    default 20150316_14:12                                                       
oracle  6.5     amd64   default 20150317_11:40                                                       
oracle  6.5     i386    default 20150317_11:40                                                       
plamo   5.x     amd64   default 20150317_21:36
plamo   5.x     i386    default 20150317_21:36
ubuntu  precise amd64   default 20150318_03:49
ubuntu  precise armel   default 20150318_03:49
ubuntu  precise armhf   default 20150318_03:49
ubuntu  precise i386    default 20150318_03:49
ubuntu  trusty  amd64   default 20150318_03:49
ubuntu  trusty  armhf   default 20150318_03:49
ubuntu  trusty  i386    default 20150318_03:49
ubuntu  trusty  ppc64el default 20150318_03:49
ubuntu  utopic  amd64   default 20150318_03:49
ubuntu  utopic  armhf   default 20150318_03:49
ubuntu  utopic  i386    default 20150318_03:49
ubuntu  utopic  ppc64el default 20150318_03:49
ubuntu  vivid   amd64   default 20150318_03:49
ubuntu  vivid   armhf   default 20150316_03:49
ubuntu  vivid   i386    default 20150318_03:49
ubuntu  vivid   ppc64el default 20150318_03:49
---
lxc_container: lxccontainer.c: create_run_template: 1102 container creation template for alpha failed
lxc_container: lxc_create.c: main: 274 Error creating container alpha

$ lxc-create -t download -n alpha -f ~/.config/lxc/guest.conf -- -d gentoo -r current -a amd64
Setting up the GPG keyring
Downloading the image index
Downloading the rootfs
Downloading the metadata
The image cache is now ready
Unpacking the rootfs

---
You just created a Gentoo container (release=current, arch=amd64, variant=default)

To enable sshd, run: rc-update add sshd

For security reason, container images ship without user accounts
and without a root password.

Use lxc-attach or chroot directly into the rootfs to set a root password
or create user accounts.

$ lxc-start -n alpha -- /bin/bash
lxc-start: lxc_start.c: main: 344 The container failed to start.
lxc-start: lxc_start.c: main: 346 To get more details, run the container in foreground mode.
lxc-start: lxc_start.c: main: 348 Additional information can be obtained by setting the --logfile and --logpriority options.

I got the following inside ~/.local/share/lxc/alpha/alpha.log

      lxc-start 1426657776.507 ERROR    lxc_start - start.c:start:1235 - No such file or directory - 
failed to exec r/.local/share/lxc alpha
      lxc-start 1426657776.508 ERROR    lxc_sync - sync.c:__sync_wait:51 - invalid sequence number 1.
 expected 4
      lxc-start 1426657776.508 ERROR    lxc_start - start.c:__lxc_start:1157 - failed to spawn 'alpha
'
      lxc-start 1426657776.508 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:207 - Device or resource busy 
- cgroup_rmdir: failed to delete /sys/fs/cgroup/perf_event/lxc/alpha
      lxc-start 1426657776.508 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:207 - Device or resource busy 
- cgroup_rmdir: failed to delete /sys/fs/cgroup/blkio/lxc/alpha
      lxc-start 1426657776.508 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:207 - Device or resource busy 
- cgroup_rmdir: failed to delete /sys/fs/cgroup/net_cls/lxc/alpha
      lxc-start 1426657776.509 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:207 - Device or resource busy 
- cgroup_rmdir: failed to delete /sys/fs/cgroup/freezer/lxc/alpha
      lxc-start 1426657776.509 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:207 - Device or resource busy 
- cgroup_rmdir: failed to delete /sys/fs/cgroup/devices/lxc/alpha
      lxc-start 1426657776.509 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:207 - Device or resource busy 
- cgroup_rmdir: failed to delete /sys/fs/cgroup/memory/lxc/alpha
      lxc-start 1426657776.509 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:207 - Device or resource busy 
- cgroup_rmdir: failed to delete /sys/fs/cgroup/cpuacct/lxc/alpha
      lxc-start 1426657776.509 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:207 - Device or resource busy 
- cgroup_rmdir: failed to delete /sys/fs/cgroup/cpu/lxc/alpha
      lxc-start 1426657776.510 ERROR    lxc_cgfs - cgfs.c:cgroup_rmdir:207 - Device or resource busy 
- cgroup_rmdir: failed to delete /sys/fs/cgroup/cpuset/lxc/alpha
      lxc-start 1426657781.513 ERROR    lxc_start_ui - lxc_start.c:main:344 - The container failed to
 start.
      lxc-start 1426657781.513 ERROR    lxc_start_ui - lxc_start.c:main:346 - To get more details, ru
n the container in foreground mode.
      lxc-start 1426657781.513 ERROR    lxc_start_ui - lxc_start.c:main:348 - Additional information 
can be obtained by setting the --logfile and --logpriority options.

But if I start this unpriv LXC in foreground mode, then it starts without errors inside ~/.local/share/lxc/alpha/alpha.log:
$ lxc-start -n alpha -F -- /bin/bash
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
root@alpha / # ls
bin   dev  home  lib32  media  opt   root  sbin  tmp  var
boot  etc  lib   lib64  mnt    proc  run   sys   usr

Please, fix it.
Comment 1 diamond 2015-03-18 12:41:47 UTC
BTW, I can manually delete those dirs under lxc user after lxc-start crash:

rmdir /sys/fs/cgroup/*/lxc/alpha
Comment 2 Markos Chandras (RETIRED) gentoo-dev 2015-03-20 17:19:02 UTC
I don't think there is anything for us to fix here. It does feel like a configuration problem on your end (or the wiki could just be wrong). Please seek support in the lxc devel mailing list or in our forums.

Re-open if you really feel this is a problem with the *gentoo package*

If it turns out to be an upstream problem, please re-open this bug and point us to the fix so we can backport it. Thanks