LinuxQuestions.org
Review your favorite Linux distribution.
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 10-01-2012, 05:03 PM   #1
ordinary
Member
 
Registered: Apr 2007
Location: the Rocket City
Distribution: Debian, Ubuntu, CentOS; in days past Fedora, Solaris, SunOS, 4.2BSD, 4.3BSD, SVR4, AIX, HP-UX
Posts: 101

Rep: Reputation: Disabled
virt-install: permission denied accessing qcow2 formatted volume


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

Last edited by ordinary; 10-02-2012 at 04:25 PM.
 
Old 10-02-2012, 04:43 PM   #2
ordinary
Member
 
Registered: Apr 2007
Location: the Rocket City
Distribution: Debian, Ubuntu, CentOS; in days past Fedora, Solaris, SunOS, 4.2BSD, 4.3BSD, SVR4, AIX, HP-UX
Posts: 101

Original Poster
Rep: Reputation: Disabled
Well, for reasons that are not entirely clear, changing the ownership of the virtual disk image to libvirt-qemu makes it work. Group is still root, and the permissions are 600.

I don't know if this is correct. I did not see a suitable group, so I just left it as root. I'll have to wait and see if it works in the long term.

Onward and upward, I guess.

I am marking this thread solved because the immediate problem was resolved. But the real issue remains: I still don't know why the virt-install command I used don't work.

Thanks,
Phil

Last edited by ordinary; 10-02-2012 at 04:45 PM.
 
  


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
[SOLVED] CSH Permission Denied When Accessing Local File wafflesausage Programming 15 03-10-2011 02:26 PM
"Permission Denied" while accessing ntfs partition in user mode funkymunky Linux - General 3 01-31-2009 08:03 PM
unmounted hard disk volume/CD ROM: permission denied tuluks Linux - General 7 12-18-2006 02:17 AM
Permission Denied for script accessing text file lobo1 Linux - General 2 06-28-2005 12:46 PM
Accessing Win2K Shares-permission denied bdog Linux - Networking 4 01-26-2002 07:26 PM

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

All times are GMT -5. The time now is 10:20 PM.

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