Cannot mount shared folder if file exists with same name

Discussions about using Linux guests in VirtualBox.
Post Reply
CaryJ
Posts: 2
Joined: 4. Jan 2022, 00:42

Cannot mount shared folder if file exists with same name

Post by CaryJ »

I have been fighting a problem mounting shared folders, and have narrowed it down to having a file or directory in the current directory with the same name as the shared folder. Here is a simple example where the first attempt succeeds but subsequent attempts with a file or folder with the conflicting name fails, even though the mount point is different than the local file.

Note that I have a shared folder with the name "qemu".

Code: Select all

[vagrant@jdevelop:~]$ sudo mount -t vboxsf -o uid=1000,gid=1000 qemu /qemu
[vagrant@jdevelop:~]$ sudo umount /qemu
[vagrant@jdevelop:~]$ touch qemu
[vagrant@jdevelop:~]$ sudo mount -t vboxsf -o uid=1000,gid=1000 qemu /qemu
/sbin/mount.vboxsf: shared folder '/home/vagrant/qemu' was not found (check VM settings / spelling)
[vagrant@jdevelop:~]$ rm qemu
[vagrant@jdevelop:~]$ mkdir qemu
[vagrant@jdevelop:~]$ sudo mount -t vboxsf -o uid=1000,gid=1000 qemu /qemu
/sbin/mount.vboxsf: shared folder '/home/vagrant/qemu' was not found (check VM settings / spelling)

VirtualBox 6.1.30 r148432
GuestAdditions 6.1.30
Host macOS Monterey 12.1
Guest CentOS Linux release 7.9.2009 (Core)
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Cannot mount shared folder if file exists with same name

Post by mpack »

That will be a limitation of the guest OS. Choose a name that doesn't conflict.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Cannot mount shared folder if file exists with same name

Post by fth0 »

If you're asking yourself if the behavior is correct or not, it depends on whether mount or mount.vboxsf interprets the device argument first. If it was mount, then the behavior would be expected. If it was mount.vboxsf, then one could argue that it should only consider Shared Folder names.
CaryJ
Posts: 2
Joined: 4. Jan 2022, 00:42

Re: Cannot mount shared folder if file exists with same name

Post by CaryJ »

I'm not positive, but I believe this worked with previous versions of vbox/guest. That's my assumption because the vagrantfile I'm using that gets into this situation was given to me by others and it used to work for them. I'm on a different host (mac) and not sure if the others were using vbox with vagrant or something else.
Post Reply