Systemd SetupΒΆ

On a machine that employs systemd-logind to manage user login sessions, some setup is required for each user that will be running termy-server. This setup ensures that the user's persistent server is socket activated via the systemd user manager, and that it keeps running even when the user logs out.

Note

This setup is specific to machines on which a systemd user manager is run for each logged in user. This setup is not required for machines that only use systemd as the system manager, PID 1.

This setup consists of the following tasks:

  • systemctl --user enable termy-server.socket to enable the socket unit file
  • systemctl --user start termy-server.socket to start the socket unit file
  • loginctl enable-linger to allow services to run beyond the user logging out. This may be a privileged action that requires authentication.
  • Kill any existing persistent termy-server instance that wasn't launched via socket activation. This will destroy any terminals running on it.

Complicating the situation is the fact that these commands, particularly loginctl(1), must be run from within a fully formed systemd login session. Shells launched via sudo(8) or su(1) do not always meet this requirement, nor do terminals on an existing persistent user server (a terminal on a transient local server, however, is OK). The presence of the XDG_SESSION_ID environment variable indicates that a session exists. When in doubt, use ssh or machinectl login to log in as the user and perform the setup from there, since this always results in a clean session.

termy-server ships with an interactive setup script, termy-systemd-setup, which can be used to run the above commands. qtermy will also attempt to detect when the persistent user server is not properly set up for systemd and offer to run termy-systemd-setup within a new terminal on the transient local server.