Bug 1096343

Summary: virt-install --import fails with guest-agent-related error
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: berrange, crobinso, gscrivan, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-10 18:16:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 910269    

Description Richard W.M. Jones 2014-05-09 17:32:13 UTC
Description of problem:

I built a disk image in my home directory using virt-builder, then
tried to import it into libvirt (as non-root).  It fails with:

Starting install...
ERROR    internal error: process exited while connecting to monitor: qemu-system-x86_64: -chardev socket,id=charchannel0,path=/home/rjones/.config/libvirt/qemu/lib/channel/target/nested.org.qemu.guest_agent.0,server,nowait: Failed to bind socket: No such file or directory
chardev: opening backend "socket" failed

Note that ~/.config/libvirt/qemu/lib/channel/target does not exist.

Version-Release number of selected component (if applicable):

libvirt-daemon-1.1.3.5-1.fc20.x86_64
virt-install-1.0.1-3.fc20.noarch
libguestfs-tools-c-1.26.1-2.fc20.x86_64

How reproducible:

100%

Steps to Reproduce:

Run the following commands as non-root in your home dir:

virt-builder fedora-20
virt-install --import --ram 1024 --vcpus=2 --name nested --disk path=fedora-20.img,format=raw --os-variant fedora20

Actual results:

The virt-install command fails with the error shown above.

Comment 1 Richard W.M. Jones 2014-05-09 17:33:54 UTC
From /home/rjones/.cache/libvirt/qemu/log/nested.log:

2014-05-09 17:28:43.133+0000: starting up
LC_ALL=C PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/rjones/.local/bin:/home/rjones/bin HOME=/home/rjones USER=rjones LOGNAME=rjones QEMU_AUDIO_DRV=none /usr/bin/qemu-kvm -name nested -S -machine pc-i440fx-1.6,accel=kvm,usb=off -cpu qemu64 -m 1024 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid 830b51e8-aea2-48af-a41b-59cf0cb90329 -nographic -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/home/rjones/.config/libvirt/qemu/lib/nested.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x3.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x3 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x3.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x3.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -drive file=/home/rjones/fedora-20.img,if=none,id=drive-virtio-disk0,format=raw -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev user,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:5c:0a:5e,bus=pci.0,addr=0x2 -chardev socket,id=charchannel0,path=/home/rjones/.config/libvirt/qemu/lib/channel/target/nested.org.qemu.guest_agent.0,server,nowait -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0 -chardev pty,id=charconsole0 -device virtconsole,chardev=charconsole0,id=console0 -device usb-tablet,id=input0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
qemu-system-x86_64: -chardev socket,id=charchannel0,path=/home/rjones/.config/libvirt/qemu/lib/channel/target/nested.org.qemu.guest_agent.0,server,nowait: Failed to bind socket: No such file or directory
chardev: opening backend "socket" failed
2014-05-09 17:28:43.343+0000: shutting down

Comment 2 Richard W.M. Jones 2014-05-09 17:35:02 UTC
qemu version is:
qemu-kvm-1.6.2-4.fc20.x86_64

Comment 3 Cole Robinson 2014-05-11 22:57:16 UTC
Libvirt should be generating that path and creating it for us

Comment 4 Richard W.M. Jones 2014-06-11 07:53:45 UTC
Happened again, this time with a regular virt-install:

virt-install-1.0.1-3.fc20.noarch
libvirt-1.1.3.5-1.fc20.x86_64
qemu-2.0.0-0.1.rc0.fc21.x86_64

+ virt-install --name=tmp-0d9fb3ab --ram=2048 --cpu=host --vcpus=2 --os-type=linux --os-variant=rhel7 --initrd-inject=/tmp/tmp.Km4Q6VFCex '--extra-args=ks=file:/tmp.Km4Q6VFCex console=tty0 console=ttyS0,115200' --disk /home/rjones/d/libguestfs/builder/website/rhel-7.0,size=6 --location=http://download.devel.redhat.com/released/RHEL-7/7.0/Server/x86_64/os --nographics --noreboot
WARNING  'console=ttyS0' found in --extra-args, but the device attached to the guest likely requires 'console=hvc0'. You may not see text install output from the guest.
WARNING  To make '--extra-args console=ttyS0' work, you can force a plain serial device with '--console pty'

Starting install...
Retrieving file .treeinfo...                             | 4.4 kB     00:00 !!! 
Retrieving file vmlinuz...                               | 9.3 MB     02:02 !!! 
Retrieving file initrd.img...                            |  68 MB     15:37 !!! 
Allocating 'rhel-7.0'                                    | 6.0 GB     00:00     
ERROR    internal error: process exited while connecting to monitor: qemu-system-x86_64: -chardev socket,id=charchannel0,path=/home/rjones/.config/libvirt/qemu/lib/channel/target/tmp-0d9fb3ab.org.qemu.guest_agent.0,server,nowait: Failed to bind socket: No such file or directory
qemu-system-x86_64: -chardev socket,id=charchannel0,path=/home/rjones/.config/libvirt/qemu/lib/channel/target/tmp-0d9fb3ab.org.qemu.guest_agent.0,server,nowait: chardev: opening backend "socket" failed

Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///session start tmp-0d9fb3ab
otherwise, please restart your installation.

Comment 5 Cole Robinson 2016-04-10 18:16:10 UTC
A few releases back libvirt was updated to create the socket directory if needed, so this should no longer be an issue