In this blog post I’ll talk a little about the motivation behind shared folders in gnome-boxes and the challenges encountered while implementing it. I will also make sure to post a few UI pictures, alongside a very short guide for those of you eager to test this fresh out of the oven feature.
1. Motivation
Being able to share a directory between the host machine and a guest machine is, needless to say, a very convenient way of accessing files from one another. Thanks to the SPICE developers, an API is available which is capable of doing just that. (the only conditions are that the guest machine must have a SPICE display and the spice-webdavd service installed). Considering this, the decision of further implementing shared folders in gnome-boxes is certainly not one to think about twice.
2. Challenges
The first challenge was to implement *multiple* shared folders, considering that the underlying library only supports a *single* shared folder. After many discussions, we followed Marc-Andre Lureau’s suggestion of simply creating symlinks for every shared folder inside a config directory, which is the one eventually shared trough SPICE.
The second challenge was assuring the persistence of shared folders. Once the user has shared a directory, it must remain shared even after restarting the guest machine, GNOME-Boxes or the host machine. Following Felipe Borges’s suggestion, I used Gsettings and Variants, which is a great way of accomplishing tasks like this.
3. Short guide and UI pictures
Since this feature is meant to be as out-of-the-box as possible, the guide is more of a demonstration rather than a tutorial. Enjoy!
- 1st step: Install the spice-webdavd service in the guest machine.
The Linux version can also be installed from the official repositories.
- 2nd step: Play with the new Properties -> ‘Devices & Shares’ section, in GNOME-Boxes.
Make use of the newly added UI in order to choose which folders belonging to the host machine need to be shared with the guest machine.
Note: if no shared folders are selected, the Public folder is shared by default.
- 3rd step: Access the shared folders from inside the guest machine
In case the “Spice client folder” device doesn’t show up at first, make sure to refresh the file manager.
- 4th step: Have some fun !
A big thank you to everybody who has helped me implement this feature: Zeeshan Ali, Felipe Borges, Victor Toso, Fabiano Fidencio and Cristophe Fergeau
spice-webdavd has never worked reliably on windows, at least for me (it would crash immediately while starting the service), and last I checked it hadn’t seen any updates in a long time; was it updated recently to fix the crash?
Otherwise you can’t really claim the feature, if windows support is not there.
LikeLiked by 1 person
Giovani, which windows and spice-webdavd are you using?
I remember Lukáš did some work on webdav while I was still working on SPICE and it used to work (at that time).
Maybe you re hitting https://bugzilla.gnome.org/show_bug.cgi?id=781979 … would you mind confirming this (in the bugzilla) or open a new bug in case you’re seeing something different?
Buona Giornata!
LikeLike
Yeah, it’s the same bug. Still occurring in the latest version.
LikeLiked by 1 person
Have you tried more recent versions of spice-webdav (link below)?
LikeLiked by 1 person
My gnome-boxes (3.24.0, with libvirt 3.2.1 and spice-webdavd 2.1) does not show the “Folder Sharing” section in the properties page. Am I doing something wrong?
LikeLike
Oh, looks like a change on the master branch, which will be released with gnome-boxes 3.24 in autumn…
I like it 😉
LikeLiked by 1 person
Hey Visarion, please update the links to spice-webdavd, you can find the latest release at https://www.spice-space.org/download/windows/spice-webdavd/
LikeLike
Awesome work!
LikeLike
May I ask, is there a tutorial on this anywhere?
LikeLiked by 1 person
On gnome-boxes 3.26 i’m not be able to add shared folder, on the properties i see the function click on + sign and i see the dialog for select folder but nothing appear when click on.
LikeLiked by 1 person
same here I suspect windows file sharing and/or firewall issues – have installed the latest spice-webdavd but I can not select any folder “locally” – playing around with settings.
Could it be we need to change network interface from “realtek” to “virtio” for this to work? Default during install is realtek…
LikeLike
I got Windows 10 x64 now working on a fedora 27 guest with boxes 3.26.2
The trick was to remove anything from spice from the guest and then reinstall the latest spice guest tools from there https://www.spice-space.org/download/windows/spice-guest-tools/ and install the x86 (not x64) from there https://www.spice-space.org/download/windows/spice-webdavd/ . Works also with windows defender enabled.
It seems spice has problems when guest tools are x86 and webdavd is x64.
LikeLike
When is this going to be merged into master? It’s November and still no shared folders in gnome boxes.
LikeLike
I Played around with this for work – a problem is that it is abysmally slow, at least for me on first setup. WebDAV is a much slower protocol than Samba, and I would prefer if Samba was used instead, especially given that IIRC qemu basically has a built in samba server that works via command line, which Gnome Boxes could use under the hood. Hopefully this can get fixed in the future, this is otherwise a very nice virtual machine tool!
LikeLike
Has anybody the same problem, that adding a shared folder from Fedora 28 host to a Windows 10 guest only works if you go in the Properties -> Devices & Shares tab of the VM and save the shared folder a further time everytime you boot up Windows 10?
Otherwise Windows 10 only shows me a “System Volume Information” folder inside the DavWWWroot “partition”.
LikeLike
Yes, I hit exactly this problem. Windows 10 64bit from 1803 iso. No matter if Home or Pro.
Install was done on Fedora 29.
LikeLike
Any chance of having the spice-webdavd drivers able to appear on a virtual CD drive ? This would make installing drivers in the guest pretty convenient.
LikeLike
It seems like this needs the VM to be reset before it takes affect, it would be good if installing the driver in the guest was enough to enable the option in the GUI.
LikeLike
Does not work for me at all on ubuntu 19.10 with gnome boxes. spice folder is there but it fails to open with an https error connection refused
LikeLike
I’m seeing this exact issue. Did you ever find a solution?
LikeLike
Same for me with Fedora 32 guest on Ubuntu 20.4 host. Spice folder is there on client but it fails to open with an https error connection refused
LikeLike
It was reported as #5 “https://gitlab.gnome.org/GNOME/phodav/-/issues?scope=all&utf8=%E2%9C%93&state=closed” and the workround is, Quote:
“Connect to server” -> enter dav://localhost:9843/ for spice shared folder or dav://localhost:8080/ for chezdav>
LikeLike
Thank you very much for this guide. I finally managed to got it work with windows 10!
LikeLike