utmapp / UTM

Virtual machines for iOS and macOS
https://getutm.app
Apache License 2.0
26.36k stars 1.32k forks source link

Name of shared folder changed from "shared" to "share" #4801

Closed lelegard closed 1 year ago

lelegard commented 1 year ago

Describe the issue
On a Ubuntu VM, in UTM configuration, I declare a shared folder the name of which is shared (a subdirectory of my home directory in the macOS host). In the Ubuntu guest, the name of the device becomes share, without the trailing d.

Is this intended?

Configuration

In the UTM settings for the VM, we see this (UI in French, sorry, but we clearly see the name "shared"): image

I try to mount it in the guest:

# mkdir /shared
# mount -t 9p -o trans=virtio -o version=9p2000.L shared /shared
mount: /shared: special device shared does not exist.
       dmesg(1) may have more information after failed mount system call.
# dmesg
...
[  345.016441] 9p: Installing v9fs 9p2000 file system support
[  345.016827] 9pnet_virtio: no channels available for device shared
#

The mount message "special device shared does not exist" may indicate that the definition of the shared folder was not passed to the VM. In the qemu command, as generated by UTM, the related options are:

  -fsdev local,id=virtfs0,path=/Users/lelegard/shared,security_model=mapped-xattr
  -device virtio-9p-pci,fsdev=virtfs0,mount_tag=share

Note the mount_tag=share.

Using the name share instead of shared works:

# mount -t 9p -o trans=virtio -o version=9p2000.L share /shared
# mount | grep share
share on /shared type 9p (rw,relatime,sync,dirsync,access=client,trans=virtio)
#

This issue is not severe because a workaround is obvious. But it took time to identify the difference between shared and share. This may be a valid behaviour but some explanations would be welcome.

lelegard commented 1 year ago

After several tests, it seems that UTM can only declare one single shared folder and that the mount tag is always named share, regardless of the original directory name on the host.

I was confused by the name of my shared directory, named shared, for which share seems to be a truncated version.

I was used to other hypervisors such as VirtualBox or Parallels where you can define multiple shared folders and the name of the corresponding "device" in the guest is, by default, the name of the original directory.

You may close this issue if there is no other useful information to provide.

osy commented 1 year ago

Right, the name will always be "share". I thought that allowing the name to be changed would be more confusing because a) if there's spaces in the name what happens to the share? and b) the name of the tag doesn't matter much because when you are mounting it you specify the mount point on the VM.

lelegard commented 1 year ago

Thanks @osy for the answer. With only one possible shared folder, using a hard-coded name makes sense. And "only one possible" is not a real limitation since all my VM's on VirtualBox and Parallels have only one shared folder anyway, despite the possibility to have more.

abulka commented 1 year ago

Seems all my many shared directories are within my one mounted volume sudo mount -t virtiofs share /Volumes/stuff.