saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.15k stars 5.48k forks source link

salt-run virt.init fails on Ubuntu 14.04 for Btrfs qcow2 image #15018

Closed lloesche closed 6 years ago

lloesche commented 10 years ago

I am running salt 2014.1.10+ds-1trusty1 on Ubuntu 14.04.

When trying to provision a VM with salt-run virt.init hhtest4 2 4096 salt://vmimages/Ubuntu14.04Btrfs.qcow2

The file salt://vmimages/Ubuntu14.04Btrfs.qcow2 is a Ubuntu VM with Btrfs on / and /home and xfs on /boot.

The provisioning fails with the following log message:

2014-08-13 14:42:38,035 [salt.loaded.int.module.cmdmod][ERROR   ] Command 'guestmount -i -a /srv/salt-images/hhtest4/system.qcow2 --rw /tmp/guest/srv.salt-images.hhtest4.system.qcow2' failed with return code: 1
2014-08-13 14:42:38,048 [salt.loaded.int.module.cmdmod][ERROR   ] output: libguestfs: error: aug_get: aug_get: /files/etc/fstab/1/opt: Too many matches for path expression: There are 2 nodes matching /files/etc/fstab/1/opt
2014-08-13 14:42:38,048 [salt.minion      ][WARNING ] The minion function caused an exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 797, in _thread_return
    return_data = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/virt.py", line 612, in init
    install=install)
  File "/usr/lib/python2.7/dist-packages/salt/modules/seed.py", line 107, in apply_
    with salt.utils.fopen(tmp_config, 'w+') as fp_:
  File "/usr/lib/python2.7/dist-packages/salt/utils/__init__.py", line 1069, in fopen
    fhandle = open(*args, **kwargs)
IOError: [Errno 2] No such file or directory: '/tmp/guest/srv.salt-images.hhtest4.system.qcow2/tmp/minion'

Salt will have created the VM (shows up in virsh list --all) and copied the qcow2 image, but the VM is not running and is not pre-seeded either.

basepi commented 10 years ago

Thanks for the report. We'll investigate this.

crocket commented 9 years ago

After reading https://www.redhat.com/archives/libguestfs/2012-May/msg00157.html, I executed update-guestfs-appliance, and the issue is solved.

Plus, this issue is solved if you have libguestfs >= 1.26 For reference, read http://libguestfs.org/guestfs-faq.1.html#libguestfs:-error:-cannot-find-any-suitable-libguestfs-supermin-fixed-or-old-style-appliance-on-libguestfs_path

Plus, if you install libguestfs-tools via pkg.installed state, update-guestfs-appliance is automatically executed for you.

jcftang commented 9 years ago

I'm running across a similar problem, after following the previous comment of running 'update-guestfs-appliance' whenever I start up a new vm with virt.init, the system never actually seeds my VM nor does it startup. It appears to just leave "/dev/fuse on /tmp/guest/srv.salt-images.vvvv.system.qcow2 type fuse (rw,nosuid,nodev)" mounted and lying around.

nineteen commented 9 years ago

I was also running across this problem. I checked /var/log/libvirt/qemu/guestfs-*.log and noticed this error:

block I/O error in device.... Permission denied

I also noticed that virsh list --all no longer listed the guestfs vm, but the process was still running. After some more debugging I came to the conclusion that SE linux was causing problems with the location of the image files. I created a soft link pointing /var/lib/libvirt/images to /srv/salt-images and now there are no more permission denied errors, and the guestfs process terminates normally.

Edit: I was still having some problems after this. Disabling selinux all together resolved my issues. Obviously not the most ideal situation.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.