[lxc-users] lxc-console produces no output

Robert Pendell shinji at elite-systems.org
Fri May 9 04:18:13 UTC 2014


On Fri, May 9, 2014 at 12:12 AM, Robert Pendell
<shinji at elite-systems.org> wrote:
> On Thu, May 8, 2014 at 10:56 PM, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
>> Quoting Robert Pendell (shinji at elite-systems.org):
>>> OS: Ubuntu 14.04 LTS x86_64
>>> Kernel: Host-Supplied 3.14.1
>>> Provider: Linode
>>> Host Virtualization: Xen Paravirtualized
>>> LXC Version: 1.0.3-0ubuntu3
>>> Guest: CentOS 6 i386
>>>
>>> I know I've seen this issue crop up before however I don't know how it
>>> has been fixed and the solution may vary.
>>>
>>> I'm using a standard Centos template created using the download type.
>>> It is running in unprivileged mode and for some reason lxc-console
>>> isn't producing any output when I attempt to connect to it.
>>>
>>> Here is what I get:
>>> shinji at icarus:~$ sudo lxc-console -n gateone
>>>
>>> Connected to tty 1
>>> Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself
>>
>> Before you run lxc-console, find the host pid of the mingetty on
>> pts/1, and strace -f -p that one.
>>
>
> Heh... I tried and it keeps telling me the process id doesn't exist
> then I noticed that the pid is changing so I went into the guest and
> looked at the messages log and it is being spammed with this...
>
> May  8 23:54:17 localhost init: tty (/dev/tty1) main process (2335)
> terminated with status 1
> May  8 23:54:17 localhost init: tty (/dev/tty1) main process ended, respawning
> May  8 23:54:17 localhost /sbin/mingetty[2348]: tty1: vhangup() failed
>
> *a few minutes later*
> Found the fix.  This might have to go into the prep script for CentOS
> as it seems to happen for others as well.  It seems the folks working
> on the Oracle image figured this out.
>
> https://github.com/lxc/lxc/blob/master/templates/lxc-oracle.in
> Line 368 comments about how vhangup fails with userns.  It probably is
> related to unprivileged containers only although I have not checked
> with privileged so don't quote me on that last bit.  All I know is it
> fixed the issue for me.  Others may gain usefulness in this.
>
> Basically I edited the /etc/init/tty.conf script and added --nohangup
> to the mingetty exec command in the script.
>
> It became this: exec /sbin/mingetty $TTY --nohangup
>
> This will propagate to /dev/console as well due to the way that it is
> being created during boot (it calls the tty init using TTY=console as
> a parameter).

Adding to my last message:
https://github.com/lxc/lxc/commit/2e83f7201c5d402478b9849f0a85c62d5b9f1589
"This is needed when using the user namespace since the kernel check
does not allow user_ns root to successfully call vhangup(2), and
mingetty will quit in this case."

So it does appear to only affect unprivileged containers.


More information about the lxc-users mailing list