How to disable systemd service in rescue mode

I have a service that kills the system every time it boots (OOM). I need to get rid of it, but debian 8 doesn't seem to have recovery boot option anymore, so I had to boot using cd and used rescue, that chrooted to root FS.

Now when I do:

# systemctl

I get

Running in chroot, ignoring request.

So how can I disable it, when systemd doesn't allow me to change the configuration in rescue mode?


Solution 1:

To disable it, you call systemctl disable <service>. Without arguments, systemctl displays the current state, which is obviously not possible in a chroot.

Alternatively, you can also go to /etc/systemd/system/ and remove the symlink to your service (probably in the multi-user.target.wants folder).

If it is a service that is enabled by default, you need to create a symlink (named <service>.service) to /dev/null to disable it. Where the symlink needs to be depends on where in /lib/systemd/system the service is enabled.