Replace systemd with SysV Init as the init system on Debian Stretch
A working Debian Stretch install with root privileges.
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
- $ – requires given linux commands to be executed as a regular non-privileged user
Not everyone loves systemd, and for those that don’t, there really aren’t many options. That’s especially true if you want something like a stable server. Fear not, SysV Init is actually still supported under Debian, and it’s not hard to switch.
**Note:** don’t try this if you’re running GNOME or another desktop environment that has a hard dependency on systemd. It will just break your system.
Add Devuan Repositories
This part isn’t strictly necessary if you just want to switch the init system and leave systemd installed as a compatibility layer. That would work fine. If you absolutely don’t want systemd on your system at all, you need to make some arrangements to make the things that depend on it work.
Devuan, the systemd-less Debian fork is lagging a bit behind. Their Stretch release, ASCII, isn’t ready, and running Devuan’s testing releases isn’t super stable right now. However, the did build some crucial packages to make systemd-dependent programs work without it, and you can use them in Debian.
First, create a new
.list file in
/etc/apt/sources.list.d/ for Devuan. Then, add the following line to it.
deb http://packages.devuan.org/devuan/ ascii main
Save that and exit.
Next, you’re going to need the Devuan signing key. Grab that with
$ cd Downloads $ wget https://firstname.lastname@example.org
Then, import it into Apt.
# apt-key add email@example.com
Pin The Devuan Packages
Unless you want a really weird Debian/Devuan hybrid, you’re going to need to pin only the Devuan packages that you need. Create a file,
/etc/apt/preferences.d/. Add the following lines to it.
Package: * Pin: release a=stable Pin-Priority: 1000 Package: * Pin: release a=ascii Pin-Priority: 2 Package: udisks2 Pin: release a=ascii Pin-Priority: 1001 Package: libudisks2-0 Pin: release a=ascii Pin-Priority: 1001 Package: cgmanager Pin: release a=ascii Pin-Priority: 1001 Package: libcgmanager0 Pin: release a=ascii Pin-Priority: 1001 Package: libpolkit-agent-1-0 Pin: release a=ascii Pin-Priority: 1001 Package: libpolkit-backend-1-0 Pin: release a=ascii Pin-Priority: 1001 Package: libpolkit-gobject-1-0 Pin: release a=ascii Pin-Priority: 1001 Package: policykit-1 Pin: release a=ascii Pin-Priority: 1001
It’s lengthy and annoying, but it’ll keep a lot of things from breaking once you remove systemd. Update before moving on.
# apt update
Install The Devuan Packages
The next step is fairly straightforward. Install all of the packages you just set up for.
# apt -t ascii install udisks2 libudisks2-0 cgmanager libcgmanager0 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 policykit-1
You’re finally ready to install SysV. This one is also pretty easy.
# apt install sysvinit-core sysvinit-utils
Then, copy SysV’s inittab to make it the system default.
# cp /usr/share/sysvinit/inittab /etc/inittab
Once everything is in place, and you’re confident that you installed everything properly, restart the system. You should see the difference immediately in the boot process.
Again, this step is totally optional and may still break things. This will pull out systemd and anything that still depends on it. You have been warned.
# apt remove --purge --auto-remove systemd
If you want to make the change stick, add systemd to your Apt preferences.
Package: systemd Pin: release * Pin-Priority: -1
That’s it! You’re Debian system is officially systemd-free. Hopefully, everything else still works correctly too. This method is obviously better with servers than desktops because of the amount of desktop software that relies on systemd. It’s also important to keep in mind that things can change. Stretch is pretty much set in stone, but trying this procedure or an equivalent on Testing or Sid might not yield the same results.