Mounting Shared Folder in VirtualBox on OS X for ESP8266 SDK

Espressif have packaged the GCC-based toolchain for ESP8266 as a VirtualBox appliance running lubuntu which makes it super easy to get started with compiling your own firmware for the module.

All your code is expected to go in a shared folder on your host machine (OS X or Windows) that you mount to the virtual machine by running the mount.sh script at /home/esp8266:

#!/bin/sh
sudo mount -t vboxsf share /mnt/Share

The problem with this script is that all files in that shared folder will be owned by root:root and the compiler running as user esp8266 will fail to create new files and include the necessary libraries. I am not sure if this is an issue only when running OS X as the VirtualBox host.

VirtualBox shared folder files owned by root in ESP8266 SDK

The solution is to specify the correct owner (user and group) for the mounted files. We figure that out by running umask && id from the terminal:

$ umask && id
0002
uid=1000(esp8266) gid=1000(esp8266) groups=1000(esp8266),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),118(sambashare)

User and group permissions for ESP8266 build tools

Then we modify the mount.sh script to include the following option:

#!/bin/sh
sudo mount -t vboxsf -o umask=0002,gid=1000,uid=1000 share /mnt/Share

and mount the shared folder by running

$ ./mount.sh

Which results in shared folder being mounted with the correct permissions:

Correct user and group permissions for ESP8266 build tools and SDK

Never lose a single business lead or enquiry again! Get my latest plugin Storage for Contact Form 7 now!

Buy now for only $19 →

Leave a Reply