2

I have a Debian Jessie build, and I want to add keyboard shutdown. I've tried the following, without any success:

Attempt 1

To /etc/inittab I added

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

I also tried

ca::ctrlaltdel:/sbin/shutdown -t1 -a -r now

Then I tried to create a file /etc/init/control-alt-delete.conf and added:

start on control-alt-delete    
exec /sbin/shutdown -h now "Control-Alt-Delete pressed"

Attempt 2

I also, installed kbd and to rc.local added:

loadkeys << EOF
alt keycode 103 = KeyboardSignal
EOF

And to /etc/inittab added:

kb::kbrequest:/sbin/shutdown -h now

Again nothing.

Attempt 3 To /etc/kbd/default.map.gz, I added

keycode 111 = Select
        altgr   control keycode 111 = KeyboardSignal
        control alt     keycode 111 = KeyboardSignal

And to /etc/inittab I added

kb:12345:kbrequest:/sbin/shutdown -t1 -h now

I've had no success with any of these attempts. I obviously restarted after each attempt.

My ultimate goal is to allow reboot from the login prompt page when you use console without GUI

Help is appreciated

1 Answer 1

1

sysvinit is deprecated in favor of systemd in Debian jessie. So you cannot change the system's behavior by editing /etc/inittab or /etc/init/*.conf.

When user presses Ctrl+Alt+DEL on the console, systemd invokes /lib/systemd/system/ctrl-alt-del.target which is by default a symlink to reboot.target in the same directory, that results in a simple reboot.

You can override that behavior by creating /etc/systemd/system/ctrl-alt-del.target. If you want to shut down and power off the system, make a symlink to poweroff.target:

ln -f /lib/systemd/system/poweroff.target /etc/systemd/system/ctrl-alt-del.target

See systemd's manual about special targets mentioned above.

1
  • That's fantastic thank you. Is it possible to change the keyboard shortcut from Ctrl+Alt+Del to something else? Or is that keyboard shortcut hardwired?
    – Kousha
    Feb 8, 2016 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.