Setting up Systemd - sakaki-/gentoo-on-rpi-64bit GitHub Wiki

Note currently this setup is very experimental and a work in progress.

One of the things systemd relies on for a clean unmount of the rootfs is the use of a initrd file. I'd recommend setting one of these up first using dracut before going any further.

Outstanding items

  • Certain rpi related init scripts such as from rpi3-ethfix (genpi64-overlay) don't yet support systemd
  • xdm is not currently working, currently I'm missing /dev/fb0, this could be related to the init scripts that need patching, or additional modules need to be specified to be loaded on bootup
  • need to investigate the use of timedatectl for ntp time

Upsides include

  • A little bit quicker on boot / shutdown
  • May help with controlling the shutdown process with use with the rpi x735 board (still investigating)

Links

Setup

Kernel Rebuild

First I updated the kernel options just to add a couple in based on the Gentoo wiki.
I'm not sure if these are needed but I wanted to make sure everything in the recommended list was included.

Config Option Menu Location State
CONFIG_CHECKPOINT_RESTORE General Setup -> Checkpoint/restore support Enabled
CONFIG_IPV6 Networking Support -> Networking Options -> The IPv6 Protocol Changed from module to directly included
CONFIG_EFS_VARS Firmware Drivers -> EFI (Extensible Firmware Interface) Support -> EFI Variable Support via sysfs Enabled
CONFIG_CRYPTO_USER_API_HASH Cryptographic API -> User-space interface for hash algorithms Enabled
CONFIG_CRYPTO_USER_API_AEAD Cryptographic API -> User-space interface for AEAD cipher algorithms Enabled

Depclean / change of use flags

Next we're going to do a depclean, then change some use flags

emerge --ask --depclean
euse -E systemd dbus warmstarts
euse -D consolekit elogind

If you want to use docker then I'd also suggest enabling cgroup-hybrid to prevent any blockages

euse -E cgroup-hybrid

Rebuild openrc

Next we're going to disable netifrc for openrc then re-emerge.
This is to avoid some blockages that might crop up.
Followed by a depclean to clear out netifrc.

echo "sys-apps/openrc -netifrc" > /etc/portage/package.use/temp
emerge --oneshot sys-apps/openrc 
emerge --ask --depclean

This should remove netifrc which is network support for openrc but since we're switching across to systemd we shouldn't need it anyway

Update the world / install systemd

Check for any conflicts

emerge -p -avDN @world

In my case I had to temporarily remove docker, during the switchover then re-install afterwards.

emerge -C app-emulation/docker

emerge the world to install systemd

emerge -avDN @world

Rebuild a couple of packages / update configs

emerge @preserved-rebuild
etc-update

Lets rebuild the initramfs using dracut

dracut --force

Re-emerge network manager

For some reason we need to re-install network manager.
When I first tried the above I ended up with no network so had to do a "dhcpcd eth0" just to get some basic network working just to re-install it

net-misc/networkmanager

Configure systemd

The first line sets up some defaults, the NetworkManager sets up eth0 / wlan0 for networking
sshd is for remote access
xdm is for the xfce desktop

systemctl preset-all --preset-mode=enable-only
systemctl enable NetworkManager
systemctl enable sshd
systemctl enable xdm

Next lets get systemd up and running

reboot

Afterwards try a world update

emerge -up --deep --newuse @world
emerge -up --deep --changed-use @world
revdep-rebuild

Lets make sure the server name is set

hostnamectl set-hostname <server name>
env-update && source /etc/profile

Finishing up

If you needed to uninstall docker during the install then re-install it

emerge app-emulation/docker

This should remove openrc

emerge --depclean
emerge --deselect sys-apps/openrc
emerge --unmerge sys-apps/openrc

systemctl Commands

Starting and stopping services under systemd is a little different

  • systemctl daemon-reexec - Can be used after an in place systemd update to avoid a reboot
  • systemctl start - Can be used to start a service
  • systemctl enable - Can be used to specify a service should be started on bootup
  • systemctl list-units --type=service - List all available services
⚠️ **GitHub.com Fallback** ⚠️