Gentoo Logo

systemd installation guide

Content:

1.  Before installing

What is supported and what is not?

Warning: Please note this guide is incomplete ATM.

Before you decide to install systemd, you should be aware that systemd in Gentoo is fairly fresh, incomplete and not officially supported.

Although a number of packages already supports systemd, there are a lot more not doing so. Don't be surprised if you end up having to request support and/or install unit files manually for your favorite programs.

If you're using stable keywords, you should be prepared to unmask a real lot of packages. That includes unstable OpenRC (stable one conflicts with systemd), dbus, udev and any other package which you'd like to provide unit files.

2.  Installation

Installing systemd

The systemd ebuilds can be found in the tree as sys-apps/systemd. If using portage as the package manager, you can install it using:

Code Listing 2.1: Installing systemd using portage

# emerge -v systemd

Enabling services

The first step after systemd installation would be to enable all the necessary services. To list the available services, call:

Code Listing 2.2: Listing available services

$ ls /usr/lib/systemd/system/*.service

In order to enable a particular service, type in:

Code Listing 2.3: Enabling a standard service

# systemctl enable foo.service

If a service filename ends with a @ (at sign), it is called a unit template and needs to be provided an argument. For example, the xdm@.service expects a tty to run on. Such a services have to enabled manually:

Code Listing 2.4: Enabling a template service

# ln -s /usr/lib/systemd/system/xdm@.service /etc/systemd/system/graphical.target.wants/xdm@tty7.service

Services not having an Install section have to be installed manually too. In case of such a unit, systemctl will report the following error:

Code Listing 2.5: Trying to enable a service without the Install section

# # systemctl enable foo.service
Unit files contain no applicable installation information. Ignoring.

It can be enabled manually using:

Code Listing 2.6: Enabling a simple unit manually

# ln -s /usr/lib/systemd/system/foo.service /etc/systemd/system/graphical.target.wants/

Booting systemd

In order to boot systemd, you need to pass /bin/systemd as the init implementation on the kernel command line.

If you're using genkernel, you should change the real_init parameter to your kernel:

Code Listing 2.7: Example grub config for genkernel & systemd

title=My Gentoo with systemd
root (hd0,0)
kernel /my-genkernel... root=/dev/hda3 real_init=/usr/lib/systemd/systemd
initrd /initramfs-genkernel-x86-2.6.32-gentoo-r7

For own kernel builds, the paramter is called init:

Code Listing 2.8: Example grub config for own kernel & systemd

title=My Gentoo with systemd
root (hd0,0)
kernel /vmlinuz.bin root=/dev/hda3 init=/usr/lib/systemd/systemd


Print

Page updated April 30, 2012

Summary: This document provides a quick guide on systemd installation in Gentoo.

Michał Górny
Author

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.