Installer detects systemd incorrectly (debian)

On Debian, the installer will detect systemd and attempt to use it if it is simply present, rather than actually running.

Normally, if you switch from systemd to sysv, you install “sysv-rc”, and the package manager will uninstall “systemd-sysv”. A separate package called “systemd” will remain, even though sysv is being used for init. That “systemd” package can be removed later (after a reboot), but doesn’t have to be.

The error given when this misdetection occurs is rather confusing since everything that fails is based entirely on the idea that systemd was found, while the failures are all purely because systemd is not really being used at all.

Could you perhaps change it in and test?

Just had a quick look… The issue is it’s testing simply for the presence of “systemctl” (line 111). On Debian (or any system really) that command can be present, even though systemd isn’t the init system.

Actually running systemctl without any parameters looks like a possible test - it will exit with 0 if systemd is running, or 1 if it can’t connect to systemd.

Alternatively, “ps -p 1 -o comm --no-headers” will return “systemd” if systemd is the init system, or “init” if classic sysv style init is being used. Not sure what upstart or openrc would return.