Sharing a folder between a Linux host and Sabayon Linux as the guest OS in a VirtualBox VM

You probably know that you need to install the VirtualBox Guest Additions in the guest OS in order share a folder between a host OS and a guest OS in a VirtualBox VM. However, of late I have found that shared folders do not work when the guest OS is any of the Sabayon Linux spins, even though I had installed the Entropy package app-emulation/virtualbox-guest-additions and ensured the user in the guest OS is a member of the vboxsf group. Fortunately, it is not difficult to fix this, and below is the procedure I use to get a Sabayon Linux guest to share folders with a Linux host.

Let us say that your username in the host OS is ‘brian‘ and you have created a directory named /home/brian/Shared-brian/ that you want to share with the guest OS (Sabayon Linux), and the username in the guest OS is ‘fitzcarraldo‘.

1. In the VM VirtualBox Manager window, select ‘Settings’ > ‘Shared Folders’ for the VM. Click on ‘Machine Folders’ in the Folders List and then on the ‘Add New Shared Folder’ icon. Specify the folder path /home/brian/Shared-brian, and tick ‘Auto-mount’ and ‘Make Permanent’.

2. Start the VM, login as user fitzcarraldo and open a terminal window. If /boot is on a separate partition, make sure it is mounted.

3. Use the usual Entropy package manager commands to bring the guest OS installation up to date and to install the latest Sabayon Linux kernel image (see one of my earlier posts), then reboot the VM. If /boot is on a separate partition, make sure it is mounted.

4. If the VirtualBox Guest Additions package from the Sabayon Linux Entropy repository is currently installed in the guest OS, uninstall it. If the package has not yet been installed, install it and then uninstall it.

fitzcarraldo@sabayon ~ $ sudo equo remove virtualbox-guest-additions

5. Check if you are in the ‘vboxsf’ and ‘vboxguest’ groups:

fitzcarraldo@sabayon ~ $ groups

If you are not, add the user to the two groups:

fitzcarraldo@sabayon ~ $ sudo usermod -a -G vboxsf,vboxguest fitzcarraldo

6. Check if the latest GNU compiler collection and kernel sources have been installed. If not, install them:

fitzcarraldo@sabayon ~ $ sudo equo install sabayon-sources gcc

7. Check if the Linux kernel headers have been installed. If not, install that package too:

fitzcarraldo@sabayon ~ $ sudo install linux-headers

8. In the menu bar of the VM’s window, select ‘Devices’ > ‘Insert Guest Additions CD Image…’. If you are asked if you want to download the disk image file from the Internet, click on ‘Download’.

9. Use the guest OS’s File Manager to check that the Guest Additions virtual CD is mounted. If it is not, use the File Manager to mount it.

10. Install the VirtualBox Guest Additions from the virtual CD:

fitzcarraldo@sabayon ~ $ sudo /run/media/fitzcarraldo/VBOXADDITIONS_5.1.34_121010/VBoxLinuxAdditions.run

Ignore any warning message about the remnants of an existing version of the Guest Addtions still being installed. Answer ‘yes‘ to the prompt ‘Do you wish to continue [yes or no]‘. There should be no error messages in the terminal output if the GCC, kernel sources and linux kernel headers have already been installed (see the earlier steps above).

11. Reboot the VM and login.

12. In the directory /media/sf_Shared-brian/ in the guest OS you should now see the files that are in the shared folder /home/brian/Shared-brian/ in the host OS. VirtualBox automatically adds the ‘sf_‘ suffix to the directory name in the guest OS, and it stands for ‘shared folder’.

13. In file managers such as GNOME’s Nautilus, MATE’s Caja, LXDE/LXQt’s PCManFM and Xfce’s Thunar you should see the folder /media/sf_Shared-brian listed in the left panel. In KDE’s Dolphin you can right-click in the left panel and add an entry for /media/sf_Shared-brian or, optionally, right-click in the main window and select ‘Create New’ > ‘Basic link to file or directory…’ and create a link in your home directory to /media/sf_Shared-brian/.

I have used the above procedure with recent spins of Sabayon Linux (KDE, GNOME, MATE, Xfce and LXQt), and it works consistently.

About Fitzcarraldo
A Linux user with an interest in all things technical.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.