Bug 1012648 - Unable to start libvirt lxc domain a second time after shutdown/forced shutdown/reboot
Unable to start libvirt lxc domain a second time after shutdown/forced shutdo...
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Libvirt Maintainers
Depends On:
  Show dependency treegraph
Reported: 2013-09-26 15:15 EDT by Florian Klink
Modified: 2015-03-18 03:34 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-03-18 03:34:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Florian Klink 2013-09-26 15:15:25 EDT
Description of problem: Unable to start libvirt lxc domain a second time after shutdown/forced shutdown/reboot

Version: libvirt 1.1.2
[PATCH 1/3] Also store user & group ID 
[PATCH 2/3] Ensure system identity includes process start timevalues in virIdentity
[PATCH 3/3] Add support for using 3-arg pkcheck syntax for process

How reproducible:

Steps to Reproduce:
For me, same problem with libvirt api or virt-manager.
Define domain, similar to this one (or create using virt-manager):

<domain type='lxc'>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
    <type arch='x86_64'>exe</type>
  <clock offset='utc'/>
    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/var/lib/libvirt/filesystems/test/root.copy'/>
      <target dir='/'/>
    <interface type='network'>
      <mac address='00:16:3e:bc:ae:b9'/>
      <source network='default'/>
      <target dev='veth0'/>
    <console type='pty'>
      <target type='lxc' port='0'/>
  <seclabel type='none'/>

Put a "full-blown distribution bootstrap" inside /var/lib/libvirt/filesystems/test/root.copy

Start domain for the first time. Everything works fine.
Shut down the machine ((Forced) Shutdown from libvirt, "halt" inside machine, doesn't matter)

Try to start domain again. 

Actual results:

You get an error message:
Unable to start Domain: Failed to connect socket to '/var/run/libvirt/lxc/test.sock': Connection refused.

Expected results:

Normal startup of the domain as like on the first time.

Additional info:

Rebooting the host machine somehow fixes the problem. I then can start the domain, but only one time (until the next host machine reboot).
Comment 1 Florian Klink 2013-09-30 11:17:40 EDT
Happens because of this: 

Patch from here: https://www.redhat.com/archives/libvir-list/2013-September/msg01671.html workarounds the bug.
Comment 2 Ján Tomko 2015-03-18 03:34:54 EDT
Pushed upstream:
commit bd773e74f0d1d1b9ebbfcaa645178316b4f2265c
Author:     Cédric Bosdonnat <cbosdonnat@suse.com>
AuthorDate: 2013-09-30 16:46:29 +0200
Commit:     Daniel P. Berrange <berrange@redhat.com>
CommitDate: 2013-09-30 16:47:23 +0100

    LXC: workaround machined uncleaned data with containers running systemd.
    The problem is described by [0] but its effect on libvirt is that
    starting a container with a full distro running systemd after having
    stopped it simply fails.
    The container cleanup now calls the machined Terminate function to make
    sure that everything is in order for the next run.
     [0]: https://bugs.freedesktop.org/show_bug.cgi?id=68370

git describe: v1.1.3-rc2-8-gbd773e7 contains: v1.1.3~4

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