How to force-shutdown your computer avoiding data-loss in linux

Sometimes you can have your computer blocked and you need to force-shutdown it, but this is very dangerous, so there's some tips about how to do it in the correct way:

The first, is to access to the console since your desktop is unresponsive, login on it from your user and you can proceed:

Restart your desktop

If what is blocked is your desktop (E17 and newer versions) you can try to restart it by sending a fake segfault to it:

kill -s SEGV $( pidof enlightenmnet )

It will make think your pre-deskto (enlightenment_start) that the desktop crashed and will restart it maintaining your apps opened, so this is the first thing to try

sorry, not possible in e16

Crash your entire desktop

You can try to send a force-kill signal to your desktop like:

killall -9 e16

Or you can try to restart your login manager too, but the first option should be more reliable:

sudo service lightdm restart

Force-shutdown (safe mode) your computer

You can first try to run * Ctrl Alt Del from the console to see if the computer simply reboots

If you have no way to recover your desktop, let's say if your computer is entirely unresponsive, you can trigger the magic kernel keys to force a shutdown, this combination is:

  • Alt Gr PrtScr s: This will sync your data in your hard disks (wait 10 seconds)
  • Alt Gr PrtScr u: This will remount your hard disk in read-only mode (wait 5 seconds)
  • Alt Gr PrtScr b: This will reboot, instantly

note: PrtScr is also called Imp Pt in Latin keyboards

3 Likes

That would be AltGr PrtScr on non-latin keyboards i.e the print-screen button. :smiley14:

1 Like

I don't have AltGR on any of my keyboards, which Alt is it?

The one on the right-hand side of the SpaceBar.
xev

This is the keycode with "xev"

KeyPress event, serial 39, synthetic NO, window 0x2000001,
root 0x184, subw 0x0, time 19226569, (196,-41), root:(196,262),
state 0x0, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 39, synthetic NO, window 0x2000001,
root 0x184, subw 0x0, time 19226616, (196,-41), root:(196,262),
state 0x80, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
XKeysymToKeycode returns keycode: 92
XLookupString gives 0 bytes:
XFilterEvent returns: False

1 Like

Thanks @triantares :slight_smile:

fixed :smiley:

BTW everybody is welcome to improve the howto's of the forum

different name in your keyboard? :think

I just have two Alt's.

US keyboard (i really don't want to learn the multilingual Canadian keyboards, i'm used to US and I'm sticking with it lol)