From 04d44472734d414e9d5cb557b0575e004e9aeb68 Mon Sep 17 00:00:00 2001 From: qbe Date: Thu, 18 Dec 2025 12:17:00 +0100 Subject: [PATCH] Escape TTY in systemd service (closes #889) (#890) ## What are the changes about? * fix templated systemd dependencies: %I -> %i * amend systemd-specific documentation in readme with section specific to systemd-logind / autovt ## What existing issue does this resolve? [issue #889](https://codeberg.org/fairyglade/ly/issues/889) ## Pre-requisites - [x] I have tested & confirmed the changes work locally Reviewed-on: https://codeberg.org/fairyglade/ly/pulls/890 Reviewed-by: AnErrupTion Co-authored-by: qbe Co-committed-by: qbe --- readme.md | 12 +++++++++--- res/ly@.service | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index e0308e3..b7afade 100644 --- a/readme.md +++ b/readme.md @@ -121,9 +121,15 @@ that Ly will run on, otherwise bad things will happen. For example, to disable ` # systemctl disable getty@tty2.service ``` -You can change the TTY Ly will run on by editing the corresponding -service file for your platform, or on systemd, by enabling the service on -different TTYs, as is done above. +On platforms that use systemd-logind to dynamically start `autovt@.service` instances when the switch to a new tty occurs, any ly instances for ttys *except the default tty* need to be enabled using a different mechanism: To autostart ly on switch to `tty2`, do not enable any `ly` unit directly, instead symlink `autovt@tty2.service` to `ly@tty2.service` within `/usr/lib/systemd/system/` (analogous for every other tty you want to enable ly on). + +The target of the symlink, `ly@ttyN.service`, does not actually exist, but systemd nevertheless recognizes that the instanciation of `autovt@.service` with `%I` equal to `ttyN` now points to an instanciation of `ly@.service` with `%I` set to `ttyN`. + +Compare to `man 5 logind.conf`, especially regarding the `NAutoVTs=` and `ReserveVT=` parameters. + + +On non-systemd systems, you can change the TTY Ly will run on by editing the corresponding +service file for your platform. ### OpenRC diff --git a/res/ly@.service b/res/ly@.service index 21d20df..54d8bf6 100644 --- a/res/ly@.service +++ b/res/ly@.service @@ -1,8 +1,8 @@ [Unit] Description=TUI display manager After=systemd-user-sessions.service plymouth-quit-wait.service -After=getty@%I.service -Conflicts=getty@%I.service +After=getty@%i.service +Conflicts=getty@%i.service [Service] Type=idle