LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 02-01-2011, 04:13 PM   #1
dariusb12
LQ Newbie
 
Registered: Feb 2011
Posts: 9

Rep: Reputation: 1
Can't bring up KVM guest from image on USB drive


We're using KVM on top of RedHat Enterprise and have been moving an image file (that contains a fully provisioned guest OS) from one machine to another. When we bring up the guest OS using virt-install with the --import feature, it works fine as long as the image file is on the fixed hard drive (essentially a typical /home directory mounted on /dev/sda). If we try to bring up the exact same guest OS using virt-install, but the image file is on a removable USB hard drive, we get the following error.

Starting install...
Guest installation complete... restarting guest.
ERROR internal error Process exited while reading console log output: qemu: could not open disk image /mnt/usb/virtual1b.img

Domain installation may not have been
successful. If it was, you can restart your domain
by running 'virsh start virtual1b'; otherwise, please
restart your installation.
ERROR internal error Process exited while reading console log output: qemu: could not open disk image /mnt/usb/virtual1b.img
Traceback (most recent call last):
File "/usr/sbin/virt-install", line 892, in ?
main()
File "/usr/sbin/virt-install", line 774, in main
dom.create()
File "/usr/lib64/python2.4/site-packages/libvirt.py", line 333, in create
if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: internal error Process exited while reading console log output: qemu: could not open disk image /mnt/usb/virtual1b.img

We have tried the following without success.

- It doesn't seem like an SELinux problem. No change if we change the security context of the image file (ours is called "virtual1b.img") on the USB drive. Also no change if we set SELinux to permissive. There's also nothing showing up in SELinux logs.
- It doesn't seem like a Linux file permission problem. All files belong to root and virt-install is run as root.
- It doesn't seem like a file corruption problem. The exact same image file boots up as a guest OS fine if copied onto the fixed hard drive.

Here's our setup (RHEL 5.6):

# uname -a
Linux localhost.localdomain 2.6.18-238.1.1.el5 #1 SMP Tue Jan 4 13:32:19 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

kmod-kvm.x86_64 83-224.el5
kvm.x86_64 83-224.el5
kvm-qemu-img.x86_64 83-224.el5

virsh # version
Compiled against library: libvir 0.8.2
Using library: libvir 0.8.2
Using API: QEMU 0.8.2
Running hypervisor: QEMU 0.9.1

Here're a snippet of dumpxml from virsh (where we're trying to bring up the guest OS from the mounted USB drive):

<domain type='kvm'>
<name>virtual1b</name>
...
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source file='/mnt/usb/virtual1b.img'/>
<target dev='vda' bus='virtio'/>
</disk>
...
</domain>

Does anybody have any thoughts? Thanks!
 
Old 02-03-2011, 03:29 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
"/mnt/usb/virtual1b.img"

Is that correct?
 
Old 02-04-2011, 07:14 AM   #3
dariusb12
LQ Newbie
 
Registered: Feb 2011
Posts: 9

Original Poster
Rep: Reputation: 1
Oh, do you mean if it was a typo or something? I mounted the usb drive at /mnt/usb and the name of the image file is "virtual1b.img".

I'm not sure if it matters, but the file is also big (like 50G big). I've tried this a bunch of times (with different files on different machines, with slightly different kernels) and the same error seems to come up.

Thanks again.
 
Old 02-11-2011, 07:59 AM   #4
luckyfengyong
LQ Newbie
 
Registered: Feb 2011
Posts: 2

Rep: Reputation: 0
I met a similar issue that cannot start a VM from NFS however it is OK from local disk. It seems since RHEL 5.6, by default the QEMU virtual machines will run as group/user of qemu/qemu who does not have enough permission to run VM image from some external devices. Please refer to http://libvirt.org/drvqemu.html for details. Configuring user=root and group=root in /etc/libvirt/qemu.conf could resolve it.

Both RHEL and ubuntu got similar issues reported and they provided the same solution. Please refer to following for details.

https://bugzilla.redhat.com/show_bug.cgi?id=580482
https://bugs.launchpad.net/ubuntu/+s...rt/+bug/599910

Yong
 
Old 02-11-2011, 04:29 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
I was thinking that this is the problem.

qemu: could not open disk image /mnt/usb/virtual1b.img

But I like luckyfengyong's suggestion as to usb permissions.
 
Old 02-20-2011, 06:54 PM   #6
dariusb12
LQ Newbie
 
Registered: Feb 2011
Posts: 9

Original Poster
Rep: Reputation: 1
Thanks for the suggestion luckyfengyong and jefro. Darn, it didn't work. Same error message. (And unlike the postings that luckyfengyong referred to, I don't seem to have error messages that includ "Permission denied").

I logged the output from libvirtd (debug level), but it doesn't seem to helpful. Here's what seemed to be the relevant chunk:

...
19:19:31.124: debug : virEventCalculateTimeout:342 : Timeout at 0 due in -1 ms
19:19:31.124: debug : virEventRunOnce:564 : Poll on 8 handles 0x2aaaac004da0 timeout -1
19:19:31.124: debug : virGetDomain:271 : New hash entry 0x7a29dc0
19:19:31.124: debug : virDomainCreate:3913 : domain=0x7a29dc0
19:19:31.124: debug : virExecWithHook:546 : /usr/libexec/qemu-kvm -help
19:19:31.127: debug : virEventRunOnce:566 : Poll got 1 event
19:19:31.128: debug : virEventDispatchHandles:449 : Dispatch n=3 f=3 w=4 e=1 0x7a1b5f0
19:19:31.128: info : Received unexpected signal 17
19:19:31.128: debug : virEventMakePollFDs:364 : Prepare n=0 w=1, f=5 e=1
19:19:31.128: debug : virEventMakePollFDs:364 : Prepare n=1 w=2, f=8 e=0
19:19:31.128: debug : virEventMakePollFDs:364 : Prepare n=2 w=3, f=8 e=1
19:19:31.128: debug : virEventMakePollFDs:364 : Prepare n=3 w=4, f=3 e=1
19:19:31.128: debug : virEventMakePollFDs:364 : Prepare n=4 w=5, f=10 e=25
19:19:31.128: debug : virEventMakePollFDs:364 : Prepare n=5 w=6, f=11 e=25
19:19:31.128: debug : virEventMakePollFDs:364 : Prepare n=6 w=7, f=12 e=1
19:19:31.128: debug : virEventMakePollFDs:364 : Prepare n=7 w=8, f=13 e=1
19:19:31.128: debug : virEventCalculateTimeout:312 : Calculate expiry of 2 timers
19:19:31.128: debug : virEventCalculateTimeout:342 : Timeout at 0 due in -1 ms
19:19:31.128: debug : virEventRunOnce:564 : Poll on 8 handles 0x2aaaac004da0 timeout -1
19:19:31.132: debug : virExecWithHook:546 : /usr/libexec/qemu-kvm -S -M rhel5.4.0 -m 1000 -smp 1 -name virtual1b -uuid 27a2da4c-8cd7-5218-42e1-7d4b416070a2 -no-kvm-pit-reinjection -monitor pty -pidfile /var/run/libvirt/qemu//virtual1b.pid -boot c -drive file=/mnt/usb/virtual1b.img,if=ide,index=0,boot=on,cache=none -net nic,macaddr=54:52:00:0a:a7:30,vlan=0 -net tap,fd=16,script=,vlan=0,ifname=vnet0 -serial pty -parallel none -usb -vnc 0.0.0.0:0 -k en-us
19:19:31.137: debug : virEventRunOnce:566 : Poll got 1 event
19:19:31.137: debug : virEventDispatchHandles:449 : Dispatch n=3 f=3 w=4 e=1 0x7a1b5f0
19:19:31.137: info : Received unexpected signal 17
19:19:31.137: debug : virEventMakePollFDs:364 : Prepare n=0 w=1, f=5 e=1
19:19:31.137: debug : virEventMakePollFDs:364 : Prepare n=1 w=2, f=8 e=0
19:19:31.137: debug : virEventMakePollFDs:364 : Prepare n=2 w=3, f=8 e=1
19:19:31.137: debug : virEventMakePollFDs:364 : Prepare n=3 w=4, f=3 e=1
19:19:31.137: debug : virEventMakePollFDs:364 : Prepare n=4 w=5, f=10 e=25
19:19:31.137: debug : virEventMakePollFDs:364 : Prepare n=5 w=6, f=11 e=25
19:19:31.137: debug : virEventMakePollFDs:364 : Prepare n=6 w=7, f=12 e=1
19:19:31.137: debug : virEventMakePollFDs:364 : Prepare n=7 w=8, f=13 e=1
19:19:31.137: debug : virEventCalculateTimeout:312 : Calculate expiry of 2 timers
19:19:31.137: debug : virEventCalculateTimeout:342 : Timeout at 0 due in -1 ms
19:19:31.137: debug : virEventRunOnce:564 : Poll on 8 handles 0x2aaaac004da0 timeout -1
19:20:01.452: error : internal error Timed out while reading console log output
19:20:01.452: error : internal error unable to start guest: qemu: could not open disk image /mnt/usb/virtual1b.img

19:20:01.452: debug : qemudShutdownVMDaemon:1684 : Shutting down VM 'virtual1b'
...

Nothing interesting in /var/log/messages either:

/var/log/messages

...
FAùúÀ' 16:21:38 localhost libvirtd: 16:21:38.458: error : Domain not found: no domain with matching name 'virtual1b'
Feb 20 16:21:38 localhost libvirtd: 16:21:38.483: error : Domain not found: no domain with matching name 'virtual1b'
Feb 20 16:21:38 localhost kernel: device vnet0 entered promiscuous mode
Feb 20 16:21:38 localhost kernel: br0: topology change detected, propagating
Feb 20 16:21:38 localhost kernel: br0: port 2(vnet0) entering forwarding state
Feb 20 16:21:38 localhost kernel: br0: port 2(vnet0) entering disabled state
Feb 20 16:21:38 localhost kernel: device vnet0 left promiscuous mode
Feb 20 16:21:38 localhost kernel: br0: port 2(vnet0) entering disabled state
Feb 20 16:22:08 localhost libvirtd: 16:22:08.943: error : internal error Timed out while reading console log output
Feb 20 16:22:08 localhost libvirtd: 16:22:08.943: error : internal error unable to start guest: qemu: could not open disk image /mnt/usb/virtual1b.img
...

In qemu.conf, I tried several setting syntaxes just in case it was quirky:

user = "root"
group = "root"

user=root
group=root

user ="root"
group="root"

user='root'
group='root'

Hmm. Any other suggestions would be appreciated! Thanks again.
 
Old 02-21-2011, 03:16 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
ls -l /mnt/usb
 
Old 02-22-2011, 12:14 AM   #8
dariusb12
LQ Newbie
 
Registered: Feb 2011
Posts: 9

Original Poster
Rep: Reputation: 1
Thanks jefro. I just finished trying something else.

It turns out that it works if the USB hard drive has an ext3 filesystem. I was using NTFS (using the fuse and fuse-ntfs-3g packages) as the filesystem. So it's possible that the problem is just with NTFS. Hmm, I'm going to try it reformatted to NTFS again (just in case something else changed that I didn't notice), and I'll run the command.

Strange!
 
Old 02-22-2011, 10:30 PM   #9
dariusb12
LQ Newbie
 
Registered: Feb 2011
Posts: 9

Original Poster
Rep: Reputation: 1
Ok I changed it back to an NTFS filesystem. Sure enough, it doesn't work, and the error appears again (same as above).

jefro, here's the output to ls:

# ls -l /mnt/usb
total 26214400
-rwxrwxrwx 1 root root 26843545600 Feb 22 08:54 virtual1b.img

Unless someone has another idea, I was going to try a primitive test and create an NTFS partition on my fixed hard drive. I'll try the same image file on there to see what happens (maybe narrow it down to just NTFS on a USB drive vs. NTFS in general?). Using a non-NTFS filesystem is probably a decent work-around, but part of all this is just to get a feel for how brittle KVM might be.
 
Old 02-23-2011, 03:15 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Maybe it is how the qemu has access to the /mnt directory?

You did say you used ntfs-3G to mount it didn't you?
 
Old 02-23-2011, 11:31 PM   #11
dariusb12
LQ Newbie
 
Registered: Feb 2011
Posts: 9

Original Poster
Rep: Reputation: 1
Oh, when the USB drive was formatted with an NTFS filesystem (which qemu could not seem to access), I mounted it just by:

mount /dev/sdc1 /mnt/usb

When I reformatted it with an ext3 filesystem, I mounted it the same way (and qemu could access it). Is there another approach to mounting the NTFS filesystem that I should try?

Thanks.
 
Old 04-23-2011, 07:10 AM   #12
craja_1979
LQ Newbie
 
Registered: Jan 2011
Posts: 7

Rep: Reputation: 1
In direct solution

create a virtual machine as normal procedure.

Open the newly creatted virtual machine and go to the "Hardware" tab. In Hardware tab remove your Hard disk and add a new storage disk which pointing to your image in your usb disk.

I came across the same issue like you. The above steps works fine for me. Even though it is not a direct solution.I hope this steps will solve your issue.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Xen RAW image to KVM qcow2 makes Win2k8 guest BSOD Savaan Linux - Virtualization and Cloud 9 12-31-2011 11:59 AM
Assign IP to Guest VM in KVM vzxen Linux - Virtualization and Cloud 9 09-28-2010 04:14 AM
KVM: Mouse under Windows Guest performs way better than under Centos Guest martdj Linux - Virtualization and Cloud 3 03-29-2010 04:20 AM
Unable to see usb mounted drive in VMware RHEL guest warrickj Linux - Hardware 2 10-08-2008 09:34 PM
Creating/restoring drive image on USB drive OneSeventeen Linux - Newbie 9 07-06-2005 05:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 10:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration