Quoting unicell (unicell(a)gmail.com):
On Fri, Nov 9, 2012 at 12:09 AM, unicell <unicell(a)gmail.com>
wrote:
> Hi,
>
> I'm trying to manage LXC instances through OpenStack, which use libvirt as
> a virtualization driver layer. After launching LXC instance, I simply could
> not attach to the console.
>
> virsh # list
> Id Name State
> ----------------------------------
> 14366 instance-00000078 running
>
> virsh # console 14366
> Connected to domain instance-00000078
> Escape character is ^]
>
>
> And it keeps stuck here.
>
> Initially I thought it could be a cgroup device config issue, and tried to
> "echo ‘c 5:1 rwm'
> >/cgroup/devices/libvirt/lxc/instance-00000078/devices.allow“, to add
> /dev/console access right to the container. But it does not work, console
> stilll not working.
>
> Before the cgroup tweaking, devices.list are as follows
>
> [root@localhost libvirt]# cat
> /cgroup/devices/libvirt/lxc/instance-0000007a/devices.list
>
> c 1:3 rwm
> c 1:5 rwm
> c 1:7 rwm
> c 1:8 rwm
> c 1:9 rwm
> c 5:0 rwm
> c 5:2 rwm
> c 136:* rwm
>
>
> I'm not quite sure what kind of issue could possibly cause this console
> access issue. Cause I'm now using two different guest OS templates on two
Just a few things to help you look around:
Both lxc and libvirt-lxc provide consoles by creating a pty on the host
and bind-mounting that onto /dev/ttyN in the guest before starting init.
Ubuntu on the host passes 'container=lxc' (or 'container=libvirt') to
the container, which tells ubuntu in the container to not do some things
(look for 'container' in /etc/init/*; also things like mountall accept
that they should not do some things in containers).
You can investigate /dev/ttyN and /dev/console in your container by
looking at the pid of init in the container, and looking at
/proc/$pid/root/dev/{console,tty*}
That *should* show 136:* devices, but I assume that in the cases where
it is not working it will show 4:* for ttyN. If you look at
cat /proc/$pid/root/proc/1/mounts
I expect you'll see a /dev is mounted in the container. Which hides the
bind mounts which (libvirt-)lxc has set up.
-serge