Bug 1884695

Summary: make hostname in agetty(1) prompt optional
Product: Red Hat Enterprise Linux 7 Reporter: Paulo Andrade <pandrade>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: POST --- QA Contact: Radka Brychtova <rskvaril>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.7CC: amepatil
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paulo Andrade 2020-10-02 17:24:49 UTC
This issue is similar to previously reported issue at
https://bugzilla.redhat.com/show_bug.cgi?id=1520906
[make hostname in login(1) prompt optional]

The problem is that to be complete, it would also require
agetty to also understand /etc/login.defs LOGIN_PLAIN_PROMPT
value. Otherwise, it would be required some wrapper passing
--nohostname
The patch would not be so trivial, as would most likely require
a copy of login-utils/logindefs.c added to term-utils and make
agetty use it. Once added, the pseudo patch would be:

term-utils/agetty.c:
"""
 				printf(_("Hint: %s\n\n"), hint);
 		}
 	}
 #endif /* KDGKBLED */
+	if (!(op->flags & F_NOHSTNAME) &&
+ 	    (getlogindefs_bool("LOGIN_PLAIN_PROMPT", 0) == 1)
+		op->flags |= F_NOHSTNAME;
 	if ((op->flags & F_NOHOSTNAME) == 0) {
 		char *hn = xgethostname();
"""

Comment 7 Karel Zak 2022-03-18 09:55:52 UTC
Note that --nohostname is already usable for this purpose, all you need is to configure the service that systemd uses to call agetty. But yes, /etc/login.defs LOGIN_PLAIN_PROMPT sounds more elegant for end-users.

Comment 8 Karel Zak 2022-03-30 09:20:49 UTC
Implemented in upstream tree: https://github.com/util-linux/util-linux/commit/556925fe4e63719756ce32c904e887d89d81f5b9

... but  I don't think this is something we can (and want) backport to RHEL-7 or RHEL-8, maybe we can try it later for RHEL-9.1 or so.