Bug 1884695 - make hostname in agetty(1) prompt optional
Summary: make hostname in agetty(1) prompt optional
Keywords:
Status: POST
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: util-linux
Version: 7.7
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Karel Zak
QA Contact: Radka Brychtova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-02 17:24 UTC by Paulo Andrade
Modified: 2022-08-10 09:46 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.