[pkg-lxc-devel] Bug#907615: lxc-console not getting prompt with debian template

Alex Mestiashvili amestia at rsh2.donotuse.de
Fri Jan 11 20:21:54 GMT 2019


On 1/11/19 1:57 PM, Pierre-Elliott Bécue wrote:
> Hi Alex,
> 
> Le 11/01/2019 à 10:59, Alex Mestiashvili a écrit :
>> On 1/10/19 11:52 PM, Pierre-Elliott Bécue wrote:
>>> Hi,
>>>
>>> Le jeudi 30 août 2018 à 09:58:31+0200, Alex Mestiashvili a écrit :
>>>> Package: lxc
>>>> Version: 1:2.0.9-6
>>>> Severity: normal
>>>>
>>>>
>>>> Steps to reproduce:
>>>>
>>>> install lxc, create a container with debian template (backing store
>>>> doesn't matter in this case)
>>>>
>>>> lxc-create -n deb2 -t debian -B zfs --zfsroot=ocz/lxc
>>>>
>>>> lxc-console -n deb2 -l trace -o console_deb2.lxc.log
>>>
>>> Why using -l, which tend to ruin the interface and hence compromise the
>>> readability of the output?
>>
>> Well, -l is for the logpriority, that's why it is there. Sorry if that
>> was useless.
> 
> I'm pretty sorry if I gave you the impression that it was useless. My
> intent was more to suggest that as this output lacks sufficient intel,
> you can get rid of it. :)

No problem at all.

> 
>> I just gave it another try. And I think I narrowed down the issue with
>> the template.
> 
> With what version of lxc did you give it another try?

It's a buster installation with lxc 1:3.1.0-1:

dpkg -l | perl -lanE '/lxc/ && say $F[1],"\t",$F[2]'
liblxc1 1:3.1.0-1
lxc     1:3.1.0-1
lxc-templates   3.0.3-1
lxcfs   3.0.3-2

> 
>> When attaching to a newly created debian container (lxc-create -t
>> debian) with lxc-attach -n <container> I can see that there is only 1
>> console and no ttys are spawned:
>>
>> root at deb2:/etc# ps -ef | grep agetty
>> root        73     1  0 09:42 console  00:00:00 /sbin/agetty --noclear
>> --keep-baud console 115200,38400,9600 vt220
>>
>> While in an ubuntu template there are 1 console and 4 pts:
>>
>> ps -ef | grep agetty
>> root       102     1  0 08:58 pts/0    00:00:00 /sbin/agetty --noclear
>> --keep-baud pts/0 115200 38400 9600 vt220
>> root       103     1  0 08:58 console  00:00:00 /sbin/agetty --noclear
>> --keep-baud console 115200 38400 9600 vt220
>> root       104     1  0 08:58 pts/3    00:00:00 /sbin/agetty --noclear
>> --keep-baud pts/3 115200 38400 9600 vt220
>> root       105     1  0 08:58 pts/1    00:00:00 /sbin/agetty --noclear
>> --keep-baud pts/1 115200 38400 9600 vt220
>> root       106     1  0 08:58 pts/2    00:00:00 /sbin/agetty --noclear
>> --keep-baud pts/2 115200 38400 9600 vt220
>>
>> So my initial bug report wasn't exactly correct.
>> One can get login prompt on container created with debian template, but
>> only by calling lxc-console -n <container> -t 0
>>
>> This "-t 0" is not obvious and I can imagine some people don't know
>> about it.
>>
>> lxc and lxc-console are totally ok. It's the debian template with
>> systemd which is by default have a not optimal setup.
>> No idea how to fix that, spent some time, but lost in systemd
>> crosslinked docs.
> 
> This is interesting, but I'm surprised, I'm not meeting such an issue,
> my Debian containers work perfectly fine.
> 
> Do you get any message? Can you use trace on lxc-create and log all of
> this in a file?
> 

I've got another box with up-to-date debian buster installed.
Installed lxc with apt-get install lxc (lxc 1:3.1.0-1, lxc-templates
3.0.3-1) created a new container with this command:

lxc-create -t debian -n test1

after that started the container:

lxc-start -dn test1

tried to lxc-console to the container:

lxc-console -n test1

Connected to tty 1
Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself

Not getting prompt, however lxc-console -n test1 -t 0 does give a prompt.

lxc-attach with ps -ef:

lxc-attach -n test1
root at test1:~# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 19:54 ?        00:00:00 /sbin/init
root        36     1  0 19:54 ?        00:00:00
/lib/systemd/systemd-journald
root        76     1  0 19:54 pts/2    00:00:00 /sbin/agetty --noclear
--keep-baud console 115200,38400,9600 vt220
root        77     1  0 19:54 ?        00:00:00 /usr/sbin/sshd -D
root        79     0  0 20:06 pts/3    00:00:00 /bin/bash

So the issue is reproducible on a testing system.

When creating a container with -l trace I just get this:

lxc-create -l debug -o /tmp/lxc-create_debian.txt -t debian -n test5

cat  /tmp/lxc-create_debian.txt

lxc-create test7 20190111201044.860 DEBUG    storage -
storage/storage.c:get_storage_by_name:231 - Detected rootfs type "dir"

The same issue I observe with a sid container on another Debian buster
installation, only 1 aggety instance listening on console - t 0.

Regards,
Alex



More information about the Pkg-lxc-devel mailing list