Checklist for an lxc gentoo (taken from a pre-existing image) container hosted on gentoo:
Then all that is needed is:
- Start with Diego's static device tarball (to avoid TIOCSCTTY "open /dev/tty failed errors" "could not set controlling tty" from sshd)
- To see boot up messages and avoid warnings from /etc/issue add: mknod -m 600 console c 5 1
- Remove udev and all other not-relevant services (/etc/runlevels)
- The container config should have: 'lxc.tty = 12' and 'lxc.pts = 128'
- The container fstab should not have a /dev/pts devpts mount (cf newinstance mount option)
- Stop the guest init from running gettys as required.
Then all that is needed is:
- lxc-start -n konuk
- lxc-console -n konuk
- lxc-stop -n konuk
Debug
Useful for debugging are:- List running processes in the lxc: pstree $(lxc-info -n sakc1 --pid | awk '{ print $2 }')
- The guest container log when the guest is started with: lxc-start -n konuk -l DEBUG -o /tmp/lxc.log
- The guest /var/log/auth.log (configure sshd to report to it - /etc/ssh/sshd_config)
Cherrypick patch from the staging lxc on github:
--- lxc-ps_orig 2012-11-21 21:19:11.000000000 +0000
+++ lxc-ps 2013-01-20 22:24:32.000000000 +0000
@@ -56,7 +56,8 @@
init_cgroup=${fields#*:}
# Get the filesystem mountpoint of the hierarchy
- mountpoint=$(grep -E "^cgroup [^ ]+ [^ ]+ ([^ ]+,)?$subsystems(,[^ ]+)? " /proc/self/mounts | cut -d ' ' -f 2)
+ mountpoint=$(awk -v subsysregex="(^|,)$subsystems(,|\$)" \
+ '$3 == "cgroup" && $4 ~ subsysregex {print $2}' /proc/self/mounts)
if [ -z "$mountpoint" ]; then continue; fi
# Return the absolute path to the containers' parent cgroup
fstab
sysfs needs to be mounted so that the net scripts can see the various network interfaces are present - they check for entries in: /sys/class/net
Add to the container fstab (note: localmount may not run):
...
sysfs /lxc/konuk/sys sysfs defaults 0 0
...
The symptom is:
* Bringing up interface lo
* Caching network module dependencies
* ERROR: interface lo does not exist
* Ensure that you have loaded the correct kernel module for your hardware
* ERROR: net.lo failed to start