How to start an lxc container on Ubuntu 14.04 without "Executing '/sbin/init' with no configuration file may crash the host" error

10,314

Solution 1

This comment ❝The user id in the lxc instance should equal the user id in the host.❞ led me to my solution.

When I ran an IPython session as root, all functioned as expected. Duh!

ps -aux | grep python

root 1327 0.0 0.4 18956 13188 ? S 09:55 0:00 /usr/bin/python /srv/lwp/lwp.py

sudo lxc-info --name test-container

Name: test-container

State: STOPPED

sudo lxc-attach -n test-container functioned as expected.

Solution 2

For me, It was a privileges problem, I just executed the lxc-start command with sudo and It worked.

Share:
10,314
dmmfll
Author by

dmmfll

Molecular biologist and anesthesiologist by education; Linux and Python enthusiast by passion. I like to solve problems. I like even better to avoid them. ❝Computer science is no more about computers than astronomy is about telescopes, biology is about microscopes or chemistry is about beakers and test tubes. Science is not about tools. It is about how we use them, and what we find out when we do.❞ —Edsger W. Dijkstra

Updated on June 05, 2022

Comments

  • dmmfll
    dmmfll almost 2 years

    goal: create a isolated linux system on Ubuntu 14.04.2 LTS, 3.13.0-35-powerpc64-smp with an ultimate goal of running a hardened nginx server on this machine

    After some research, I decided to try the recipe at http://www.unixmen.com/setting-multiple-isolated-linux-systems-containers-using-lxc-ubuntu-14-04/

    I followed the instructions for installing lxc. I created a container with the following command:

    lxc-create -n test-container -t ubuntu
    

    However, when I tried to start the container

    lxc-start -n test-container -d
    

    I encountered an exception

    lxc_container: lxc_start.c: main: 296 Executing '/sbin/init' with no configuration file may crash the host

    My research using google searches did not turn up any answers that I could understand so I installed the LXC web panel from http://lxc-webpanel.github.io/tools/install.sh to get an alternative perspective.

    The LXC web panel shows my container in the general overview. If I try to start my container 'test-container' the container runs. It has no IP address.

    Even though my container is running via the LXC web console, I do not know how to access it for use.

    I would appreciate help in starting the container from the command line so that I may continue to follow the recipe at http://www.unixmen.com/setting-multiple-isolated-linux-systems-containers-using-lxc-ubuntu-14-04/

    Any alternate methods for running a hardened and secure nginx server on this machine would also be appreciated.