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?
- 55,929
- 26
- 146
- 227
- 5,664
- 7
- 35
- 62
-
What evidence do you have that systemd auto-launches, why do you think this would be configurable or that you'd be able to change this into an interactive program?. And what exactly are you trying to do? – rocky Jun 23 '15 at 09:19
-
Consider, for example, this: http://unix.stackexchange.com/questions/56531/how-to-get-fewer-ttys-with-systemd which explains how to adjust the number of VTs which auto-launch `getty`. – MathematicalOrchid Jun 23 '15 at 09:33
-
Or indeed http://unix.stackexchange.com/a/194218/5132 . – JdeBP Jun 23 '15 at 21:10
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,085
- 1
- 34
- 38
-
-
1You've missed the part where you tell `logind` not to attempt to start `[email protected]` or you tell systemd that this is (an alias for) `[email protected]`. Also note that if all that one wants to do is change `ExecStart` 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 a `[email protected]` 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 starting `top` prevents the auto-launch of `getty`. 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,168
- 12
- 21