Comment 34 for bug 876626

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 876626] Re: Unlocking the second crypto disk (/home) echos password on console

Hi James,

On Mon, Apr 23, 2012 at 07:42:08PM -0000, James Hunt wrote:
> The real problem here is plymouth: when prompting for a password, it is
> unsafe to assume the terminal it is connected to is still in the state
> it was put into when the device was first opened. The fix is to set the
> terminal to raw mode immediately prior to prompting for any password. I
> will send a fix to Plymouth upstream to accomplish this.

I'm not convinced that we should consider this a plymouth bug. I think
plymouth is right to assume that its console settings will remain
persistent, and it's upstart that's in the wrong here for changing the
settings out from underneath it. Why does upstart care about the echo flag
at all? Couldn't it simply read the existing echo flag value, and OR that
in with the rest of its preferred settings?

> A temporary workaround to the problem would be to modify the Upstart
> jobs /etc/init/cryptdisks-enable.conf and/etc/init/cryptdisks-udev.conf
> to manually disable then re-enable terminal echoing. Something like
> this:

> script

> stty -echo -icanon

> # << main part of scripts >>

> stty echo icanon

> end script

I don't think the latter part is right, because plymouth is still running at
the end of the job and still owns the console, so its preferred console
settings should still apply. (Which is part of why I think this is not a
plymouth bug.) Also this job has no 'console' line, so the stty command
would have to have its stdin attached to the console somehow... so it's
really not worth trying to deploy a quick fix here.

Looking back at the upstart history, I see this:

revno: 1266
committer: Scott James Remnant <email address hidden>
branch nick: upstart
timestamp: Wed 2010-03-17 22:34:37 +0000
message:
  * init/main.c:
    - Don't change the settings of the foreground console, this is often
      owned by plymouth and not supposed to be in Canonical Mode; all other
      paths have stty sane settings anyway (which these are not), so there
      really isn't need for init to do this. LP: #540256.

And I can't find anywhere in the history where this decision was consciously
reversed: it appears to have been a casualty of the upstream 1.3 merge onto
the Ubuntu branch.

Please consider whether we should restore the pre-1.3 Ubuntu upstart
behavior of not changing the foreground console settings, and whether this
change should be included upstream - I don't know why Scott never made this
change upstream.