Hello.<br><br>    I am experimenting with LXC via libvirt on my Gentoo development system.  I can start the LXC domain and connect to its console.  However, I am unable to login as root.  I've used "chroot" and "passwd" from the host system to explicitly set the root password.  Still no luck.  So I began debugging....<br>
<br>    I ran "strace" on the container's "login" process (after agetty exec'd login).  I noticed that it was unable to open "/dev/log".  Sure enough the unix domain socket did not exist inside the container (as seen from outside the container).  So I tweaked my host's syslog-ng.conf file to create this socket.  My hope was to monitor the log events generated by the login process.  So the log device certainly exists (and it tests ok with the 'logger' command):<br>
<br>   The LXC file-system was created with the "lxc-gentoo" script (<a href="http://lxc-gentoo.sourceforge.net/">http://lxc-gentoo.sourceforge.net/</a>).  The only changes that I've made to the container's file system is to change roots' password ($rootfs/etc/shadow) and configure syslog-ng to create a logging socket at $rootfs/dev/log.<br>
<br>    I've even edit "$rootfs/etc/shadow" and completely removed root's password hash.  I still can't log into the account from "virsh console".  I thought that maybe I was unable to authenticate because the "login" process cannot log success/failure to /dev/log.  However, I know from experience that on other Gentoo systems I can login as root even when syslog-ng is kaput, and /dev/log does not exist.<br>
<br>   "/etc/pam.d" inside the container is byte-for-byte the same as my 
host system, and I can authenticate as root from the physical console.<br><br>   I have a few main questions:<br><br>1) Is my domain configured correctly?<br><br>2) Why is the container unable to write to the "/dev/log" provided from outside the container?<br>
<br>3) Why am I unable to authenticate as the "root" user?<br><br>   Thank you for your time.<br><br><br>ostara ~ # virsh -c lxc:/// start dwj-lnx-dev<br>Domain dwj-lnx-dev started<br><br>ostara ~ # virsh -c lxc:/// console dwj-lnx-dev<br>
Connected to domain dwj-lnx-dev<br>Escape character is ^]<br>INIT: version 2.88 booting<br><br>Gentoo Linux; <a href="http://www.gentoo.org/">http://www.gentoo.org/</a><br> Copyright 1999-2009 Gentoo Foundation; Distributed under the GPLv2<br>
<br>Press I to enter interactive boot mode<br><br> * Skipping mount of /proc as it's already mounted<br> * Skipping mount of /sys as it's already mounted<br> * Using existing device nodes in /dev ...                                [ ok ]<br>
 * Skipping mount of /dev/pts as it's already mounted<br> * Remounting root filesystem read-only ...<br>mount: / is busy                                                          [ !! ]<br> * Skipping root filesystem check (fstab's passno == 0) ...               [ ok ]<br>
 * Checking all filesystems ...                                           [ ok ]<br> * Mounting local filesystems ...<br>mount: mount point /dev/shm does not exist<br> * Some local filesystem failed to mount                                  [ !! ]<br>
 * Mounting USB device filesystem (usbfs) ...                             [ ok ]<br> * Activating (possible) swap ...                                         [ ok ]<br> * Setting system clock using the hardware clock [UTC] ...                [ ok ]<br>
 * Configuring kernel parameters ...<br>error: "Read-only file system" setting key "net.ipv4.conf.default.rp_filter"<br>error: "Read-only file system" setting key "net.ipv4.conf.all.rp_filter"  [ ok ]<br>
 * Cleaning /var/lock, /var/run ...                                       [ ok ]<br> * Wiping /tmp directory ...                                              [ ok ]<br> * Starting lo<br> *   Bringing up lo<br> *     <a href="http://127.0.0.1/8">127.0.0.1/8</a>                                                        [ ok ]<br>
 *   Adding routes<br> *     <a href="http://127.0.0.0/8">127.0.0.0/8</a> ...                                                    [ ok ]<br>INIT: Entering runlevel: 3<br> * Starting eth0<br> *   Bringing up eth0<br> *     192.168.2.199                                                      [ ok ]<br>
 *   Adding routes<br> *     default via 192.168.2.1 ...                                        [ ok ]<br> * Mounting network filesystems ...                                       [ ok ]<br>/lib64/rcscripts/sh/rc-services.sh: line 412: /etc/init.d/udev-postmount: Permission denied<br>
 * Starting local ...                                                     [ ok ]<br><br><br>This is ostara.unknown_domain (Linux x86_64 3.2.12-gentoo) 23:06:09<br><br>ostara login:<br><br><br>ostara ~ # virsh -c lxc:/// version<br>
Compiled against library: libvir 0.9.11<br>Using library: libvir 0.9.11<br>Using API: LXC 0.9.11<br>Running hypervisor: LXC 3.2.12<br><br>ostara ~ # ls -l /vm/lxc/dwj-lnx-dev/dev/log<br>srw-rw-rw- 1 root root 0 May 14 17:31 /vm/lxc/dwj-lnx-dev/dev/log<br>
<br>ostara ~ # logger -s /vm/lxc/dwj-lnx-dev/dev/log "CAPYBARA"<br>djenkins: /vm/lxc/dwj-lnx-dev/dev/log CAPYBARA<br><br>ostara ~ # tail -n 100 /var/log/messages | grep CAPYBARA<br>May 14 17:58:57 localhost djenkins: /vm/lxc/dwj-lnx-dev/dev/log CAPYBARA<br>
<br><br>(lots of strace setup omitted):<br>Buried about 60% down in the strace output is the attempt by "login" 
inside the container to access "/dev/log", which failed (ENOENT).<br>
<br>open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3<br>lseek(3, 0, SEEK_CUR)                   = 0<br>fstat(3, {st_mode=S_IFREG|0644, st_size=720, ...}) = 0<br>mmap(NULL, 720, PROT_READ, MAP_SHARED, 3, 0) = 0x7fc6ccb66000<br>
lseek(3, 720, SEEK_SET)                 = 720<br>munmap(0x7fc6ccb66000, 720)             = 0<br>close(3)                                = 0<br>time([1337035715])                      = 1337035715<br>socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3<br>
connect(3, {sa_family=AF_FILE, path="/dev/log"}, 110) = -1 ENOENT (No such file or directory)<br>close(3)                                = 0<br>fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0<br>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc6ccb66000<br>write(1, "\n", 1)                       = 1<br>write(1, "Login incorrect\n", 16)       = 16<br>time(NULL)                              = 1337035715<br>
<br>This is my domain config:<br>ostara ~ # virsh -c lxc:/// dumpxml dwj-lnx-dev<br><domain type='lxc'><br>  <name>dwj-lnx-dev</name><br>  <uuid>fbcd8c3a-9939-12b4-727d-5d3526bc448f</uuid><br>
  <memory unit='KiB'>500000</memory><br>  <currentMemory unit='KiB'>500000</currentMemory><br>  <vcpu>2</vcpu><br>  <os><br>    <type arch='x86_64'>exe</type><br>
    <init>/sbin/init</init><br>  </os><br>  <clock offset='utc'/><br>  <on_poweroff>destroy</on_poweroff><br>  <on_reboot>restart</on_reboot><br>  <on_crash>destroy</on_crash><br>
  <devices><br>    <emulator>/usr/libexec/libvirt_lxc</emulator><br>    <filesystem type='mount' accessmode='passthrough'><br>      <source dir='/vm/lxc/dwj-lnx-dev'/><br>
      <target dir='/'/><br>    </filesystem><br>    <interface type='bridge'><br>      <mac address='52:54:00:3e:d9:7c'/><br>      <source bridge='br0'/><br>    </interface><br>
    <console type='pty'><br>      <target type='lxc' port='0'/><br>    </console><br>  </devices><br></domain><br><br><br>