2

On a Debian Jessie system with systemd, how can I configure the terminals so that a message like Press enter to activate this console is displayed and the login prompt does not appear before hitting enter?

With inittab this could be done by configuring askfirst, but how to do it with systemd?

If possible I'd prefer to adjust appropriate config files rather than messing with existing systemd unit files directly - just like there is logind.conf but unfortunately that config file won't help in this case AFAIK.

Udo G
  • 1,123
  • If I remember correctly it has something to do with copying the correct service file from ´/lib/systemd/system/´ into a .target.wants file at´/etc/systemd/system/´ and editing it. But I can't tell you very much about it, I was just following some tutorial, maybe I can find it again… – phk Oct 18 '15 at 00:26
  • Sure, that tutorial would be interesting to read – Udo G Oct 18 '15 at 07:38

1 Answers1

2

With /etc/inittab this could be done by configuring askfirst

Actually, it could not. That's a BusyBox init mechanism that doesn't exist in the Linux System 5 init clone, one of several ways in which their /etc/inittab configuration files are not the same things.

The way to do similar things on a systemd Linux operating system depends from what one is actually doing. One doesn't necessarily employ it solely for interactive terminal log-on, although you clearly are here.

One common use of askfirst is simply for not having the getty+login system running for unused virtual terminals. systemd doesn't need a non-default setting for this. With systemd, the logind service as packaged already arranges to only start autovt@N.service services on demand, when virtual terminals are switched to the foreground. Terminal login isn't run on virtual terminals that haven't been switched to (and that are not the first or the "reserved" virtual terminals).

The slightly different semantics, of not starting the getty+login system until one has switched to the virtual terminal and pressed enter, are slightly harder to achieve, as they involve either switching on a getty option or interposing a program that prints out a message and waits for a line of input before chaining to getty.

Only a few getty programs have such options, such as Peter Orbaek's agetty which has --wait-cr. Most (like Felix von Leitner's fgetty and Florian La Roche's mingetty) have not. The remainder (such as Gert Doering's mgetty) are ones that expect modems and all of their accompaniments — which of course virtual terminals do not have and which make adapting them to virtual terminal use somewhat tricky.

The chain-loading equivalent to --wait-cr on a virtual terminal, a simple program that prints a message, then reads a line from the terminal (in canonical mode), and then chain loads, is a fairly simple program.

Employing such options, employing different getty programs, or interposing utility chain-loading programs "before" getty, all involve either writing one or more unit file override files under /etc/systemd/system with systemctl edit (changing the ExecStart setting) or simply pointing autovt@.service at a local unit file of one's own devising instead of at getty@.service.

Further reading

JdeBP
  • 68,745