]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: clarify nologin message and skip login wait under --chroot
authorMatt Van Horn <455140+mvanhorn@users.noreply.github.com>
Sat, 4 Jul 2026 03:48:16 +0000 (20:48 -0700)
committerMatt Van Horn <455140+mvanhorn@users.noreply.github.com>
Sat, 4 Jul 2026 03:48:16 +0000 (20:48 -0700)
Address review notes from Karel: reword DEFAULT_NOLOGIN_MESSAGE so it
tells the user a keypress re-checks for the login program, and skip
wait_for_login_program() when --chroot is used since the path check
would test the wrong root. Update the man page accordingly.

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
agetty-cmd/agetty.c
term-utils/agetty.8.adoc

index 65d1dde0c330361f5adaf79e652263250fd0c437..8974a9af7420c33dd2d18d577108b5291bc8f489 100644 (file)
@@ -47,7 +47,7 @@ static int inotify_fd = AGETTY_RELOAD_FDNONE;
        (((opt)->flags & (F_VCONSOLE|(flag))) == (flag))
 
 /* Default banner printed when the login program is not available. */
-#define DEFAULT_NOLOGIN_MESSAGE        N_("This system does not permit logins.")
+#define DEFAULT_NOLOGIN_MESSAGE        N_("Login is currently unavailable. Press any key to check again.")
 
 static int wait_for_term_input(struct agetty_issue *ie, int fd);
 static void wait_for_login_program(struct agetty_options *op);
@@ -556,7 +556,8 @@ int main(int argc, char **argv)
         * log in.  Show a banner and wait until it becomes available instead of
         * prompting for a username that can never be used.
         */
-       wait_for_login_program(&options);
+       if (!options.chroot)
+               wait_for_login_program(&options);
 
        if (options.autolog) {
                debug("doing auto login\n");
@@ -643,7 +644,7 @@ int main(int argc, char **argv)
  * On systems without a shell or /bin/login there is no point in showing the
  * issue file and prompting for a username, because the login program can never
  * be executed.  Instead of running into a confusing dead end, print a short
- * banner and wait for the user to press Enter, then re-check whether the login
+ * banner and wait for the user to press any key, then re-check whether the login
  * program has become available (for example because an administrator installed
  * it at runtime).  As soon as the login program is executable we return and the
  * normal prompt flow continues.
@@ -657,7 +658,7 @@ static void wait_for_login_program(struct agetty_options *op)
                printf("%s\n", message);
                fflush(stdout);
 
-               /* Wait for Enter, then re-check the login program. */
+               /* Wait for any key, then re-check the login program. */
                if (getc(stdin) == EOF)
                        return;
        }
index 5f54821199f6d127c68fb09bc4edc88200747fa1..89e4531acb0a1c159349515e2e0386ab4b3a5cf8 100644 (file)
@@ -32,7 +32,7 @@ agetty - alternative Linux getty
 
 This program does not use the _/etc/gettydefs_ (System V) or _/etc/gettytab_ (SunOS 4) files.
 
-If the login program (by default _/bin/login_, or the program given with *--login-program*) is missing or not executable, then logging in is impossible. In that case *agetty* does not display the issue file or prompt for a login name. Instead it prints a short message ("This system does not permit logins." by default, configurable with *--nologin-message*) and waits for the user to press Enter. On Enter it re-checks whether the login program has become available, for example because an administrator installed it at runtime, and either continues with the normal prompt or shows the message again.
+If the login program (by default _/bin/login_, or the program given with *--login-program*) is missing or not executable, then logging in is impossible. In that case *agetty* does not display the issue file or prompt for a login name. Instead it prints a short message ("Login is currently unavailable. Press any key to check again." by default, configurable with *--nologin-message*) and waits for the user to press a key. It then re-checks whether the login program has become available, for example because an administrator installed it at runtime, and either continues with the normal prompt or shows the message again. This pre-check is skipped when *--chroot* is used, because the login program path is resolved after changing root.
 
 == ARGUMENTS
 
@@ -171,7 +171,7 @@ This option specifies additional characters that should be interpreted as a back
 This option specifies additional characters that should be interpreted as a kill ("ignore all previous characters") when the user types the login name. The default additional 'kill' has been '@', but since util-linux 2.23 no additional kill characters are enabled by default.
 
 *--nologin-message* _string_::
-Use _string_ as the message that is shown when the login program is missing or not executable, instead of the default "This system does not permit logins." See the *DESCRIPTION* above for details about this behavior.
+Use _string_ as the message that is shown when the login program is missing or not executable, instead of the default "Login is currently unavailable. Press any key to check again." See the *DESCRIPTION* above for details about this behavior.
 
 *--chdir* _directory_::
 Change directory before the login.