"askfirst" getty with systemd ("press enter to activate this console")

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.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

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 [email protected]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 [email protected] at a local unit file of one’s own devising instead of at [email protected].

Further reading

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply