[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Ctrl-Alt-Del in systemd

On Fri 14 Feb 2014 at 18:23:14 +0100, Siard wrote:

> Using the console, I used to switch off my PC with Ctrl-Alt-Del.
> For that to work, I had these lines in /etc/inittab:
> # What to do when CTRL-ALT-DEL is pressed.
> ca:12345:ctrlaltdel:/sbin/poweroff

systemd doesn't use inittab (it's a sysvinit file).

> It was the easiest way to switch off the machine that I knew of.
> Now is there something similar with systemd?
> Ctrl-Alt-Del appears to reboot the machine now.

/lib/systemd/system/ctrl-alt-del.target is linked to reboot.target in
the same directory. It requires systemd-reboot.service which contains
the line

   ExecStart=/bin/systemctl --force reboot

Changing 'reboot' to 'poweroff' will get you what you want.

However, this is the wrong thing to do (but is useful for testing the
idea) because your changes will disappear at upgrade time [1], so you
should think in terms of how your own file(s) in /etc/systemd could
achieve the same objective.

[1] The file could be diverted.

Reply to: