Remix.run Logo
JdeBP 4 days ago

Yes, this is a bodge. And yes, it should be unnecessary to jam in an inhibitor lock taken around the lifetime of an interactive shell permanently in the background.

The author wants xyr system to not suspend either when there's someone active on the GUI or when xe is logged in over the network. Theoretically, systemd already has a whole mechanism for making this happen.

The pam_systemd.so hook into PAM allows systemd-logind to track SSH sessions in its replacement for the Unix login database — all of that stuff under /run/systemd/users/, /run/systemd/seats/, and /run/systemd/sessions/. And in theory systemd-logind could respond negatively to a suspend request if there is an active SSH login session even if the GUI is idle.

In practice, it does not quite have the logic for achieving this. It's close, but it does not pass around enough information for this to be done as, say, a PolicyKit rule.

* https://github.com/systemd/systemd/blob/main/src/login/login...

* https://github.com/systemd/systemd/blob/main/src/login/login...