fedora 22 filesharing problem with virt-manager and Windows 7 guest

asked 2016-05-23 19:49:47 -0600

zug234zwang gravatar image

I'm running Fedora 22 (64 bit, 16gb memory) with a cinnamon desktop and I would like to use Virtual Machine Manager to run Windows 7. However, I need filesharing between the Fedora 22 host and the virtual machine (Windows 7). 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 ...

(more)
edit retag flag offensive close merge delete

Comments

How about mapping a network drive to the samba share?

swilson gravatar imageswilson ( 2016-05-26 00:46:21 -0600 )edit

My bad for not being clear. Within the Windows 7 vm, if I add /mnt/disk1/ it does not show in the Windows network, so I can't map to it. Alternatively, if I add /myshareddisk1, which is (samba) "localhost-mounted", virtual machine manager (virt-manager) crashes.

zug234zwang gravatar imagezug234zwang ( 2016-05-26 12:02:45 -0600 )edit

No time to dig further at this stage - but look into:

  • selinux: it is very particular about how SMB shares can operate, as a test try sudo setenforce 0 to switch to permissive mode and see if you can use the shared directory.
  • firewalld: not sure if this may be active and blocking traffic from the "vm network" - try sudo firewall-cmd --add-service=smb --permanent; sudo firewall-cmd --reload
  • network config: on the vm - can it communicate with the host machine in the first place, i.e. did you configure networking that bridged to the host machine?

Just some things to investigate.

snowolfe gravatar imagesnowolfe ( 2016-05-31 08:32:54 -0600 )edit