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

Projects
None yet
4 participants
@briancain
Copy link
Member

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

briancain added some commits Mar 7, 2019

Fixes #8884: Introduce proper VirtualBox shared folders for BSD
This commit adds proper VirtualBox shared folder support for BSD guests.
It is essentially a copy of the linux capability.
Update from vboxsf to vboxvfs
BSD guests use vboxvfs module for mounting share folders
Update logger to display vboxvfs module rather than vboxsf
Ensure the logger displays the right vbox module used for mounting
shared folders
@thompsa

This comment has been minimized.

Copy link

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.

thompsa@ee4bb77

@briancain

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member Author

commented Mar 7, 2019

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

@briancain

This comment has been minimized.

Copy link
Member Author

commented Mar 7, 2019

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

This comment has been minimized.

Copy link

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

Only enable shared folder mounts on freebsd guests
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 force-pushed the briancain:add-vbox-share-folders-bsd branch from 1532938 to 2f0c66f Mar 8, 2019

@briancain briancain merged commit e399aea into hashicorp:master Mar 11, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

jlduran added a commit to jlduran/vagrant that referenced this pull request Mar 28, 2019

BSD: VirtualBox shared folders naming convention
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

This comment has been minimized.

Copy link

commented May 10, 2019

@briancain does this work for MacOS guests?

@briancain

This comment has been minimized.

Copy link
Member Author

commented May 13, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.