You are not logged in.

#1 2025-12-12 00:59:42

phoenix324
Member
Registered: 2023-08-23
Posts: 102

[Solved] Multiple display/login manager on tty's

I want to run greetd on tty1, tty2 and tty3, i.e, switching to these tty's should start greetd on that tty. This is so that i can use laptop as multi-user system and leave my session on tty1 and others can access gui on tty2 - tty3 to login to there own user session.

Last edited by phoenix324 (2025-12-14 11:15:16)

Offline

#2 2025-12-12 08:16:38

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,469

Re: [Solved] Multiple display/login manager on tty's

See https://git.sr.ht/~kennylevinsen/greetd … td.service
You'll need 3 of them and adjust them for the ttys.
You can also check /usr/lib/systemd/system/getty@.service and make a greetd@.service
According to https://man.archlinux.org/man/greetd.1 it should™ be possible to run multiple instances but you might have to select --vt

Offline

#3 2025-12-12 10:20:44

phoenix324
Member
Registered: 2023-08-23
Posts: 102

Re: [Solved] Multiple display/login manager on tty's

I am still confuse, i went through all the links but it's still confusing. How can i hook greetd service to it's specific tty's ? like greetd should start on tty2 when i first switch to tty2.

Also, i see that once a tty is opened for first time, agetty remains, is there a way for tty to close its session if no user is logged into that tty?

My current understanding ->

On my system graphical target is the default target. Graphical Wants: display-manager.service and Requires multi-user.target.

display-manager is aliased to greetd. and that's how greetd is automatically started.

multi-user target has dependency on getty.target although i can't figure out where this depency is writter.

systemctl list-dependencies getty.target --reverse 

Last edited by phoenix324 (2025-12-12 10:21:13)

Offline

#4 2025-12-12 10:29:55

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,565

Re: [Solved] Multiple display/login manager on tty's

Look at the output of

$ ls -l /usr/lib/systemd/system/multi-user.target.wants

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2025-12-12 11:00:24

phoenix324
Member
Registered: 2023-08-23
Posts: 102

Re: [Solved] Multiple display/login manager on tty's

@Lone_Wolf, quiet werid.

$ systemctl cat getty.target
[Unit]
Description=Login Prompts
Documentation=man:systemd.special(7) man:systemd-getty-generator(8)
Documentation=https://0pointer.de/blog/projects/serial-console.html

Only constains this, i thought dependencies were not hard coded, i.e, here just linked using file and instead were mentioned in unit either as Requires/Wants or WantedBy/RequiredBy

I am sorry, but i still can't wrap my head around how to achieve the functionaliy i am looking for, like if i create greetd-tty2, greetd-tty3 service and inside them i do ExecStart=greetd --vt <tty-number>, but how to hook this service file ? Do i use Wants/Requires or WantedBy/RequiredBy, and what there values should be.

Offline

#6 2025-12-12 11:56:01

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,565

Re: [Solved] Multiple display/login manager on tty's

$ pacman -Qo /usr/lib/systemd/system/multi-user.target.wants/getty.target 
/usr/lib/systemd/system/multi-user.target.wants/getty.target is owned by systemd 258.2-2
$ 

I looked at the systemd PKBUILD and don't see commands to create that link, so it probably is hardcoded or generated at buildtime .

[Unit]
Description=Greeter daemon
After=systemd-user-sessions.service plymouth-quit-wait.service
After=getty@tty1.service
Conflicts=getty@tty1.service

[Service]
Type=simple
ExecStart=greetd
IgnoreSIGPIPE=no
SendSIGHUP=yes
TimeoutStopSec=30s
KeyringMode=shared
Restart=always
RestartSec=1
StartLimitBurst=5
StartLimitInterval=30

[Install]
Alias=display-manager.service

greetd does depend on getty, but presents itself as a display manager.

The wiki states it can be used as a login manager and should be able to run on TTY, which is NOT graphical .

I'm inclined to advise :
disable greetd.service
configure greetd to use agreety (the text version of the greeter)
set default target to multi-user
create a symlink for greetd in /etc/systemd/system/multi-user.target.wants (might be a systemd command that does that)

Boot and verify greetd works and you can start things manually

Moderator Note
Moving to System Administration board


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#7 2025-12-12 15:43:21

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,469

Re: [Solved] Multiple display/login manager on tty's

This has nothing to do w/ the target
Either create tty-specific greetd services or one services that can take a variable (the @/%I thing)
Then enable those.

The moment getty@.service for that tty gets activated (ie. when you press ctrl+alt+f2) that greetd service will be launched.

Offline

#8 2025-12-13 01:57:40

phoenix324
Member
Registered: 2023-08-23
Posts: 102

Re: [Solved] Multiple display/login manager on tty's

This is what i came up with, but it's not working.

❯ systemctl cat greetd@.service
# /etc/systemd/system/greetd@.service
[Unit]
Description=Greetd on tty%I
After=systemd-user-sessions.service plymouth-quit-wait.service
After=getty@tty%i.service
Conflicts=getty@tty%i.service


[Service]
Type=simple
ExecStart=greetd --vt %i
IgnoreSIGPIPE=no
SendSIGHUP=yes
TimeoutStopSec=30s
KeyringMode=shared
Restart=always
RestartSec=1
StartLimitBurst=5
StartLimitInterval=30

[Install]
WantedBy=getty@tty%i.service


# /etc/systemd/system/service.d/toplevel-override.conf
[Unit]
OnFailure=failure-notification@%n
❯ ll /etc/systemd/system/getty@tty6.service.wants/
lrwxrwxrwx - root root 13 Dec 07:22 greetd@6.service -> /etc/systemd/system/greetd@.service

Offline

#9 2025-12-13 09:59:15

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,469

Re: [Solved] Multiple display/login manager on tty's

%i is escaped, use %I to be sure and then idk where that /etc/systemd/system/greetd@.service comes from but you'd be supposed to "systemct enable --now greetd@6.service and get rid of the [Install] segment resp. you probably want to keep "Alias=display-manager.service" for tty1
In doubt just have static /etc/systemd/system/greetd6.service

[Unit]
Description=Greeter daemon
After=systemd-user-sessions.service plymouth-quit-wait.service
After=getty@tty6.service
Conflicts=getty@tty6.service

[Service]
Type=simple
ExecStart=greetd --vt 6
IgnoreSIGPIPE=no
SendSIGHUP=yes
TimeoutStopSec=30s
KeyringMode=shared
Restart=always
RestartSec=1
StartLimitBurst=5
StartLimitInterval=30

Offline

#10 2025-12-14 04:44:21

phoenix324
Member
Registered: 2023-08-23
Posts: 102

Re: [Solved] Multiple display/login manager on tty's

`man 5 greetd` says to use `switch = false`. If set to false and vt is not currently active VT, greetd  will  wait for  vt  to  become  active, before doing anything including starting greeter.

But using the above, the following systemd unit is not behaving correctly.

[Unit]
Description=Greeter daemon tty 2
After=systemd-user-sessions.service plymouth-quit-wait.service
After=getty@tty2.service
Conflicts=getty@tty2.service

[Service]
Type=simple
ExecStart=greetd --vt 2
IgnoreSIGPIPE=no
SendSIGHUP=yes
TimeoutStopSec=30s
KeyringMode=shared
Restart=always
RestartSec=1
StartLimitBurst=5
StartLimitInterval=30

Only by setting `switch = true`, the above unit is working.

I will try asking on mailing list of greetd as this usecase is niche. I will update the answer if i get one there.

Offline

#11 2025-12-14 09:18:47

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,469

Re: [Solved] Multiple display/login manager on tty's

the following systemd unit is not behaving correctly

What does that mean? What do you expect and what happens?
greetd on vt2 should™ only start when you press ctrl+alt+F2 but certainly should start then.

Offline

#12 2025-12-14 09:24:01

phoenix324
Member
Registered: 2023-08-23
Posts: 102

Re: [Solved] Multiple display/login manager on tty's

What does that mean? What do you expect and what happens?
greetd on vt2 should™ only start when you press ctrl+alt+F2 but certainly should start then.

after doing, `systemctl start <unit-name>` and then switching to tty2, agetty is there. I then again tried the command by first stopping and starting the unit again, but still on tty2 agetty is there.


But if i have `switch = true`, running the unit in my tty1 hyprland session, automatically switches to tty2, and greetd is started.

Last edited by phoenix324 (2025-12-14 09:27:40)

Offline

#13 2025-12-14 09:36:50

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,469

Re: [Solved] Multiple display/login manager on tty's

Try "systemctl --enable …" and reboot.

Offline

#14 2025-12-14 09:51:27

phoenix324
Member
Registered: 2023-08-23
Posts: 102

Re: [Solved] Multiple display/login manager on tty's

Try "systemctl --enable …" and reboot.

Didn't work, I added the following to the unit file->

[Install]
WantedBy=multi-user.target

Enabled and restarted the system, switched to tty2, and agetty is there.



Two scenarios -->

1. running command  directly in terminal without systemd.
* tty5, is not active so no agetty is running there.
-- sudo greetd --vt 5
-- switch to tty5
-- agetty is there
-- switch to tty1
-- cancel the `sudo greetd --vt 5`
-- run, `sudo greetd --vt 5`
-- switch to tty5
-- greetd is now present on tty5

2. running through systemd
* tty 4 is not active so no agetty running there.
-- sudo systemctl start greetd-tty4.service
-- switch to tty4
-- agetty is there
-- switch to tty1
-- sudo systemctl stop greetd-tty4.service
-- sudo systemctl start greetd-tty4.service
-- switch to tty4
-- agetty is still there

Offline

#15 2025-12-14 09:59:44

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 71,469

Re: [Solved] Multiple display/login manager on tty's

You could try to simply mask the agetty@[2-6] services, https://wiki.archlinux.org/title/Systemd#Using_units

Offline

#16 2025-12-14 10:30:47

phoenix324
Member
Registered: 2023-08-23
Posts: 102

Re: [Solved] Multiple display/login manager on tty's

Finally it worked, but it didn't at first because it turns out  /lib/systemd/system/autovt@.service also needs to be masked out for respective tty.

I googled and couldn't find any information on autovt@.sevice. Finally the problem is solved but i still don't get the full picture and wether these still better way to do this.

Full Picture: When i do CTRL+ALT+F<number>, which service spawns agetty? is the kernel cathing the key bind and triggering the unit? which unit exactly?

Better Way: Instead of masking getty@tty<number>.service and autovt@tty<number>.service. Is not there more elegant way to do this such that i would only need one template unit ( greetd@.service) and doing systemctl enable greetd@tty<number>.service should be enough.

Offline

#17 2025-12-14 10:52:10

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,565

Re: [Solved] Multiple display/login manager on tty's

$ ls -l /usr/lib/systemd/system/autovt@.service 
lrwxrwxrwx 1 root root 14 12 dec 15:26 /usr/lib/systemd/system/autovt@.service -> getty@.service
$ pacman -Qo /usr/lib/systemd/system/autovt@.service /usr/lib/systemd/system/getty@.service 
/usr/lib/systemd/system/autovt@.service is owned by systemd 258.3-1
/usr/lib/systemd/system/getty@.service is owned by systemd 258.3-1
$ 

You may have to delve deep in systemd internals to figure out what happens.
Maybe there's a getty alternative that is more cooperative towards greetd ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#18 2025-12-14 11:14:57

phoenix324
Member
Registered: 2023-08-23
Posts: 102

Re: [Solved] Multiple display/login manager on tty's

I will try to ask in greetd mailing when i get time. For now, the current solution is good enough.

Thank you for the help.

Offline

Board footer

Powered by FluxBB