4

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?

4

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
  • Worked perfectly first time. Well done! – MathematicalOrchid Jun 23 '15 at 13:41
  • You've missed the part where you tell logind not to attempt to start autovt@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 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
  • @JdeBP thanks, I will read and try to edit it tomorrow. – taliezin Jun 23 '15 at 21:36
  • 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 getty@tty5.service or followed something like fedoraproject.org/wiki/… . – JdeBP Jun 23 '15 at 21:42
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.