By default, systemd
auto-launches getty
on each VT except VT7. What I would like is for systemd
to launch top
on VT6 instead of getty
. Any idea how I configure it to do that?

- 56,709
- 26
- 150
- 232

- 5,934
2 Answers
I don't think you can do it on tty6
because:
tty6 is especially reserved for auto-spawned gettys and unavailable to other subsystems such as X[3]. This is done in order to ensure that there's always a way to get a text login, even if due to fast user switching X took possession of more than 5 VTs.
For more info you can check here.
But you can try this on tty5
for example. You can create following service (testo.service or whatever you decide) in /lib/systemd/system/
on most distributions but in openSUSE
I think it is /usr/lib/systemd/system
:
[Unit]
Description=top on tty5
[Service]
Type=simple
ExecStart=/usr/bin/top
ExecStop=/bin/kill -HUP ${MAINPID}
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/tty5
Restart=always
RestartSec=2
[Install]
WantedBy=getty.target
And then:
systemctl enable testo.service

- 9,275
-
-
1You've missed the part where you tell
logind
not to attempt to startautovt@tty5.service
or you tell systemd that this is (an alias for)getty@tty5.service
. Also note that if all that one wants to do is changeExecStart
for one specific instance of the template unit, there's another way to do that. – JdeBP Jun 23 '15 at 21:07 -
@JdeBP i've tested on debian an it worked as expected without additional configuration. Could you elaborate on this so we can improve this answer? – taliezin Jun 23 '15 at 21:14
-
-
https://wiki.archlinux.org/index.php/Automatic_login_to_virtual_console for the second part.
logind
tries to check to ensure that the virtual terminal isn't already in use, but there's a very small window where this can potentially race with another service, depending from exactly how one activates things. But the alias is definitely necessary if one has, say, explicitly instantiated agetty@tty5.service
or followed something like https://fedoraproject.org/wiki/Systemd#How_do_I_set_automatic_login_on_a_virtual_console_terminal.3F . – JdeBP Jun 23 '15 at 21:42 -
@JdeBP The systemd documentation says it only tries to auto-launch
getty
if the terminal is otherwise unused. Presumably startingtop
prevents the auto-launch ofgetty
. Works on my OpenSUSE box. – MathematicalOrchid Jun 24 '15 at 08:07
What he is trying to do is: have a "top" always available on vt6. Seems like a reasonable goal to me.
The configuration vor the login gettys on the vt's are in
/etc/systemd/logind.conf
Here you can restrict systemd on the usage of login-vt's.
What i don't know at the moment is, how the "inittab" functionallity is handled by current distros. "inittab" is where you would have put such a process ...
Maybe this helps? Best regards, gerhard

- 2,188
getty
. – MathematicalOrchid Jun 23 '15 at 09:33