2

I'm running Fedora 22 (64 bit, 16gb memory, ext4 boot disk) with a cinnamon desktop and I would like to use Virtual Machine Manager to run Windows 7 as a guest. However, I'm having trouble filesharing between the Fedora 22 host and the virtual machine (Windows 7). Before posting this, I searched this forum; this question has apparently already been answered, more than once.

However, one answer referred to a webpage within http://www.linux-kvm.com, which is offline. A second answer referred to http://www.linux-kvm.org/page/9p_virtio. This webpage is apparently out of date; it shows a [add : filesystem] example with type=passthrough, and no driver specified. The current virtual machine manager (virt-manager) forces type=mount, and provides Driver choices of default, handle, or path.

Anyway, I installed samba and Virtual Machine Manager via


sudo dnf install system-config-samba
sudo dnf install virt-manager

I then created the /mnt/disk1 (with 1 file) and /myshareddisk1 (empty) directories and used chmod 777 on both of them. Then I added the following trailer to /etc/samba/smb.conf:


[mydisk1]
comment = My Disk1
path = /mnt/disk1
public = yes
writeable = yes 

Then I used the following commands to enable the samba access to /mnt/disk1.


semanage fcontext -a -t samba_share_t "/mnt/disk1(/.*)?"
restorecon -R -v /mnt/disk1

Then, I used the following commands to create samba passwords for the root user, and my other user, steve.


smbpasswd -a root
smbpasswd -a steve

I then started samba and made /myshareddisk1 a mount of /mnt/disk1 via


systemctl start smb
mount //localhost/mydisk1 /myshareddisk1 -o user=steve

I then verified the samba process via both


smbclient -U steve -L localhost
ls /myshareddisk1 : the /mnt/disk1 file was displayed.

I then started the virtual machine service (systemctl start libvirtd) and started the virt-mgr application. Then I created a new virtual machine, and used a Windows 7 iso to install Windows 7 into this machine. The Windows 7 virtual machine runs ok.

SO FAR, EVERYTHING WAS FINE. HOWEVER THIS IS ALL WORTHLESS TO ME IF I CAN'T FILE SHARE BETWEEN FEDORA AND WINDOWS.

Using the virt-mgr gui, I tried to add a samba file system to the Windows 7 virtual machine; an error message was generated.


Error starting domain: internal error: 
process exited while connecting to monitor: 
2016-05-23T23:54:21.548427Z qemu-system-x86_64: 
-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,
mount_tag=shared,bus=pci.0,addr=0x8: 
Virtio-9p Failed to initialize fs-driver with id:fsdev-fs0 
and export path:/home/steve/shared02
2016-05-23T23:54:21.548491Z qemu-system-x86_64: 
-device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,
mount_tag=shared,bus=pci.0,addr=0x8: 
Device 'virtio-9p-pci' could not be initialized

I then google researched, and discovered that (perhaps) virt-mgr doesn't like the source directory /home/steve/shared02, because it is not owned by the root user. I then tried a source directory of /mnt/disk1. This allowed virt-mgr to start the Windows 7 virtual machine, but did not provide any file sharing access. Then, I tried a source directory of /myshareddisk1, which (before the samba mounting) was owned by the root. This re-generated the error:


Error starting domain: internal error: 
process exited while connecting to monitor:
...

I then altered the mounting (mount //localhost/mydisk1 /myshareddisk1 -o user=root) and repeated the process: virt-mgr still produced the Error starting domain message. I then experimented within virt-mgr with various drive/mode combinations for the file system to be added - no joy.

Questions: If possible, please give direct answer(s) rather than referring to a webpage.

  1. I prefer a gui such as virtual machine manager, rather than qemu commands in a terminal. Has anyone accomplished what I want? Alternatively, is there a bug in virtual machine manager, under Fedora 22?

  2. Assuming that file sharing under virtual machine manager is unworkable, is there a different gui which will work? Cinnamon's boxes application doesn't seem to allow much customization, so that would be my last gui choice.

  3. Assuming no gui is feasible, what terminal command(s) (e.g. qemu commands) should I run to accomplish what I want? If a sample command is provided here, I can probably reverse engineer customizing it. Command(s) would have to allow Windows 7 to be installed from iso, Windows 7 to be shut down (with image saved) and then the image of (the now installed) Windows 7 to be re-started.

  • Why are you attempting to add the share as a disk in KVM? As you're using a Windows guest, simply access the share directly from your guest - SMB is native to Windows after all. – garethTheRed May 26 '16 at 6:58
  • I don't understand the phrase "add the share as a disk in KVM", so I can't respond to the question. In Fedora, I'm using samba to (hopefully) establish a specific directory that I can access while using Windows 7 in a virtual machine (i.e. Fedora=host, Win7=guest). As described in my original posting, I am failing. Since the Windows 7 access is totally within the virtual machine, I can't think of any other way to do this. Please advise. – user2661923 May 26 '16 at 16:43
  • You're doing fine up to the where you've typed in CAPITALS. At that point, from Windows navigate to \\<IP or name of host>\myshareddisk1. Samba provides a SMB server and Windows has an SMB client, therefore there is no need to involve virt-manager in getting the two systems to talk to each other. – garethTheRed May 26 '16 at 18:00
  • garethTheRed, are you sure; have you actually done this within virt-manager? As I interpreted your suggestion, I used the linux hostname command to get ip98-167-78-229.lv.lv.cox.net, started virt-manager, bypassed its [add : filesystem] feature, started windows 7 within virt-manager, and then attempted to map a Windows 7 drive to \\ip98-167-78-229.lv.lv.cox.net\myshareddisk1. This failed. I then tried to use the [add : filesystem] feature, specifying a source path of \\ip98-167-78-229.lv.lv.cox.net\myshareddisk1 - no joy. see next comment – user2661923 May 26 '16 at 22:33
  • Could you (or someone) actually implement this with virt-manager (or some other virtual machine gui), and then show these steps as an answer to my forum query? Alternatively, could you (or someone) provide the corresponding qemu commands as an answer. ...Thanks – user2661923 May 26 '16 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.