1

Some times when my laptop wakes up from standby or hibernation the screen backlight won't turn on and I can barely see anything in a dark room and just can't see anything when I'm outdoors.

The only solution is to power the computer off, remove the battery, then put it back and turn it back on. Even just turning it off and on again (normal full cold reset but without complete unpowering by removing the battery) won't help – the screen backlight will still be off and even the BIOS start-up sequence and the GRUB menu will be shown on the dark screen. This suggests that the problem is probably not a driver problem.

As for now I power it off the cold way by holding the power button for 5 seconds, but, needless to say, this is hardly a good thing to do on a regular basis.

I'd like to set up a keyboard shortcut that would trigger unconditional though soft (with all the apps notified and given time to exit gracefully and all the file systems unmounted correctly) shutdown sequence no matter what.

How can this be done?

I use Xubuntu 15.10, but I believe this is done on lower, distribution agnostic level, so I have decided to ask here rather than on AskUbuntu.

UPDATE: I've got an idea of a solution – far not as convenient as I want, but still an option – disable the GRUB default choice timeout, then when, when needed, press Ctrl+Alt+F1 to switch to the console, press Ctrl+Alt+Delete to reboot, and then power the computer off after giving it some time to restart to GRUB. I just wish there were a shortcut like Ctrl+Alt+Delete that would turn the computer off rather than reboot it.

5
  • will you be in some type of lock screen when you want to trigger?
    – meuh
    Jul 21, 2016 at 18:28
  • @meuh Yes, x-screensaver. I'd also like it to work with Unity and other lock screen and session managers if possible (but not necessarily). That's why I say it is to trigger an unconditional, system-level shutdown sequence.
    – Ivan
    Jul 21, 2016 at 18:55
  • an easy answer might be to re-enable ctrl-alt-backspace which usually exits the X11 server. That might get you back to some xdm manager that you might be able to run in a one-shot mode, exiting to shutdown. Or be programmable to accept a 2nd ctrl-alt-backspace to shutdown. Other possibilities are xbindkeys, but I doubt it will bypass a lock screen. So we are left with acpi and systemd. Is systemd configured? By default the power button is supposed to do poweroff with systemd (/etc/systemd/login.conf).
    – meuh
    Jul 21, 2016 at 19:28
  • I imagine you can press poweroff for 5 seconds from the grub menu without risking any disk corruption.
    – meuh
    Jul 21, 2016 at 19:48
  • It shouldn't be at all difficult to configure the system such that momentarily pressing the power button initiates a clean shutdown of the computer. Would that be an acceptable solution to you, or are you dead-set on a keyboard shortcut? That said, it shouldn't be too difficult to reconfigure init (systemd?) to shut down instead of reboot on Ctrl+Alt+Del...
    – user
    Jul 21, 2016 at 20:00

2 Answers 2

2

The Magic SysRq key is meant for situations like this.

[The Magic SysRq key] is a 'magical' key combo you can hit which the kernel will respond to regardless of whatever else it is doing, unless it is completely locked up.

Note that support has to be compiled into the kernel for it to work. This is a slightly better solution because it works even if all TTYs are hanging, as long as the kernel is still responsive.

On my laptop, you can trigger it by entering Right Alt+PrtScr+Magic key.

The magic keys you want are probably REISUO, pressing them one after another, waiting a few seconds in between each press.

'r' - Turns off keyboard raw mode and sets it to XLATE.
'e' - Send a SIGTERM to all processes, except for init.
'i' - Send a SIGKILL to all processes, except for init.
's' - Will attempt to sync all mounted filesystems.
'u' - Will attempt to remount all mounted filesystems read-only.
'o' - Will shut your system off (if configured and supported).


I personally feel that Ctrl+Alt+Del produces a shutdown that is more graceful. In addition to your current solution, once you are certain that you are at the GRUB prompt, press c and enter halt followed by Enter to gracefully power off.

Alternatively, add a custom entry to GRUB that runs halt, then just mash the down arrow a few times and press enter.


You mentioned that you have uncleanly powered off a few times, you may want to force a file system check on the next boot.

0

The behavior on pressing Ctrl+Alt+Delete is configurable. When you press this key combination, the kernel sends a SIGINT signal to process 1 (init), so it's up to init to decide.

With systemd, SIGINT starts the ctrl-alt-del.target unit. By default /lib/systemd/system/ctrl-alt-del.target is a symbolic link to reboot.target. Create a symbolic link /etc/systemd/system/ctrl-alt-del.target that links to /lib/systemd/system/shutdown.target instead (don't modify the link under /lib as it would be overwritten on an upgrade). See https://askubuntu.com/questions/659267/how-do-i-override-or-configure-systemd-services for a more detailed procedure to configure systemd targets on Ubuntu.

1
  • you want poweroff.target. Running shutdown.target should kill all your services (gdm, getty's, logind...) but not actually power off the system, which is generally undesirable. Hopefully it would be prevented by the RefuseManualStart=yes though.
    – sourcejedi
    Jul 31, 2017 at 15:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .