I run Fedora Linux 28, and have enabled sysrq. I pressed Alt+PrtScr+K, to kill a non-responsive X session. But this also restarted gdm, and one other X session, which were running on different VTs. Why?

  1. Linux SaK kills all processes which have the current tty open.

    See https://elixir.bootlin.com/linux/v4.17/source/drivers/tty/tty_io.c#L2700

  2. systemd-logind appears to open all active ttys.

    You can verify this using lsof.

  3. When X is run as an unprivileged user and relies on systemd-logind, it does not handle a restart of systemd-logind. When X loses its connection to systemd-logind, it terminates itself.


So SaK can indirectly affect all VTs, if you use unprivileged X, or Wayland.

Instead, you can use Alt+PrtScr+R, then Ctrl+Alt+F6. You can log in on the text console, and manually kill processes e.g. Xorg, or gnome-shell if you use a GNOME Wayland session).

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.