I am trying to install a virtual machine using virt-install on a Debian Squeeze host, and it fails complaining that permission is denied accessing the virtual disk. It doesn't have any problem creating the virtual disk, but it cannot access it to complete the installation. Help or advice would be appreciated.
In the first place, /var/lib/libvirt/images is empty
Code:
phil@frederic:/var/lib/libvirt/images$ pwd
/var/lib/libvirt/images
phil@frederic:/var/lib/libvirt/images$ ls -l
total 16
drwx------ 2 root root 16384 Sep 29 22:17 lost+found
phil@frederic:/var/lib/libvirt/images$
I tried virt-install with the necessary options to create a virtual disk image:
Code:
phil@frederic:~$ sudo virt-install --name vm-fififi --ram 512 --disk /var/lib/libvirt/images/vm-fififi.img,size=12,format=qcow2 --cdrom /home/phil/Downloads/ubuntu-12.04.1-server-amd64.iso --vnc --noautoconsole --os-type linux --network=bridge:br1,mac=52:54:00:a3:88:df
Starting install...
Allocating 'vm-fififi.img' | 12 GB 00:00
ERROR internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu: could not open disk image /var/lib/libvirt/images/vm-fififi.img: Permission denied
Domain installation does not appear to have been
successful. If it was, you can restart your domain
by running 'virsh start vm-fififi'; otherwise, please
restart your installation.
ERROR internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu: could not open disk image /var/lib/libvirt/images/vm-fififi.img: Permission denied
Traceback (most recent call last):
File "/usr/bin/virt-install", line 1033, in <module>
main()
File "/usr/bin/virt-install", line 915, in main
start_time, guest.start_install)
File "/usr/bin/virt-install", line 957, in do_install
dom = install_func(conscb, progresscb, wait=(not wait))
File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 973, in start_install
return self._do_install(consolecb, meter, removeOld, wait)
File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 1038, in _do_install
"install")
File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 1009, in _create_guest
dom = self.conn.createLinux(start_xml, 0)
File "/usr/lib/python2.6/dist-packages/libvirt.py", line 1277, in createLinux
if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu: could not open disk image /var/lib/libvirt/images/vm-fififi.img: Permission denied
phil@frederic:~$ ls -l /var/lib/libvirt/images/
total 152
drwx------ 2 root root 16384 Sep 29 22:17 lost+found
-rw------- 1 root root 262144 Oct 1 16:45 vm-fififi.img
phil@frederic:~$
It is interesting that virt-install created the virtual disk image, but cannot use it.
Then I used virt-manager to remove the disk image, and re-create it using:
Code:
Name: vm-fififi
Format: qcow2
Max Capacity: 12000MB
Allocation 0 MB
Code:
phil@frederic:~$ ls -l /var/lib/libvirt/images/
total 152
drwx------ 2 root root 16384 Sep 29 22:17 lost+found
-rw------- 1 root root 262144 Oct 1 16:49 vm-fififi.img
phil@frederic:~$
And lo and behold, there it is.
Then I tried a similar virt-install, but assuming an existing virtual disk image:
Code:
phil@frederic:~$ sudo virt-install --name vm-fififi --ram 512 --disk /var/lib/libvirt/images/vm-fififi.img --cdrom /home/phil/Downloads/ubuntu-12.04.1-server-amd64.iso --vnc --noautoconsole --os-type linux --network=bridge:br1,mac=52:54:00:a3:88:df
Starting install...
ERROR internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu: could not open disk image /var/lib/libvirt/images/vm-fififi.img: Permission denied
Domain installation does not appear to have been
successful. If it was, you can restart your domain
by running 'virsh start vm-fififi'; otherwise, please
restart your installation.
ERROR internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu: could not open disk image /var/lib/libvirt/images/vm-fififi.img: Permission denied
Traceback (most recent call last):
File "/usr/bin/virt-install", line 1033, in <module>
main()
File "/usr/bin/virt-install", line 915, in main
start_time, guest.start_install)
File "/usr/bin/virt-install", line 957, in do_install
dom = install_func(conscb, progresscb, wait=(not wait))
File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 973, in start_install
return self._do_install(consolecb, meter, removeOld, wait)
File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 1038, in _do_install
"install")
File "/usr/lib/pymodules/python2.6/virtinst/Guest.py", line 1009, in _create_guest
dom = self.conn.createLinux(start_xml, 0)
File "/usr/lib/python2.6/dist-packages/libvirt.py", line 1277, in createLinux
if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu: could not open disk image /var/lib/libvirt/images/vm-fififi.img: Permission denied
Hmmm... it seems to fail the same way.
Details of my machine are:
Code:
phil@frederic:~$ cat /etc/debian_version
6.0.6
phil@frederic:~$ sudo libvirtd --version
libvirtd (libvirt) 0.8.3
phil@frederic:~$ sudo virt-install --version
0.500.3
phil@frederic:~$ uname -a
Linux frederic 2.6.32-5-amd64 #1 SMP Sun Sep 23 10:07:46 UTC 2012 x86_64 GNU/Linux
phil@frederic:~$ virt-manager --version
0.8.4
Eventually, I tried changing the permissions on virtual disk image to 666, and re-ran the virt-install (without the "format=qcow2") and that successfully created the virual machine, and kicked off the ubuntu install. But that is not a solution, just a clue.
My questions are:
1) Why can't virt-install use the virtual disk image vm-fififi.img? It is run with sudo, it manages to create the file, so why is it having trouble accessing the file for use?
2) What are the correct owner, group, and permissions for a qcow2 virtual disk file? In my case, the owner and group is root, and the permissions are 600.
3) Why does the install work if I change the permissions on the virtual disk image to 666? I use sudo on the install, so shouldn't that cover permissions problems?
4) I am probably missing something painfully obvious, so the big question is: What am I missing?
Thanks,
Phil