Systemd – How to Force Systemd to Enter Emergency Mode

opensusesystemd

I'm using Opensuse 12.3.
systemd-195-13.45.1.x86_64

After few problems when I added a disc at btrfs mount I'm trying put my system in emergency mode (which I consider all services will be stopped and all mounts able to be unmounted),.

But they just don't work!!!

How to force systemd enter in emergency mode? (or something equivalent of init single mode)
and force the emergency mode at boot time(grub menu)?

First attempt:
I use the old way : init 1 at the console…
They show me the emergency screen , ask for root password, but after this re-login, I still unable to unmount my btrfs FS (says it are in use).
(with lsof I don't found anything using this mounts).
The runlevel command return level 3… not 1…

Second attempt:
I run the command systemctl emergency which show me the "emergency screen" , ask for root password… and then finally show me runlevel = 1 . But I'm still not able to umount my btrfs FS….

Third attempt:
I reboot the machine and at grub screen I type 'e' to add the "emergency" word at the options. Where they give me a message like "emergency word is invalid".
I try with "single" word and get the same behave….


My final solution was remove the automatically mount from fstab and reboot my system at normal mode. Then finally I able to run my check at btrfs Fs… but is very annoying because all services which depends this mount start give errors…

Best Answer

There are 4 targets in systemd. what you wanted is emergency.target I think you can try these steps:

  1. reboot the system
  2. interrupt the boot loader menu countdown by pressing any key
  3. move the cursor the entry to be started
  4. press e to edit the current entry
  5. move the cursor tho the entry to the line that starts with linux16. This is the kernel command line.

6.append systemd.unit=desired.target

  1. press ctrl+x to boot with these changes.

This is rhel7's method . I think it is maybe similar with suse . Once you enter into emergency mode, root password is still needed. good luck:)