Safely Reboot Linux Without SysRq/SysReq key

Distribution: Nobara 37 (based on Fedora 37)

While working out the issue with OBS Studio with Pipewire screen capture and while using the GNOME Magnifier, I was asked to use pw-top command to see what the issue is.

While keeping pw-top running in the terminal and while moving the mouse around, the computer froze and I cannot do Ctrl+Alt+F3 or Ctrl+Alt+F4. Since I have a Logitech MX Mechanical Mini Wireless keyboard that does not have SysRq assigned to any of the keys, I did some searching online and the Internet assumes that even a 60% keyboard has an SysRq key and I can imagine most of the 60%/75%/80% keyboards do not except for ten-key-less keyboards.

How do I go about safely rebooting my frozen computer without holding the power button down for 4 seconds and restarting the computer?

Back when I was running Manjaro, I enabled sshd to remote into it from my phone via termux and reboot it. Sometimes ctrl+alt+f2 would not work, but ssh would, but sometimes the system was completely frozen and had to be force rebooted.

I have a tiny portable keyboard and to access the F keys, you always need to press and hold FN key. I see you have a FN key yourself, on the right side. Press FN + esc to lock the F keys, then use ctrl + alt + f2. Or you could just press ctrl + alt + fn + f2, but it’s more awkward.

Oh, I always have my F1-F12 keys enabled without the use of Fn key. Plus, when the computer freezes, doing Ctrl+Alt+F3/F4/etc. did not work as I mentioned in my first post.

Perhaps I should try the SSH trick by using my Mac Mini to access my Linux desktop the next time the computer freezes (hopefully not). Thanks.

I’m not sure if this is what you’re looking for, but if GNOME freezes for me, I open ssh to the frozen computer from another computer, and I run:

killall -3 gnome-shell

When I run that, GNOME will restart the session, but I’ll still have my open apps and files intact.

3 Likes

So then what if you try to use SSH from a different computer, but the computer that is having issues is so slow and so unresponsive to SSH? What then? Hold down the power button and restart your computer (only as the last resort)?

Do you have any swap partition? Maybe you want to add a swap file at least. Linux bugs out when you don’t have any swap configured and slows down to a halt.

I have 32GB of RAM! I’m not sure why I would run into a problem if I don’t have a swap partition. Even if I upgrade to 64GB of RAM…

Linux doesn’t care, without swap it will just go insanely slow. It’s been a bug for ages, even if you have a lot of memory and don’t need to swap things. Just do a 2GB swap file.

sudo fallocate -l 2G /var/swapfile
sudo chmod 600 /var/swapfile
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
echo "/var/swapfile none swap sw 0 0" | sudo tee -a /etc/fstab

Well that is just great!


Thanks. I will implement it in my desktop computer.