Bug 1040311 - lxc guest with operating system container can not be login with no network interface
Summary: lxc guest with operating system container can not be login with no network in...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-11 07:27 UTC by tingting zheng
Modified: 2013-12-11 10:50 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-12-11 10:40:43 UTC
Embargoed:


Attachments (Terms of Use)

Description tingting zheng 2013-12-11 07:27:15 UTC
Description
lxc guest with operating system container can not be login with no network interface

Version:
libvirt-1.1.4-2.fc21

How reproducible:
100%

Steps to Reproduce:
1. add the following yum repo
#vim /etc/yum.repos.d/yum-fedora.conf
[main]
cachedir=/var/cache/yum/$basearch/$releaseverkeepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

[fedora]
name=Fedora $releasever - $basearch failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch

[updates]
name=Fedora $releasever - $basearch - Updates failovermethod=priority
#baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/$basearch/
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
enabled=1
gpgcheck=1

2.#yum -y --nogpg --releasever=19 --config=/etc/yum.repos.d/yum-fedora.conf --installroot=/var/lib/libvirt/filesystems/f19x86_64 --disablerepo='*' --enablerepo=fedora  install  systemd passwd yum redhat-release vim-minimal openssh-server procps

3. #echo "pts/0" >> /var/lib/libvirt/filesystems/f19x86_64/etc/securetty

4. #vi /var/lib/libvirt/filesystems/f19x86_64/etc/pam.d/login
 commnent out the following lines
#session    required     pam_selinux.so close
#session    required     pam_loginuid.so

5.add root user and the passwd.
#chroot /var/lib/libvirt/filesystems/f19x86_64 /bin/passwd root

6.Prepare a xml to define a lxc guest,boot the guest,the guest can not be login with password set in step 5.
# cat test.xml
<domain type='lxc'>
  <name>test</name>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64'>exe</type>
    <init>/sbin/init</init>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/var/lib/libvirt/filesystems/f19x86_64'/>
      <target dir='/'/>
    </filesystem>
    <console type='pty'>
      <target type='lxc' port='0'/>
    </console>
  </devices>
</domain>


# virsh -c lxc:/// define test.xml
Domain test defined from test.xml

# virsh -c lxc:/// start test
Domain test started

# virsh -c lxc:/// console test
Connected to domain test
Escape character is ^]
……
Fedora release 19 (Schrödinger’s Cat)
Kernel 3.10.0-54.0.1.el7.x86_64 on an x86_64 (console)

localhost login: root
Password:

Login incorrect

Fedora release 19 (Schrödinger’s Cat)
Kernel 3.10.0-54.0.1.el7.x86_64 on an x86_64 (console)

localhost login:

7. If I add a network interface in xml then define and boot the lxc guest,guest can be login successfully.
    <interface type='network'>
      <mac address='00:16:3e:a3:33:f3'/>
      <source network='default'/>
      <target dev='vnet1'/>
    </interface>


Actual results:
As description.

Expected results:
lxc guest with operating system container can be login successfully with no network interface

Additional info:

Comment 1 Daniel Berrangé 2013-12-11 10:40:43 UTC
If you are running a full operating system in LXC, you *must* have a private network namespace either by adding an <interface> or by requesting a new namespace with

  <features>
     <privnet/>
  </features>

Comment 2 tingting zheng 2013-12-11 10:49:39 UTC
(In reply to Daniel Berrange from comment #1)
> If you are running a full operating system in LXC, you *must* have a private
> network namespace either by adding an <interface> or by requesting a new
> namespace with
> 
>   <features>
>      <privnet/>
>   </features>

If I create a lxc guest running a full operating system from virt-manager,then dump the xml file of the guest,there is no such namespace in xml file,does virt-manager need to add it to xml?

Comment 3 Daniel Berrangé 2013-12-11 10:50:42 UTC
Yes, that is a virt-manager issue.


Note You need to log in before you can comment on or make changes to this bug.