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?
Linux SaK kills all processes which have the current tty open.
systemd-logind appears to open all active ttys.
You can verify this using
- 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.
gnome-shell if you use a GNOME Wayland session).