Jul 022015
Time has come, I need to start switching my mentality from SysV to modern init systems. Turns out, that systemd thingy is not so bad! Actually, it’s pretty cool.
There is an interesting video from RedHat Summit 2015 (at the bottom of this page) which I wholeheartedly recommend, especially it doesn’t solely apply to Red Hat – Debian Jessie uses systemd too.
My notes for impatient:
- Slice (each gets CPUShares=1024)
user.slice
system.slice # services
machine.slice #vms, containers, etc - Scope
- Service
systemctl list-unit-files --no-pager|grep lvm systemctl -t service list-unit-files systemctl -t service systemctl -t socket systemctl -t socket list-unit-files systemctl get-default systemctl set-default multi-user # runlevel 3, no GUI systemctl set-default graphical.target # aka runlevel 5, graphical.target systemctl list-timers # can be used to periodically run fstrim for example? systemd-delta # what changed on system comparing to originally shipped by distributor systemctl rescue systemctl emergency systemd-cgtop # this is cool! systemd-cgls journalctl # logging. Trusted and untrusted fields in logs, untrusted are generated by logging app journalctl -xn journalctl -k -b -1 journalctl /dev/sda journalctl /usr/bin/python-thinlinc journalctl _SYSTEMD_UNIT=avahi-daemon.service
Checkout systemd based containers! Didn’t expect that
man systemd-nspawn mkdir /var/lib/container/debian-tree debootstrap --arch=amd64 unstable /var/lib/container/debian-tree/ systemd-nspawn -D /var/lib/container/debian-tree/
or assuming you have a bridge
systemd-nspawn --network-bridge=br-eth0 -D /var/lib/container/ka-lite
This installs a minimal Debian unstable distribution into the directory /var/lib/container/debian-tree/ and then spawns a shell in a namespace container in it. Wow. I know you can use like Linux Containers but this systemd-nspawn is already there waiting to be used.
Have fun.