vbox vbox shared folder content unstable, wrong subdir content depending on order of access

FreeBSD 13.2 virtualbox guest: If the host's root directory is mounted as a shared folder, the contents are randomly there or not there. Not actually random, but it depends on the order of access. It seems like a subdir path can not be used (successfully) unless the parent directories are first accessed by themselves. WTF?
Here's my setup:
* Shared folder name in Vbox is "ROOT", host path is "/", read-only, NO automount
* In freebsd guest:
Code:
sudo mount -t vboxvfs -o uid=1001,gid=1001 ROOT /mnt  # 1001 is my uid
ls /mnt
  (shows bin, etc, home, etc.)
ls /mnt/home
  (shows user homedirs, including mine ("jima")
ls /mnt/home/jima
  (shows expected files)
BUT...
Code:
sudo umount /mnt
sudo mount -t vboxvfs -o uid=1001,gid=1001 ROOT /mnt  # [I]exactly same as before[/I]
ls /mnt/home/jima
  ls: /mnt/home/jima: No such file or directory
ls /mnt
  (looks correct)
ls /mnt/home
  SHOWS CONTENTS OF MY HOME DIRECTORY,  not contents of /home on the host
ls /mnt/home/jima
What the heck could be causing this ??
----
There's nothing obvious in /var/log/messages, just the following when the mount is done:
Code:
Jun 14 17:39:21 freebsd kernel: VBOXVFS[1]: sfprov_mount: Enter
Jun 14 17:39:21 freebsd kernel: VBOXVFS[1]: sfprov_mount: path: [ROOT]
Jun 14 17:39:21 freebsd kernel: sfprov_mount(ROOT): error=0 rc=0
IIRC, I did this during installation:
(started with the pre-built .vmdk machine image)

Code:
pkg install emulators/virtualbox-ose-additions
sysrc vboxguest_enable="YES"
sysrc vboxservice_enable="YES"
pw groupmod wheel -m test # 'test' is my username
 
I left out that I installed the GAs with
pkg install emulators/virtualbox-ose-additions

And the host is running Virtualbox 7.0
 
I have been trying to follow your example but I can not get anything to share.

Do you have start to finish steps?

Thanks
 
Do you have start to finish steps?
I know very little about FreeBSD, so take this part with a huge grain of salt!
The reference I used was
https://freebsdfoundation.org/freebsd-project/resourcesold/installing-freebsd-with-virtualbox/

A. Start the VM and log in
sudo pkg install emulators/virtualbox-ose-additions
Edit /etc/rc.conf and append the following two lines.
vboxguest_enable="YES"
vboxservice_enable="YES"
B. sudo shutdown -H now
(wait for VM to shut down)

1. With the VM off, start the Virtualbox GUI program
2. Select the VM in the left panel, then click "Settings" in the top bar.
3. In "Settings", click "Shared Folders" in the left panel
4. Click the "+" folder icon in the upper right to add a shared folder definition.
In the "Add Share" pop-up which appears, put "/" in the Folder Path and "ROOT" in the "Folder Name" (it might auto-populate with ROOT for you). Set Mount point to "/media/sf_ROOT" if it does not auto-populate. CLICK "Read-only" checkbox, but do *not* click "Auto mount" (auto-mounting vbox shares is not supported on FreeBSD). then OK.

5. To have the same setup as I did, repeat the same procedure to share /tmp under Folder Name "tmp", mount point "/media/sf_tmp", but do not check "Read only".

6. Start the VM, log in, and follow the instructions in the original post to mount the "ROOT" share under /mnt (or anywhere you like).
 
KenUnix -- I realized afte replying that you might not have a working FreeBSD VM. Here is how I created one:

1. Download https://download.freebsd.org/ftp/re...d64/Latest/FreeBSD-13.2-RELEASE-amd64.vmdk.xz
2. unxz FreeBSD-13.2-RELEASE-amd64.vmdk.xz
3. In VBox Manager, add the .vmdk file to the Media Manager and then make a .vdi copy which can extend to a larger size, e.g. 20GB, like this:

(3a) Click "Tools", then in the adjacent menu, "Media"; (3b) Under "Hard disks", click the "Add" button and navigate to the .vmdk file; (3c) Select the .vmdk file you added and click the "Copy" button, select "VDI" as the disk file type; Next; do not check pre-allocate; Next; Set the max size of the disk to about 20 GB; Finish. Now, if you want, you can delete the .vmdk file from the Media Manager and also from disk.

4. Create a new VM *without* a hard drive; then Modify the vm to add the .vdi file as the hard drive (click the "+"Hard Disk icon ...).
5. (important) Set Display->Graphics Controller to "VBoxSVGA" with 3D Accel OFF. Otherwise xorg won't work.
6. Start the VM and proceed as described previously.
 
After 9 hours it finally finished but still no go. I'm afraid this is not worth the aggravation.

Giving up on FreeBSD. Thanks for trying.
 
How long does the compile take??? It's been running for over 4 hours doing:
# cd /usr/ports/emulators/virtualbox-ose-additions && make install clean
Yes, the program does seem to advance... But it is taking soo long.
I encountered the same thing. I gave up, restored a VM snapshot to start over, and just installed the pre-built package with sudo pkg install emulators/virtualbox-ose-additions
 
Jimav,

I took another road and installed GhostBSD with better success.

1 problem sometimes you double click on an icon on your desktop and nothing happens.

Ken
 
I have Freebsd 13.2 running as a guest on Windows 10. One folder from windows is shared (writable) with frebsd VM/guest and I can "automount" it in rc.local during the boot. All seem to work but I'm running a process on windows host which creates a file in the same shared folder, the freebsd guest has a process which need to delete that file time to time. When windows host re-creates that file again the freebsd guest cannot see that file in the shared folder (ls -l path/filename simply report "No such file or directory"). How can it be?

If I unmount and then mount again vboxvfs then file is accessable again. Is there any way to fix this issue without remounting?
 
Back
Top