Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper VirtualBox share folders support for FreeBSD guests #10717

Merged
merged 5 commits into from
Mar 11, 2019

Conversation

briancain
Copy link
Member

@briancain briancain commented Mar 7, 2019

This commit adds proper support for FreeBSD guests when mounting share folders, assuming that the proper guest additions are in place on the guest.

Tested using the bento/freebsd-11 and the generic/hardenedbsd11 guest.

Fixes #8884

This commit adds proper VirtualBox shared folder support for BSD guests.
It is essentially a copy of the linux capability.
BSD guests use vboxvfs module for mounting share folders
Ensure the logger displays the right vbox module used for mounting
shared folders
@thompsa
Copy link

thompsa commented Mar 7, 2019

This change modifies all BSD guest clients. Here is a version which adds it for FreeBSD and also ensures the kernel module exists and is loaded before attempting the mount.

https://github.com/thompsa/vagrant/commit/ee4bb779c2c4775f314d01de6fdbf512db53cef3

@briancain
Copy link
Member Author

briancain commented Mar 7, 2019

Hi @thompsa - from what I understand and through my testing, invoking vboxvfs with the mount command will load the module for you, so checking/loading it with Vagrant is not required. It is also not something we do with other guests when using the virtualbox guest additions:

$ kldstat
Id Refs Address            Size     Name
 1   22 0xffffffff80200000 20647c8  kernel
 2    1 0xffffffff82266000 381130   zfs.ko
 3    2 0xffffffff825e8000 a380     opensolaris.ko
 4    3 0xffffffff825f3000 8b3d8    vboxdrv.ko
 5    1 0xffffffff82819000 2e790    vboxguest.ko
 6    2 0xffffffff82848000 2af0     vboxnetflt.ko
 7    2 0xffffffff8284b000 9a20     netgraph.ko
 8    1 0xffffffff82855000 14b8     ng_ether.ko
 9    1 0xffffffff82857000 3f70     vboxnetadp.ko
$ sudo mount -t vboxvfs vagrant /vagrant
$ kldstat
Id Refs Address            Size     Name
 1   24 0xffffffff80200000 20647c8  kernel
 2    1 0xffffffff82266000 381130   zfs.ko
 3    2 0xffffffff825e8000 a380     opensolaris.ko
 4    3 0xffffffff825f3000 8b3d8    vboxdrv.ko
 5    2 0xffffffff82819000 2e790    vboxguest.ko
 6    2 0xffffffff82848000 2af0     vboxnetflt.ko
 7    2 0xffffffff8284b000 9a20     netgraph.ko
 8    1 0xffffffff82855000 14b8     ng_ether.ko
 9    1 0xffffffff82857000 3f70     vboxnetadp.ko
10    1 0xffffffff8285b000 200b0    vboxvfs.ko

This change should also be just fine for other BSD guests, unless they use a different vbox option for the mount command (like what the original linux cap uses, vboxsf)? The intention is to do away with hard coded error message completely.

@briancain
Copy link
Member Author

Also just tested this using the generic/hardenedbsd11 box and it mounts folders no problem 👍

@briancain
Copy link
Member Author

It does look like mostly only flavors of freeBSD will work with this patch, as the other ones I've tried like NetBSD and openBSD still don't have proper virtualbox guest tools. Happy to move this over to the freeBSD guest since that seems to be the case. The other thing is we could keep this on the BSD guest, and then the support would still be there for whenever those OS's get proper virtualbox guest support. 🤔

@thompsa
Copy link

thompsa commented Mar 8, 2019

Good to know that the module loading isnt needed. The only difference now is the generic bsd vs freebsd layout. If the others don't support it it would be good to retain the existing error message rather than trying the mount and not working.

@briancain briancain changed the title Add proper VirtualBox share folders support for BSD guests Add proper VirtualBox share folders support for FreeBSD guests Mar 8, 2019
Since the virtualbox guest additions seem to only be available for
freeBSD, move the shared folder functionality over to freebsd guests
rather than all BSD guests.
@briancain briancain merged commit e399aea into hashicorp:master Mar 11, 2019
jlduran added a commit to jlduran/vagrant that referenced this pull request Mar 28, 2019
This is a follow-up of hashicorp#10717 to use the same naming convention as on
Linux guests, in order to reduce the diffs.

Also adds the missing capability to `unmount_virtualbox_shared_folder`
on FreeBSD guests.
@simon0191
Copy link

simon0191 commented May 10, 2019

@briancain does this work for MacOS guests?

@briancain
Copy link
Member Author

@simon0191 - No, but macOS guests should already be supported!

@ghost
Copy link

ghost commented Apr 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VBox Shared Folders on FreeBSD Guest Error Out
4 participants