Systemd

From systemd's website:

''systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using/ Linux cgroups, supports snapshotting and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic. It can work as a drop-in replacement for sysvinit.''

Kernel
The Gentoo ebuild for systemd requires at least 2.6.38 kernel. Although it is higher than what upstream requires, we already had trouble running systemd on 2.6.37.

systemd requires some non-standard kernel options to be enabled:

(Re)build and (Re)install.

Userland
Many packages support systemd by default and are already available in the official portage tree but are (obviously) not stable yet.

Keyword required for installing systemd:

Optional: if you want GTK support, then add these packages too:

For desktops you can also add the following few systemd-ready packages:

Install systemd and related packages:

Finalizing w/ grub
By default systemd will start your system to allow you to login in on a tty. This means no display manager gets started, no network is set up, etc. Make sure to enable the necessary services before you reboot.

Finally you will need to tell your kernel to run the provided by systemd. If you have a kernel built by genkernel, change the kernel parameter to point to :

If you have built your kernel yourself, change the kernel parameter to point to :

Finalizing w/ grub 2
/etc/default/grub file gedited to have this line look like this....

GRUB_CMDLINE_LINUX_DEFAULT="init=/usr/bin/systemd quiet"

Services
To list available services, run:

To enable services (similar to what  does):

A further list of unit files is available from http://git.overlays.gentoo.org/gitweb/?p=user/systemd.git;a=tree;f=sys-apps/systemd-units/files or from http://cgit.freedesktop.org/systemd/systemd/tree/units

You can find a list of some packages and their openrc and systemd services in the Gentoo Wiki

ALSA
alsa-utils already provides systemd service files. They are enabled automatically when installed.

netctl
net-misc/netctl can be used for network configuration of various types in simple manner. Netctl is borrowed from Arch Linux and provides units for systemd. User should create a network profile for each desired network interface in /etc/netctl (use examples in /etc/netctl/examples) and then activate it with:

More information can be found in.

DHCPCD
As of 5.2.12-r1, dhcpcd ebuild installs unit file.

wpa_supplicant
As of 0.7.3-r3, wpa_supplicant ebuild provides two systemd units:
 * for NetworkManager users (using D-Bus),
 * for plain wpa_supplicant users.

The latter one should be enabled as, where wlan0 shall be replaced by your wireless interface.

network manager
This will also allow the networkmanager-applet in gnome 3 to appear.

munge
See http://code.google.com/p/munge/issues/detail?id=11

KDM
Starting with systemd-187, the file contents have changed.

XDM/GDM
Versions of gdm >= 3.4 already provide a gdm.service, so to enable this:

Versions of gdm before 3.4 require creating an xdm.service file executing Gdm:

Earlier versions may require creating an xdm.service file:

(or quite possibly just 'systemctl enable xdm.service' as there is already a xdm.service file located @ /usr/lib64/systemd/system/xdm.service)

CUPS
Starting with cups 1.5.2-r20 the necessary socket, path and service files are provided by the ebuild.

PostgreSQL
This starts PostgreSQL.

NFS
Implements the functions of /etc/init.d/nfs, /etc/init.d/nfsmount and helper services.

The following is only necessary if you are running a NFS server.

The following files are necessary for all versions of NFS:

The following files are necessary for NFSv4 only:

To mount NFS 2 and 3 shares only use the following service file:

This service file pulls in the dependencies for mounting NFSv4 shares (also works for earlier versions):

Service files for an NFS server are a work in progress:

sshd.socket (socket-activated sshd)
The current sytemd ebuild already brings a unit file which is ready for socket activation, so all you need to do is create its respective  unit file and disable the non-socket-activated unit file, i.e..

php-fpm
You need also make an symlink on used php-fpm slot. For example ln -s /etc/php/fpm-php5.4 /etc/php/fpm.

iptables
The iptables-stop script is optional. It is basically a port of what /etc/init.d/iptables does now in the stop method and will completely wipe your firewall settings to allow everything.

kexec_load
Example :

systemd hardcodes kexec to, while it lives under on Gentoo so you need to copy or hardlink it to

rtorrent (in screen)
Automatically opens a new window in your running screen session and starts rtorrent, if a new torrent is copied into the torrents directory. Change to your user.

gpm
gpm is a cut and paste utility and mouse server for virtual consoles.

HDparm
Initialize Hard drive PM parameters after suspend/restore

Unit Masking
If you have broken or unneeded units, you may can mask it, so they won't annoying in journalctl.

For example:

OpenRC Compatibility
systemd doesn't initialize the OpenRC environment for you, so starting any OpenRC service will fail and complain that the service has already been started. For example: * WARNING: lvm has already been started

Enable the OpenRC service to initialize the openrc enviornment:

If you get the following error message when enabling openrc-init.service: Unit files contain no applicable installation information. Ignoring. You may need to modify openrc-init.service to work with the latest versions of systemd where empty sections of scripts are disabled by default:

Removing only sysvinit
killall = functioning

reboot = functioning

systemctl reboot = functioning

shutdown -h now = functioning

shutdown -h 60 = functioning

halt = works but fails to power off as a work around add "alias halt="shutdown -h now"" to /etc/profile.d/rc.sh & run source /etc/profile as your user and then again as root

Removing OpenRC
If you want to have a pure systemd system then you can disable the sysv USE flag globally, then unmerge sysvinit as it won't be used anymore..


 * Remove openrc and sysvinit


 * Add openrc to package.provided so portage won't complain


 * Install to have symlinks like reboot and halt


 * Add a hostname


 * Console and keymap settings


 * OS info


 * Locale settings (read man locale.conf for more options )

PAM support: su, sudo, screen...
If you want systemd to register your user sessions in cgroups with the optional advantages of having CPU (or other controllers) balancing between sessions, then you can add the USE flag pam to systemd and do the following:


 * Edit the session section of /etc/pam.d/system-auth

If with systemd-39 and later your su - sessions are ending with a ...killed message and/or your sudo doesn't work anymore, here is what solved it for me. Copy the contents of the session section from to  then edit that file and :