Gentoo Without systemd

Having trouble with being pulled in your emerges for no apparent reason? Read this article in order to find out how to resolve this problem.

Why is systemd pulled in?
Most packages depending on systemd, actually depend on systemd or OpenRC or some other init system. Portage will attempt to install the first in the list, which might be systemd.

Portage cannot magically guess which init system the user prefers. USE flags defined user preferences.

systemd USE flag
Add  to the system's USE variable in.

Mask systemd and udev
In order to explicitly inform Portage to never install, a mask is required.

Masks can be created a two different ways. Either create a directory called in  then create individual text files containing lists of packages to be masked or create a file called  and organize it all in one big file. Portage will be happy with either method. The choice is left up to the system administrator. Why two ways? Well, it would appear two methods continue to exist for organizational purposes. Some users like having everything defined in one file, while other users like having each set of packages masked in separate directories.

OR

Masking udev will not result in a broken system; Portage is smart enough to automatically replace udev by : the systemd-free fork of udev.

Packages requiring systemd
Some packages have systemd as a non-optional dependency, if systemd is masked, you won't be able to install them

Either stop using such packages, switch to systemd or use some systemd emulator/wrapper/whatever

I didn't notice portage installing systemd, am I using systemd now ?
Portage does not activate systemd when installing it, if you do not activate systemd, you will remain on OpenRC (or whatever init you are currently using).

To remove systemd, follow the steps above and update the @world set, or remove it manually:

Remove systemd related files automatically
According to the official ebuild policy for systemd, unit files are installed unconditionally to the USE flag.

To get around this, we can install a hook for portage to delete these files.

The ebuild for this package can be found in the now defunct sunrise-overlay.