Systemd: how to get into rescue mode

Little Girl littlergirl at gmail.com
Sun Jan 5 22:37:11 UTC 2020


Hey there,

Volker Wysk wrote:

>I do this:
>
>systemctl isolate rescue.target
>
>Then everything is closed, and I get to a virtual console. There, the
>root password is queried. 

That command puts you into rescue mode (which is equivalent to the
now obsolete runlevel 1). According to the systemd.special man page,
the rescue mode is a "special target unit that pulls in the base
system (including system mounts) and spawns a rescue shell. Isolate
to this target in order to administer the system in single-user mode
with all file systems mounted but with no services running, except
for the most basic."

>Alas, there is no reaction whatsoever. I can enter the password, but
>nothing happens. Same for ctrl-d. The other virtual consoles are
>dead. Alt-ctrl-del isn't recognized, too.

Since only basic services are running in rescue mode, those control
commands won't work. Also, since it's in single-user mode, there's
only one console and the other virtual consoles aren't available.
Last, but not least, since it's not graphical, it won't do anything
until you do something.

This is a somewhat old page, but it provides some possibly useful
runlevel information:

https://askubuntu.com/questions/788323/how-do-i-change-the-runlevel-on-systemd

This is a more modern page that I just took a quick look at, but it
got me to the man page and you might find other parts of it useful:

https://linuxconfig.org/how-to-boot-ubuntu-18-04-into-emergency-and-rescue-mode

>I need to do a hard reset.

This page gives a quick overview of runlevels and suggests that the
telinit command can be used to change runlevels while the system is
running:

https://www.tldp.org/LDP/sag/html/run-levels-intro.html

A quick look at the telinit man page shows that: "Since the concept
of SysV runlevels is obsolete the runlevel requests will be
transparently translated into systemd unit activation requests."

As a result, once you're in rescue mode like you were above, you
should be able to type telinit 0 (that's telinit followed by a zero)
to shut down the computer for your hard reset.

I would think that, as an alternative, you could simply turn off the
computer while in rescue mode, but I don't have a full understanding
of rescue mode and don't know whether a hard shut-down could do harm
to the file system. Hopefully someone else in here who's familiar with
this will chime in.

As a final note, one other set of alternatives I keep in my back
pocket for emergencies are REISUB and REISUO. I've used those when all
else failed and I couldn't reboot or shut down from the GUI. For a
soft reset, I would slowly type REISUB while holding down the Alt +
Shift + SysRq keys to reboot the computer. For a hard reset, I would
slowly type REISUO while holding down the Alt + Shift + SysRq keys to
shut the computer off.  I'm not sure if either of those would be
useful in your circumstances, but you might want to make a note of
them as something to try in the future. More information on those is
here:

https://en.wikipedia.org/wiki/Magic_SysRq_key

-- 
Little Girl

There is no spoon.




More information about the ubuntu-users mailing list