HowTo: systemd on Exherbo

This comes up all too often, so here’s a HowTo for systemd on Exherbo:

  • You have to run a Linux kernel >=2.6.39. The new kernel is only needed at runtime, not for building systemd.
  • You should run a Linux kernel >=3.8. The new kernel is only needed at runtime, not for building systemd.
  • Kernel options for systemd: cf. systemd’s README, here’s an excerpt:

CONFIG_DEVTMPFS
CONFIG_CGROUPS (it’s OK to disable all controllers)
CONFIG_INOTIFY_USER
CONFIG_SIGNALFD
CONFIG_TIMERFD
CONFIG_EPOLL
CONFIG_NET
CONFIG_SYSFS

Linux kernel >= 3.8 for Smack support

Udev will fail to work with the legacy layout:
CONFIG_SYSFS_DEPRECATED=n

Legacy hotplug slows down the system and confuses udev:
CONFIG_UEVENT_HELPER_PATH=””

Userspace firmware loading is deprecated, will go away, and
sometimes causes problems:
CONFIG_FW_LOADER_USER_HELPER=n

Some udev rules and virtualization detection relies on it:
CONFIG_DMIID

Mount and bind mount handling might require it:
CONFIG_FHANDLE

Optional but strongly recommended:
CONFIG_IPV6
CONFIG_AUTOFS4_FS
CONFIG_TMPFS_POSIX_ACL
CONFIG_TMPFS_XATTR
CONFIG_SECCOMP

For systemd-bootchart a kernel with procfs support and several
proc output options enabled is required:
CONFIG_PROC_FS
CONFIG_SCHEDSTATS
CONFIG_SCHED_DEBUG

For UEFI systems:

CONFIG_EFI_VARS
CONFIG_EFI_PARTITION

Furthermore:
CONFIG_FANOTIFY=y (only used for readahead stuff which is not enabled by default.)

CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y (only used for readahead stuff which is not enabled by default.)

 

  • Set the “systemd” option globally in /etc/paludis/options.conf: */* systemd
  • Install systemd: cave resolve -x sys-apps/systemd (Read what cave tells you. If in doubt, read Paludis’ documentation.)
  • Reinstall every package with the new option set: cave resolve world -cx
  • Switch to systemd as your init system: eclectic init set systemd
  • Set the desired hostname in /etc/hostname.
  • Optional: Edit /etc/vconsole.conf to your liking. (If you delete it, empty it or comment out everything, systemd will use the kernel’s defaults.)
  • Optional: Edit /etc/machine-info to your liking.
  • Read Lennart’s blog post about the other configuration files.
  • Install a Linux kernel >=2.6.39. (see above for kernel options, etc.)
  • Reboot.

After that reboot, you’ll be in a console with a minimal set of services started, hopefully ready to log in. Log in as root (the keyboard layout is set to US in vconsole.conf (see above) by default!). Then you can enable whatever services (found in /lib/systemd/system) you like, suggested ones are:

  • dhcpcd.service or NetworkManager.service
  • sshd.socket (it doesn’t start? Missing host keys? man sshd or http://tinyurl.com/24jwxjd)

As an extremely simple and limited alternative to NetworkManager.service, there’s network.service and network.conf which get installed if you set the “simple-net” option for systemd. network.service only allows for static network setups with IPv4.

Alternatively, you can use dhcpcd.service.

If I were you, I’d not enable your display manager’s service (either kdm.service, gdm.service, xdm.service or slim.service) until your basic system has at least booted properly once and you can reach your system using ssh because in case things go wrong, it’s easier not to have to wrestle with a GUI.

To actually enable a service, run “systemctl enable <foo.service>”. More details can be found in systemd’s man page.

If you need help, it’s available in #exherbo, as usual, but if you didn’t read this before asking, grumpy me will bite your head off unless you prove you read this by saying “I have furuncles on my arse.”. Yes, I’m being serious.

 

FAQ section:

  • “How/where do you specify extra modules to be loaded?” – You put the module name into /etc/modules-load.d/foo.conf and it will get loaded. Unless systemd-udev has already loaded it for you. Check that first.
  • “My hostname is set to something funny, e. g. ’08’!” – If you’re using NetworkManager, you need to set your hostname in /etc/NetworkManager/NetworkManager.conf, too.
  • “I’m getting messages about failing services, e. g. dev-hugepages.mount or sys-kernel-debug.automount. What’s up with that?” – You can either enable the corresponding kernel options, delete the symlink (e. g. /lib/systemd/system/basic.target.wants/sys-kernel-debug.automount) or just ignore those messages. They’re harmless.
  • “When sshd.socket is enabled, every closed ssh connection leaves a failed service around, e. g. sshd@192…:55140.service.” – Harmless as well. There are no ressources used by those so ignore them. (This should be fixed anyway.)
  • “Where can I learn more about the usual administration tasks? – Read Lennart’s series of blog posts about systemd for administrators: Part 1, Part 2, Part 3, Part 4, Part 5, Part 6, Part 7, Part 8
  • “How do I debug problems with systemd?” – Read this page http://fedoraproject.org/wiki/How_to_debug_Systemd_problems
  • “I’m completely lost. What do I do?” – Please remember there’s always a friend around. It’s called “man”. 😉
I am and have been working on quite a few F/OSS projects:
  • Exherbo (Nick: Philantrop)
  • Gentoo (Nick: Philantrop)
  • Calibre plugin iOS reader applications
  • Calibre plugin Marvin XD
  • chroot-manager
  • stuff on github
  • Lots of other projects
  • If you like my work, feel free to donate. 🙂

    2 thoughts on “HowTo: systemd on Exherbo

    1. I think it’s also worth a mention that as of 2.6.36-rc8 fanotify was disabled (on 12.10.2010) as per [1].
      Judging from the fact that it’s promised to be last rc before .36 goes stable, I’d bet it will only be re-enabled in 2.6.37.
      On the bright side, it can easily be re-enabled (as of rc8) by applying reverse-patch to [1].

      [1] http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=commit;h=7c5347733dcc4ba0bac0baf86d99fae0561f33b7

    Leave a Reply