I’ve just installed an Alpine VM into VirtualBox in order to test some stuff without affecting my system.
This is really handy because allows me to install and test multiple Docker’s environments on a single server.
While i was following the official tutorial about VirtualBox shared folders in Alpine i got stuck into this error:
depmod: can't open 'modules.builtin': No such file or directory Executing kmod-23-r1.trigger depmod: WARNING: could not open /lib/modules/4.9.44-0-virthardened/modules.order: No such file or directory depmod: WARNING: could not open /lib/modules/4.9.44-0-virthardened/modules.builtin: No such file or directory
Obviously mounting from host machine was working and had to find a workaround:
First I deleted these packages just pseudo-installed:
apk del virtualbox-guest-additions virtualbox-guest-modules-virthardened
Then I tried to install another package as mentioned on this tutorial but it wasn’t working too.
How to Fix:
I decided to switch system to edge release using rolling development packages, you can find instructions here. (Yes, it’s red otherwise you would have jumped it)
After a (useless?) reboot I tried to reinstall guest-modules stuff:
apk add virtualbox-additions-grsec
If you get errors maybe you have to add a repo and update your packages list:
echo "http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories apk update
Then we have to say Alpine that there are new drivers:
echo vboxpci >> /etc/modules echo vboxdrv >> /etc/modules echo vboxnetflt >> /etc/modules
Then I installed another package: (Maybe I could have installed this before… but in this order it was working 😉 )
apk add virtualbox-guest-additions virtualbox-guest-modules-grsec rc-update add virtualbox-guest-additions default reboot
Mount a shared folder
mount -t vboxsf shared_folder_name_on_VB /destination/folder
Then you can try to create a file inside the new mounted shared folder, if you get a “Protocol Error” try to add your user to vboxsf group and change folder permissions on host: the user who is running VBox must have write permissions on shared folder.
Add persistence across reboots
We have to edit /etc/fstab in order to auto-mount our loved partition; add these lines at the end:
shared_folder_name_on_VB /destination/folder vboxsf uid=0,gid=102 0 0
Where uid=0 is my root’s id and 102 is the id of vboxsf‘s group in my system; you can check your using cat /etc/group