Failed to start LXC on Linux Kernel 2.6.32-220

Hi,

I am new bee to LXC, I just installed the lxc and created the centos container from the lxc provided templates. It got created successfully without any error but
when I am starting the centos container it is failing with the following error message. Please help.

Following are the steps and error message

  1. uname -a

Linux testnode1.compute.dec.in 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux

  1. lxc-create -n centos1 -t centos

  2. lxc-start -n centos1

-----------------------------------------------------------------------------------------
start 1527235694.750 INFO     lxc_start_ui - lxc_start.c:main:259 - using rcfile /var/lib/lxc/centos/config
      lxc-start 1527235694.763 WARN     lxc_log - log.c:lxc_log_init:331 - lxc_log_init called with log already initialized
      lxc-start 1527235694.764 INFO     lxc_lsm - lsm/lsm.c:lsm_init:48 - LSM security driver SELinux
      lxc-start 1527235694.765 DEBUG    lxc_conf - conf.c:lxc_create_tty:3829 - allocated pty '/dev/pts/1' (5/6)
      lxc-start 1527235694.765 DEBUG    lxc_conf - conf.c:lxc_create_tty:3829 - allocated pty '/dev/pts/2' (7/8)
      lxc-start 1527235694.765 DEBUG    lxc_conf - conf.c:lxc_create_tty:3829 - allocated pty '/dev/pts/3' (9/10)
      lxc-start 1527235694.765 DEBUG    lxc_conf - conf.c:lxc_create_tty:3829 - allocated pty '/dev/pts/4' (11/12)
      lxc-start 1527235694.765 INFO     lxc_conf - conf.c:lxc_create_tty:3840 - tty's configured
      lxc-start 1527235694.765 DEBUG    lxc_start - start.c:setup_signal_fd:263 - sigchild handler set
      lxc-start 1527235694.765 DEBUG    console - console.c:lxc_console_peer_default:438 - opening /dev/tty for console peer
      lxc-start 1527235694.765 DEBUG    console - console.c:lxc_console_peer_default:444 - using '/dev/tty' as console
      lxc-start 1527235694.765 DEBUG    console - console.c:lxc_console_sigwinch_init:144 - 2508 got SIGWINCH fd 17
      lxc-start 1527235694.765 DEBUG    console - console.c:lxc_console_winsz:71 - set winsz dstfd:14 cols:124 rows:49
      lxc-start 1527235694.765 INFO     lxc_start - start.c:lxc_init:463 - 'centos' is initialized
      lxc-start 1527235694.766 DEBUG    lxc_start - start.c:__lxc_start:1122 - Dropping cap_sys_boot
      lxc-start 1527235694.771 DEBUG    lxc_conf - conf.c:instantiate_veth:3140 - instantiated veth 'vethE27QSD/vethM29FKW', index is '10'
      lxc-start 1527235694.771 INFO     lxc_cgroup - cgroup.c:cgroup_init:62 - cgroup driver cgroupfs initing for centos
      lxc-start 1527235694.772 ERROR    lxc_cgfs - cgfs.c:handle_cgroup_settings:2153 - Device or resource busy - failed to set memory.use_hierarchy to 1; continuing
      lxc-start 1527235694.772 ERROR    lxc_cgfs - cgfs.c:handle_cgroup_settings:2153 - Device or resource busy - failed to set memory.use_hierarchy to 1; continuing
      lxc-start 1527235694.777 ERROR    lxc_start - start.c:lxc_spawn:928 - No such file or directory - Failed to preserve requested namespaces: Kernel does not support setns.
      lxc-start 1527235695.031 ERROR    lxc_start - start.c:__lxc_start:1149 - failed to spawn 'centos'
      lxc-start 1527235695.031 ERROR    lxc_start_ui - lxc_start.c:main:336 - The container failed to start.
      lxc-start 1527235695.031 ERROR    lxc_start_ui - lxc_start.c:main:340 - Additional information can be obtained by setting the --logfile and --logpriority options.
-----------------------------------------------------------------------------------------

Please let me know if any other information iis required.

What version of LXC is that?

It’s lxc version 1.0.11

I’m surprised that the keep-ns code even existed back in 1.0.11, @brauner ideas?

Can you show the output of lxc-start --version, please. Your kernel doesn’t have setns(). The setns() syscall was introduced with 2.6.36.

Hi

Below are the outputs

[root@testnode1 ~]# lxc-start --version
1.0.11
[root@testnode1 ~]# uname -a
Linux testnode1.compute.dec.in 2.6.32-220.el6.x86_64 #1 SMP Tue Dec 6 19:48:22 GMT 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@testnode1 ~]#

I mean, how crucial is it that you use the 2.6.32 kernel? If it’s critical I can backport the LXC 3.0 logic got stable-1.0 which should allow you to run container’s without the use of setns().

Hi Brauner

We cannot change this kernel we have to use this kernel version 2.6.32 only. Request you to please do the needful to use LXC on this version only.

Ok, I’ll do a backport in a bit.

1 Like

Please show me the container’s config file. Note that even with my changes you will not be able to share namespaces since your kernel doesn’t support this.

@nis, please try to build with the patches in this branch https://github.com/lxc/lxc/pull/2356 applied and see if that unblocks you. This is what we’re going to backport.

Thanks a lot. I will do n let u know

Ah, I need a couple of more patches. :slight_smile:

Shall I wait for your next message to go ahead?

Yes, please do wait. :slight_smile:

Ok, please try my simpler branch https://github.com/lxc/lxc/pull/2357 and report back, please. :slight_smile:

Hi

I used following steps to build the lxc

  1. Use following command to build

[root@testnode1 lxc]# ./autogen.sh; ./configure; make; make install

While compiling I was getting below error


conf.c : O_PATH is not defined

  1. Then I defined O_PATH to below value in conf.c and build the lxc successfully

#define O_PATH 010000000

  1. Then trying to create the container but getting the below error. Have I done anything wrong

[root@testnode1 lxc]# lxc-create -n centos-1 -t /usr/share/lxc/templates/lxc-centos --lxcpath=/var/lib/lxc/
Host CPE ID from /etc/system-release-cpe: cpe:/o:centos:linux:6:GA
Checking cache download in /var/cache/lxc/centos/x86_64/6/rootfs …
Cache found. Updating…
Loaded plugins: fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile

  • base: centos.excellmedia.net
  • extras: centos.excellmedia.net
  • updates: centos-hn.viettelidc.com.vn
    No Packages marked for Update
    Loaded plugins: fastestmirror
    Cleaning repos: base extras updates
    0 package files removed
    Update finished
    Copy /var/cache/lxc/centos/x86_64/6/rootfs to /var/lib/lxc/centos-1/rootfs …
    Copying rootfs to /var/lib/lxc/centos-1/rootfs …
    Storing root password in '/var/lib/lxc/centos-1/tmp_root_pass’
    Expiring password for user root.
    passwd: Success
    Container rootfs and config have been created.
    Edit the config file to check/enable networking setup.

The temporary root password is stored in:

    '/var/lib/lxc/centos-1/tmp_root_pass'

The root password is set up as expired and will require it to be changed
at first login, which you should do as soon as possible. If you lose the
root password or wish to change it without starting the container, you
can change it from the host by running the following command (which will
also reset the expired flag):

    chroot /var/lib/lxc/centos-1/rootfs passwd

lxc-create: centos-1: confile.c: parse_line: 2367 Unknown configuration key "lxc.devttydir"
lxc-create: centos-1: parse.c: lxc_file_for_each_line_mmap: 104 Failed to parse config: lxc.devttydir = lxc
lxc-create: centos-1: parse.c: lxc_file_for_each_line_mmap: 104 Failed to parse config: lxc.include = /usr/share/lxc/config/centos.common.conf

Error creating container centos-1


Did you build from my branch? It seems like you’re trying to build from a non stable-1.0 branch.

Also, what distro are you using on the host?

https://github.com/lxc/lxc/branches

I have taken master… Correct me If I am wrong