[systemd-devel] nspawn: No Return key in machinectl login?

Tobias Hunger tobias.hunger at gmail.com
Sat Jul 11 16:32:24 PDT 2015


Hello again!

I just made some progress: I tracked this down to agetty settings in
the container:

When I add "--autologin USER" to the agetty command line in
container-getty at .service, then the return key stops working.

I am not 100% sure, but I think that is due to magic in agetty: When
reading the username it does try to detect parity and other things,
incl. what the return key actually is. Autologin prevent thats magic
from happening by stopping agetty from asking for a username.

The magic is implemented inside the get_logname function (detection
part) and then termio_final function of term-utils/agetty.c in
util-linux. Apparently there is no command line option to set this, so
I am stuck and probably need to disable autologin again:-/

Does access to a console in a container really need to go through some
simulated serial line where both sides need to build agreement on
things like parity of the bytes sent back and forth? It is really
surprising that this works mostly reliably! You should really consider
to add a getty to systemd that does just away with all the crap that
has been standardized decades ago anyway.

Best Regards,
Tobias


On Wed, Jun 24, 2015 at 8:30 PM, Tobias Hunger <tobias.hunger at gmail.com> wrote:
> Hi Lennart,
>
> sorry, this took a bit longer than expected, but I took the time to
> upgrade to systemd 221, so the results should be a bit closer to the
> current state than before (which was still using systemd 219).
>
> Inside container (broken shell/fish):
>
> speed 38400 baud; rows 60; columns 184; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
> eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
> rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
> min = 1; time = 0;
> -parenb -parodd -cmspar cs8 hupcl -cstopb cread -clocal -crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
> -ixon -ixoff -iuclc -ixany -imaxbel iutf8
> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
> isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop
> -echoprt -echoctl echoke
>
> Inside container (working shell/bash):
>
> speed 38400 baud; rows 60; columns 184; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
> eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
> rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
> min = 1; time = 0;
> -parenb -parodd -cmspar cs8 hupcl -cstopb cread -clocal -crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
> -ixon -ixoff -iuclc -ixany -imaxbel iutf8
> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
> isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop
> -echoprt -echoctl echoke
>
> Outside container:
>
> speed 38400 baud; rows 60; columns 184; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
> eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
> rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
> min = 1; time = 0;
> -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
> -ixon -ixoff -iuclc -ixany -imaxbel iutf8
> -opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
> -isig -icanon -iexten -echo echoe echok -echonl -noflsh -xcase -tostop
> -echoprt echoctl echoke
>
>
> Diff inside/outside:
> opost/-opost isig/-isig icanon/-icanon echo/-echo -echoctl/echoctl
>
>
> I am not 100% sure I did gather this data correctly though: Systemd
> had already brought up the machine during boot, so I just ran
> machinectl login and then did the stty commands there.
>
> I also did not log out to switch between fish and bash, I just started
> bash from fish, so I am not surprised that the results are -- to my
> untrained eye -- identical for these two cases.
>
> Running ssty -a -F /dev/pts/2 in another konsole window did produce
> some differences.
>
> It does not seem to effect the result in any way whether or not I run
> this in konsole or xterm.
>
> I got this on a laptop, so if you want to play with a machine that
> shows this behavior I can demonstrate it if that help:-)
>
> Best Regards,
> Tobias
>
>
> On Fri, Jun 19, 2015 at 10:15 AM, Tobias Hunger <tobias.hunger at gmail.com> wrote:
>> Thanks for the reply!
>>
>> I'll try to collect all requested info tonight or over the weekend.
>>
>> Best Regards,
>> Tobias
>>
>> On Thu, Jun 18, 2015 at 9:24 PM, Lennart Poettering
>> <lennart at poettering.net> wrote:
>>> On Tue, 26.05.15 21:40, Tobias Hunger (tobias.hunger at gmail.com) wrote:
>>>
>>>> This is stty -a from outside the container:
>>>>
>>>> speed 38400 baud; rows 46; columns 114; line = 0;
>>>> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?;
>>>> eol2 = M-^?; swtch = <undef>; start = ^Q;
>>>> stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
>>>> min = 1; time = 0;
>>>> -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
>>>> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl
>>>> -ixon -ixoff -iuclc ixany imaxbel -iutf8
>>>> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
>>>> isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop
>>>> -echoprt echoctl echoke
>>>>
>>>> This is stty -a inside the nspawn-container:
>>>>
>>>> speed 38400 baud; rows 46; columns 114; line = 0;
>>>> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
>>>> eol2 = <undef>; swtch = <undef>; start = ^Q;
>>>> stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
>>>> min = 1; time = 0;
>>>> -parenb -parodd -cmspar cs8 hupcl -cstopb cread -clocal -crtscts
>>>> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
>>>> -ixon -ixoff -iuclc -ixany -imaxbel iutf8
>>>> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
>>>> isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop
>>>> -echoprt -echoctl echoke
>>>>
>>>> The difference is:
>>>> eol, eol2, -icrnl -ixany -imaxbel iutf8 -iexten -echoctl
>>>
>>> Sorry for the late reply...
>>>
>>> Hmm, I think the most interesting info would actually be to see stty
>>> -a from a working instance, and from a non-working
>>> instance. I.e. start the container, log into it, type "stty -a" command when
>>> everything works, and when it doesn't, and let me know the diff of it.
>>>
>>> Also, right after doing the "stty -a" in the container, please run the
>>> same commands on the host, in a seperate xterm, but connect to the
>>> host side container tty using "stty -a -F /dev/pts/xyz", where
>>> /dev/pts/xyz is the pts that nspawn itself is running on.
>>>
>>> Or to explain it in more steps:
>>>
>>> a) open an xterm of some form
>>>
>>> b) type "tty" into it, and remember the pty name it responds. It
>>>    should be something like "/dev/pts/xyz".
>>>
>>> c) now run systemd-nspawn inside the xterm, and login there, then type
>>>    "stty -a" in it, and save the output that command generated
>>>    somewhere.
>>>
>>> d) now, leave everything as it is now, open a second xterm. In it run
>>>    "stty -a -F /dev/pts/xyz", replacing "/dev/pts/xyz" with the pty
>>>    name from step b) and save the output somwhere.
>>>
>>> Then, close both xterms. Do these steps once for a container where
>>> things work, and once for a container where things are borked. Then
>>> let me know the diffs between the working and non-working outputs from
>>> both runs of c), as we as the diffs between the working and
>>> non-working outputs from both runs of d).
>>>
>>> Make sure you take the stty snapshots at the exact same states each
>>> time, because shells and so on tend to toggle some bits of it
>>> depending on whether they are in the fg or not...
>>>
>>> Also, it would be good, to check if different xterm implementations
>>> (gnome, kde, original xterm) behave differently.
>>>
>>> Lennart
>>>
>>> --
>>> Lennart Poettering, Red Hat


More information about the systemd-devel mailing list