}

Linux container: lxc\_start\_ui - tools/lxc_start.c:main:319 - Executing '/sbin/init' with no configuration file may crash the host

Created:

The problem

When you try to start a container with:

sudo lxc-start --name 100

You will get:

lxc-start: 100: lxccontainer.c: wait_on_daemonized_start: 760 Received container state "ABORTING" instead of "RUNNING"
lxc-start: 100: tools/lxc_start.c: main: 371 The container failed to start.
lxc-start: 100: tools/lxc_start.c: main: 373 To get more details, run the container in foreground mode.
lxc-start: 100: tools/lxc_start.c: main: 375 Additional information can be obtained by setting the --logfile and --logpriority options.

When you search on the logfile:

      lxc-start 100 20170930203012.813 ERROR    lxc_start_ui - tools/lxc_start.c:main:319 - Executing '/sbin/init' with no configuration file may crash the host
      lxc-start 100 20170930203127.817 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1335 - Path "/sys/fs/cgroup/systemd//lxc/100" already existed.

The LXC error means the container name provided with the lxc-start command does not exist.

Solution

Remeber to use sudo when starting a container with lxc-start, it could be a privileges problem. Usually LXC is looking for the container in /var/lib/lxc, doesn't find it and so doesn't have a config, showing this error.

First recheck the container name and if the container:

lxc-ls -f

if the error continues, try to specify the path to containers with -P:

sudo lxc-start --name 100 -P /path/to/containers

More information on logs

Use lxc-start with the --logfile to see more errors:

sudo lxc-start --name 100 --logfile start.log

On the start.log file you will see the following errors:

      lxc-start 100 20170930203012.813 ERROR    lxc_start_ui - tools/lxc_start.c:main:319 - Executing '/sbin/init' with no configuration file may crash the host
      lxc-start 100 20170930203127.817 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1335 - Path "/sys/fs/cgroup/systemd//lxc/100" already existed.
      lxc-start 100 20170930203127.817 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1431 - Failed to create "/sys/fs/cgroup/systemd//lxc/100"
      lxc-start 100 20170930203127.818 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1335 - Path "/sys/fs/cgroup/systemd//lxc/100-1" already existed.
      lxc-start 100 20170930203127.818 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1431 - Failed to create "/sys/fs/cgroup/systemd//lxc/100-1"
      lxc-start 100 20170930203127.818 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1335 - Path "/sys/fs/cgroup/systemd//lxc/100-2" already existed.
      lxc-start 100 20170930203127.818 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1431 - Failed to create "/sys/fs/cgroup/systemd//lxc/100-2"
      lxc-start 100 20170930203127.819 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1335 - Path "/sys/fs/cgroup/systemd//lxc/100-3" already existed.
      lxc-start 100 20170930203127.819 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1431 - Failed to create "/sys/fs/cgroup/systemd//lxc/100-3"
      lxc-start 100 20170930203127.819 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1335 - Path "/sys/fs/cgroup/systemd//lxc/100-4" already existed.
      lxc-start 100 20170930203127.819 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1431 - Failed to create "/sys/fs/cgroup/systemd//lxc/100-4"
      lxc-start 100 20170930203127.819 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1335 - Path "/sys/fs/cgroup/systemd//lxc/100-5" already existed.
      lxc-start 100 20170930203127.819 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1431 - Failed to create "/sys/fs/cgroup/systemd//lxc/100-5"
      lxc-start 100 20170930203127.820 ERROR    lxc_cgfsng - cgroups/cgfsng.c:create_path_for_hierarchy:1335 - Path "/sys/fs/cgroup/systemd//lxc/100-6" already existed.
      lxc-start 100 20170930203127.820 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_create:1431 - Failed to create "/sys/fs/cgroup/systemd//lxc/100-6"
      lxc-start 100 20170930203127.837 ERROR    lxc_cgfsng - cgroups/cgfsng.c:cgfsng_setup_limits:2120 - Permission denied - Error setting memory.memsw.limit_in_bytes to 2684354560 for 100
      lxc-start 100 20170930203127.837 ERROR    lxc_start - start.c:lxc_spawn:1274 - Failed to setup cgroup limits for container "100".