0

I am using this command (using virt-install on a debian 7 host) to start the installation of windows7 guest OS. I have assembled the following from a plethora of sites

virt-install --connect qemu:///system \
    -n win7vnc -r 2048 --vcpus=2 \
    --disk path=/mnt/hd_nass/vms/win7/win7.img,format=qcow2 \
    --network network=default,mac=RANDOM \
    --graphics vnc,password=johndoe,port=5900  
    -c ../../isos/win7_sp1_ult_64bit/Windows\ 7\ SP1\ Ultimate\ \(64\ Bit\).iso \
    --os-type=windows --os-variant=win7 --boot cdrom,hd

The server is running headless but I presume the vnc clause takes care of creating a suitable environment for qemu. This is not the case however as I get this error:

ERROR    internal error process exited while connecting to monitor: char device redirected to /dev/pts/2

what is more I get one additional error, that relates to the disk image:

kvm: -drive file=/mnt/hd_nass/vms/win7/win7.img,if=none,id=drive-ide0-0-0,format=qcow2: could not open disk image /mnt/hd_nass/vms/win7/win7.img: Permission denied

I created the image as my non-root user, with the command:

qemu-img create -f qcow2 win7.img 100G

still everytime I run virt-install command above (as my non-root user), the image ownership is reset to root:root. This could explain the "permission denied" error, but why would the img ownership change anyway?

EDIT: the log from the last dump is here

nass
  • 568
  • 4
  • 10
  • 24
  • In the `/var/log/libvirt/qemu` directory (assuming Debian hasn't done something else stupid and moved it) you ought to find a logfile for this installation attempt. Please post it. – Michael Hampton Sep 25 '14 at 13:51
  • @MichaelHampton hi there, debian has not done anything stupid (as far as libvirt is concerned). I edited the Q to add the log from the last run. thank you – nass Sep 25 '14 at 15:07
  • 2
    `could not open disk image /mnt/hd_nass/vms/win7/win7.img: Permission denied` Well, that confirms a permission problem. Check the permissions of all the parent directories as well. – Michael Hampton Sep 25 '14 at 15:08
  • @MichaelHampton hi since parent folder permissions where the reason behind both problems, please suggest that as an answer. – nass Sep 25 '14 at 18:07

2 Answers2

1

virt-install is a libvirt tool, so it will run and access files under the local libvirt credentials (defined in /etc/libvirt/libvirtd.conf). You need to make sure the image permissions are the same, and that the image resides in a dir accessible to libvirt and kvm/qemu

dyasny
  • 18,802
  • 6
  • 49
  • 64
  • isn't there a way to run the `vm` as my own user? so I can maintain ownership of all the files of the virtual machine? – nass Sep 25 '14 at 15:09
  • possible, with some ugly hackery involved. I wouldn't bother and just use `sudo` – dyasny Sep 25 '14 at 15:49
  • i'm all ears - if you know how / have any guide to suggest – nass Sep 25 '14 at 16:32
  • err... `man visudo` is a good start – dyasny Sep 25 '14 at 16:42
  • hm nono. I don't want to give elevated permissions to my user. I want to run the vm as my user. so that I can avert permission limitations imposed by kvm. currently, all the path to the disk .img file location must be world readable , or else the kvm user cannot see the file... – nass Sep 25 '14 at 16:46
  • I understand your question, but I did say it's not a good idea. If you want to build a setup with users having access to perform limited functions on VMs, you might want to look at oVirt - you get a simple user UI (the user can only see assigned VMs, start and stop them) or a power user UI (user can create VMs within provided limits, but can't touch the hosts/storage/network/etc) and an admin UI for you, where you can manage the entire system – dyasny Sep 25 '14 at 17:24
1

could not open disk image /mnt/hd_nass/vms/win7/win7.img: Permission denied Well, that confirms a permission problem.

Check the permissions of all the parent directories as well.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972