You are not logged in.

#1 2015-08-11 15:41:52

zeilenleser
Member
Registered: 2015-08-11
Posts: 5

LXC container with Ubuntu 'utopic' - PATH not valid - runlevel unknown

Hi all

I'm stumbling around for some days creating a custom template for installing an Ubuntu 'utopic' container with some extra services (tomcat and postgres) on a ArchLinux host.
The services are not started at container start. When I attach to the host and ask for the runlevel it responds with 'unknown'. Executing 'init 2' manually works as solution (runlevel = N 2, services are started).

In the past days I had the problem, that the $PATH variable didn't contain /usr/sbin, /usr/bin, /sbin, /bin when attached to the container.
At least it works now when I'm attached to the container (CName) using

lxc-attach -n CName

Executing

lxc-attach -n CName -- echo $PATH

results in

lxc-attach: attach.c: lxc_attach_run_command: 1107 No such file or directory - failed to exec 'echo'

Executing
lxc-attach -n CName -- $PATH
results in
lxc-attach: attach.c: lxc_attach_run_command: 1107 No such file or directory - failed to exec '/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/me/scripts'

There is at least /bin missing and probably /sbin so I guess that init (/sbin/init) can't be executed at start up and this might be the root of all.

Is there anybody out there who knows how I can debug the problem (or better how to solve it)? There must be something going wrong during installation.
I basically use

lxc-create -n CName -t ubuntu -- -r utopic

I tried

lxc-create -n CName -t ubuntu -- -r utopic -b me -u me

which solved the PATH problem when I'm logged in the container.

The lxc-ubuntu template sets the PATH

export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin

Regards,
zeilenleser

Last edited by zeilenleser (2015-08-11 20:55:53)

Offline

#2 2015-08-11 21:06:50

zeilenleser
Member
Registered: 2015-08-11
Posts: 5

Re: LXC container with Ubuntu 'utopic' - PATH not valid - runlevel unknown

As long as I can't solve the problem I'll use this workaround

Create the container

lxc-create -t ubuntu -n <container name> -- -r utopic

Start the container and manually set runlevel to 2 (this has to be done on every container start)

lxc-start -n <container name>
lxc-attach -n <container name> --clear-env -- init 2

If I'll get any further, I'll post it here.

Regards,
zeilenleser

Last edited by zeilenleser (2015-08-11 21:07:31)

Offline

#3 2015-08-12 08:05:40

zeilenleser
Member
Registered: 2015-08-11
Posts: 5

Re: LXC container with Ubuntu 'utopic' - PATH not valid - runlevel unknown

I moved on with the following steps:

1. start the container with the console log written to a log file

lxc-start -n <container-name> -L /tmp/container.log

this log file contains the following message

Starting track if upstart is running in a container [fail]”

2. attach to the container and inspect the /var/log/upstart/*.log files
one of the log files contained a message similar to this

/proc/self/fd/9: 24: ... initctl not found

3. I checked if /sbin/initctl was present in the container but it wasn't.

4. I checked the cache in /var/cache/lxc/utopic on the host to see if it was there but it wasn't. So I had messed up something during my previous tries. I decided to take the safe option and delete the cache (rm -r /var/cache/lxc/utopic) an retry the installation procedure.

No it works. It took quite a long time until the container was fully started and runlevel 'N 2' was reached but it worked.

5. I modified /etc/network/interfaces from

iface eth0 inet dhcp

to

iface eth0 inet manual

This makes the startup really fast since Ubuntu doesn't try to setup DHCP anymore (I use a static ip address).

6. I'll always enable '--clear-env' when attaching to a (Ubuntu?) container to get rid of the PATH problem

lxc-attach -n <container name> --clear-env

I hope this will help somebody.

Regards,
Christian

Offline

#4 2015-08-12 08:07:32

zeilenleser
Member
Registered: 2015-08-11
Posts: 5

Re: LXC container with Ubuntu 'utopic' - PATH not valid - runlevel unknown

This topic can be closed but I don't know how to do it on my own.

Offline

Board footer

Powered by FluxBB