Server!/Horror! I have a magnet and I don't mind using it!

Notes on LXC

Minor notes on how to set up a host and a first container for LXC. This will not give you networking. Those are just the basics…

Assumptions

Do It!

lxc.utsname=vm01 lxc.network.type=empty
lxc.network.flags=up
lxc.mount=/etc/lxc/vm01/fstab
lxc.rootfs=/srv/lxc/vm01
lxc.tty=4 lxc.pts=1024
# LXC Device setup
# only explicitely allowed devices...
lxc.cgroup.devices.deny = a
# /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm # consoles
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
# /dev/{,u}random
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
# rtc
lxc.cgroup.devices.allow = c 254:0 rwm
devpts /srv/lxc/vm01/debootstrapped/dev/pts devpts defaults 0 0
proc /srv/lxc/vm01/debootstrapped/proc    proc   defaults 0 0
sysfs /srv/lxc/vm01/debootstrapped/sys     sysfs  defaults 0 0
none /srv/lxc/vm01/debootstrapped/dev/shm tmpfs  defaults 0 0
debootstrap --variant=minbase --include=dhcp-client,dialog,ifupdown,iproute,libui-dialog-perl,locales,netbase,net-tools,openssh-server,vim,curl,git-core squeeze /srv/lxc/vm01/ http://cdn.debian.net/debian/

`

id:3:initdefault:
si::sysinit:/etc/init.d/rcS
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
1:2345:respawn:/sbin/getty 38400 console
c1:12345:respawn:/sbin/getty 38400 tty1 linux
c2:12345:respawn:/sbin/getty 38400 tty2 linux
c3:12345:respawn:/sbin/getty 38400 tty3 linux
c4:12345:respawn:/sbin/getty 38400 tty4 linux
#!/bin/sh
### BEGIN INIT INFO
# Provides:          hwclockfirst
# Required-Start:    mountdevsubfs
# Required-Stop:
# Default-Start:     S
# X-Start-Before:    checkroot
# Default-Stop:
### END INIT INFO
exit 0
#!/bin/sh
### BEGIN INIT INFO
# Provides:          hwclock
# Required-Start:    checkroot
# Required-Stop:     $local_fs
# Default-Start:     S
# Default-Stop:      0 6
### END INIT INFO
exit 0

Generated: 2017-11-02 10:20:47 +0100