[HowTo] reboot / turn off your frozen computer: REISUB/REISUO

If,
A = “Add to your /etc/default/grub . . .”
B = "Execute echo kernel.sysrq=1 | sudo tee --append /etc/sysctl.d/99-sysctl.conf"
C = "Execute sudo update-grub"
D = “Reboot normally”,
where do I have to put the parentheses in the ill-expressed statement of A XOR B AND C AND D? (Seriously asking).

Another part that I am not sure 100% understanding is in the key press sequences

am I supposed to press one of those Alt combinations and then release the keys other than the Alt, and with Alt key still pressed I should press the REISUB key sequences with the mentioned interval?

just restating what has to be done:

either do A
followed by C - as is always necessary when /etc/default/grub is changed and you want the change to take effect

or
do B
(create and edit the file /etc/sysctl.d/99-sysctl.conf)

D - whichever option of the two above you chose
reboot afterwards to have the changes in effect

You don’t have to reboot if you do this as well:
echo "1" > /proc/sys/kernel/sysrq
as root
This gives you the functionality immediately - but it “doesn’t stick”, doesn’t survive a reboot.
That’s what either A+C or B will do …

it’s a three key combination each time - for each individual letter
(for me - but you can test, so you know the procedure once you need it)

Each key combination does a part of the process to relatively safely reboot an unresponsive system.

Keyboard shortcuts - ArchWiki

2 Likes

You mean the complete step should be
Alt+SysRq+R wait x seconds,
Alt+SysRq+E wait x seconds,
Alt+SysRq+I wait x seconds,
Alt+SysRq+S wait x seconds,
Alt+SysRq+U wait x seconds,
Alt+SysRq+B
If so, during the x seconds waiting, can I release the three keys previously pressed?
Now, my laptop doesn’t have SysRq key, do I have to replace each instance of SysRq with one of the alternative key combinations above?

How do I test it in the normal situation, i.e. while my laptop is not frozen?

I just edited my post - there is a link at the end, explaining what I tried to convey here in few words.

… pretend it is frozen :wink:

1 Like

Thanks for the reply, it and this tutorial are really helpful.
Anyway, I am just impressed by how hidden these solution is given that the risk of not knowing it (broken filesystem due to repeated hard shutdown) can inflict the victim a deep grief. My laptop have been going frozen a couple times since using Manjaro, all of them during boot, sometimes after the GRUB OS selection but before splash screen or even before it even shows the GRUB page. When it happens, the screen is just completely blank but the keyboard keys are still lit.

If I had not had this frozen boot issue, I would not stumble upon this tutorial unless by chance, as I don’t know that the frozen boot issue exists and hard-resetting it is frowned upon (I had only used Windows or MacOS in the past and I hadn’t had this issue). So I guess, someone whose machine-LinuxOS combination happens to suffer from the frozen boot symptom is almost fated to have some small parts of his system broken due to him being forced to hard-reset, probably several times until he has a feeling that hard-reset sounds somewhat dangerous, is moved to Google it, and find a solution like this. This is only after some parts of his filesystem got corrupted, but he doesn’t know because future problems arising due to this haven’t surfaced. The point is, any plan to fix it in future updates?

@Nachlese Thanks for responding to @jawanari .

In the meantime, the tutorial has been adapted so it’s more clear as to what to do for the next person (I hope).

But you did and you did! :wink:

No! :stuck_out_tongue_winking_eye:

  1. It’s one of the reasons Linux is so blindingly fast: EXT4 is less prone to defragmentation than NTFS, but OTOH it doesn’t like running out of power.
  2. You’re talking to the wrong people to fix that, go talk to this guy

No-once forced you to do anything! Linux is not Windows, so go read this:

All of it!
:grin:

1 Like

You mean the main reason of getting stuck at boot is the power problem? And what needs to be fixed is the kernel?

Indeed, no one forced linux user to hard shutdown when his machine got stuck during boot. It is the combination of human instinct and not knowing the correct way that forces him. When we don’t know the correct emergency shutdown such as this article, what else will come to mind to regain control of our computer other than moving our finger to reach the power button.

I simplified the method for execute it, I followed the solution which I found here:

https://unix.stackexchange.com/questions/517455/is-it-possible-to-create-a-terminal-command-alias-to-automate-ctrl-alt-sysrq

Bash script:

#!/bin/sh

for c in r s u o; do
  echo $c > /proc/sysrq-trigger
  sleep 1
done

Saved as /usr/local/bin/reisuo

Inserted such script in sudoers (because only root can write to /proc/sysrq-trigger) :
my-username ALL=NOPASSWD: /usr/local/bin/reisuo

I made a keyboard shortcut in Xfce (xfce4-keyboard-settings): which execute
sudo /usr/local/bin/reisuo

Works like a charme.

EDIT: i choosed kernel.sysrq=1 for enable REISUO.

1 Like

my thoughts and criticism:
the script is missing the “e” and the “i” steps of the r e i s u o sequence
(because either the first one, but certainly the second one, would kill the script itself)
and the “o” as the last parameter might not work, as it relies on APM to shut down the system
… “b” is for reboot ( r e i s u b )

The time in between the commands (1 s) might not be enough to finish the “s” step (flush to disk) before the “u” step kicks in, unmounting all filesystems.
Essentially, the script forces a “sync” and then, after one second, an unmounting of all filesystems,
all while all processes are still running.
The “r” is not even necessary with this script (I guess, from what I understand what it does).

This is all for cases when the system is seriously hung, as in: not functioning normally …
Of course the script probably works when this is not the case …

I’d rather just remember the sequence and what action each of the characters represent and use each one when necessary and appropriate.

2 Likes

For me is ok in such way; I just reported the method which I’m using.
Anyway this script works fine here.

This is all fine and dandy as long as Xorg still runs and processes your keyboard events…
Keep in mind though: “The magic SysRq key” on the other hand is directly understood by the linux kernel and will work in situations where that keyboard shortcut will not trigger the script.

4 Likes

Yes, I am aware of this; however the combionation of fn+SysRq keys are distant on my laptop’s keyboard and I’d have to use both hands only to press them, and I have no way to digit R E I S U O/ R E I S U B at the same time. I would need a third hand :joy:

A post was split to a new topic: What is the keyboard combination for SysRq on a Thinkpad T400p?

Sorry to come back here but on my recent unbooting Manjaro, both REISUB and REISUO don’t work. I have tried any possible combination for the SysReq equivalents provided in the original post. I still have to push the power button to hard turn off. I can confirm that the SysRq has been correctly enabled by testing REISUO when I get in the system successfully - it does shut the computer off. FYI, the kind of system freeze I often experienced is that the screen stays black before even the grub’s OS selection appears.

1 Like

If your system doesn’t even reach grub, then Manjaro is not even loaded, so the key combination can’t work.

That’s what I suspect. Then the hard shutdown is safe?

I’ve got a hp laptop with a ryzen 5 and Radeon graphics.
The combo that worked for me was
alt+prt sc + r
letting go of r and prt sc and holding alt key the whole time…
then
prt sc + e
wait a few seconds
prt sc + i (graphical dropped into terminal screen here)
wait a few seconds
prt sc + s
wait a few seconds
prt sc + u
wait a few seconds
prt sc + b …computer reboots…

I did have to enable this functionality though, as described above.

Thanks for this, I really hate seeing journal messages about orphans.

Lol, I didn’t even know that manjaro had an update-grub alias, I always just did it manually same as back in arch. It’s not that long of a command anyways.

Thanks for this, I sometimes had to use the power button to force off my machine when it hung on shutdown when I couldn’t wait to see what was making it hang, it’s a good to know there’s a less cringe inducing alternative, I did not know this existed.

Just gotta find that SysRq key now

Edit: it was Alt+Print Screen, I think this is just standard for modern PCs probably (laptops included, mine is a laptop, recent too, like 2019 make maybe)

Easy way to find the right key if ur on X is to just run xev and try combinations until it tells you it’s sysrq.

@jawanari hard shutdown as you call it is not safe at all, i know someone personally who fried his PC doing it (don’t remember how exactly it broke, whether it wouldn’t get power at all (dead psu) or if it got power but didn’t POST (potentially dead cpu) just that it was fried and he bought a new one)

That is an extreme case and shouldn’t actually be possible though, but it can damage your hard drive, it will corrupt your filesystem almost guaranteed (though linux should be able to recover from that) it can also damage your SSD though i’m not sure to what extent.

Pulling the power plug though is a lot worse, a common way for people’s PCs to get fried, so definitely don’t do that either.

If your system is freezing before you even get to GRUB though, this is not a manjaro problem, it’s not a grub problem, it’s either a BIOS problem or faulty hardware problem.

Uff… I have a PhD in physics and work in science education at a university, but I hardly can even ask a specific question to address what I do not understand, cause I have fundamentally a hard time of following this tutorial. That also makes it impossible to me to provide a helpful constructive criticism of what to change to make it more legible.

I don’t have a PhD; only a BSc in chemisttry, but cannot answer your question because it’s not a question, so some tips:

  • Start reading from the first triangle
  • Click all triangles to open up their subsections
  • Keep reading without skipping anything
  • Execute all the commands you encounter
  • Feed back with specific questions each time you run into something you don’t understand
  • Your specific questions will be answered and incorporated into the tutorial if valuable to everyone and how we improve our tutorials.

:person_shrugging:

2 Likes