Bug 202127

Summary: Initial (first) login response is slow/delayed
Product: Base System Reporter: s00pern00ber <are.engebraaten>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Many People CC: bcr, emaste, jilles
Priority: --- Keywords: needs-qa
Version: 10.1-RELEASE   
Hardware: i386   
OS: Any   

Description s00pern00ber 2015-08-06 12:42:59 UTC
Immediately after boot (without x) there is a "Login:" prompt. If I write my username, return and start typing my password directly, part of it will show and not get registered as part of the password.

For example, I can easily type "asdf[RETURN]asdf[RETURN]" before "Password:" comes up.

My machine is just a cheap old testmachine, 2Ghz T61 Thinkpad, but still this kind of thing should be doable much faster than I can type one character.

Btw, after one attempt at login the speed is quite fast enough that I cannot do this anymore.

A random guy on IRC said he had the same issue, which leads me to think this is universal.
Comment 1 s00pern00ber 2015-08-06 13:10:23 UTC
Output of uname -a

FreeBSD  10.1-RELEASE-p16 FreeBSD 10.1-RELEASE-p16 #0: Tue Jul 28 11:41:12 UTC 2015     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
Comment 2 Jilles Tjoelker freebsd_committer 2015-08-10 21:18:07 UTC
In the general case this cannot be solved because the password prompt needs different code and data and may therefore require things to be paged in (slowly). When utilities like su and sudo are also considered, the user will have to wait for Password: before typing their password.

In particular, whether the password prompt is displayed at all and how it looks like depends on the passwd file (empty password = no prompt, logs in immediately) and the PAM configuration (e.g. showing OTP sequence number). What's more, the initial login: prompt on ttyv* uses getty(8) and the password prompt (if any) comes from login(1), so even more code needs to be loaded for the password prompt to show.

It may be possible to modify the protocol between getty(8) and login(1) to start without echo tty mode, so that too early password characters are at least very unlikely to show up. login(1) will have to skip some tty flushes and enable echo mode later on.