Problem about updating library examples through VirtualBox

I am using a ubuntu 16.04 on VM VirtualBox for developing and recently as I was following the developer’s guide to upload the library examples sketches (e.g. the examples/INS_generic) to pixhawk, I’ve always had the following problem: using the waf for building (./waf build --target examples/INS_generic --upload), after the files are compiled and built, the terminal displays that “If the board does not respond within 1-2 seconds, unplug and re-plug the USB connector.” However, no matter how I try (switching on and off the pixhawk connection in Devices/USB/ or physically plugging in and out the connector), the terminal hangs there and can only be interrupted with ctrl+c.
Normally, I upload the arducopter firmware to the pixhawk board thru QGroundControl on Windows 10 and everything goes smooth. When trying to solve the problem, the only way I found is to first use the QGroundControl to flash the firmware on Windows, and then use the waf command to build and update in the linux virtual machine. This way, the example sketch could be uploaded correctly and tested out. Yet, after uploading once the example sketch, other example sketches could not be uploaded and the above mentioned problem occurs. And again, the only way to deal with it is to switch to Windows and use QGroundControl to flash the firmware.
So I was wondering whether there is a better solution for this?

I tried using waf and make command to build and upload the whole arducopter firmware, however for waf command, I get the same message as mentioend, for make command I get the following:
Attempting reboot on /dev/serial/by-id/usb-3D_Robotics_PX4_FMU_v2.x_0-if00 with baudrate=57600…
If the board does not respond, unplug and re-plug the USB connector.
And still, after the building, the pixhawk board reboots or connects/disconnencts from my computer (the plugging in/out could be heard thru Windows), and even if I select the pixhawk board in Devices/USB/ of the virtual machine, the pixhawk just reboots/disconnects and the terminal hangs there.

Your VM may suffer the same issue with USB permissions that Bash on Windows has, detailed here: http://ardupilot.org/dev/docs/building-ardupilot-onwindows10.html
Check your VM settings though: there may be a simple checkbox.

I checked settings but everything related to the USB is permitted so I think the USB permission is ok. Normally, I can connect through mavproxy to the board and watch. Also I am able to build and upload the example sketch in my VM once I manually flash the firmware using QGroundControl on my host Windows, just afterwards if I want to upload another example sketch, the problem occurs.

Hello,

On virtualbox to correctly use the USB port you need to install the extension pack on host (https://www.virtualbox.org/wiki/Downloads) and on VM the additional package (you should be able to mount the additional iso directly to install this part, but don’t forget to install dkms : sudo apt install dkms)

Thanks, but I already installed the extension pack and the additional package. Though I tried out to install dkms, and the problem remains unfortunately. And now the virtual machine became quite volatile with respect to the USB connection. For instance, after the terminal shows the message “If the board does not respond within 1-2 seconds, unplug and re-plug the USB connector.”, when I manually uncheck the pixhawk in Devices/USB and then check it again, the virtual machine might just crash with memory read/write error. :joy: Really confused about what’s the problem, since I can manage to connect to the board thru mavproxy and watch the USB port (from time to time), so the USB connection should be somewhat ok.
I was wondering whether it has to do with using VM for developing? What’s your experience with developing on VM? If it works out then I might need to reinstall the whole VM for good.

Hello,

Maybe it is little late and you won’t see but i have encountered the same error…
Using a VM (oracle virtual box) with ubuntu 16.04 and trying to build and upload the examples as it is explained in the documentation.

the terminal displays that “If the board does not respond within 1-2 seconds, unplug and re-plug the USB connector.”
i have downloaded the extension pack and also have created a filter for the board.
Did you find a solution to your problem? It would be so great if you found.
Thank you in advance.

Hi Jimmy,
Yes, later on I solved the problem by switching to VMware. Supposedly, the problem was with the USB driver of Virtual Box, where it could not detect the bootloader mode of Pixhawk and, hence, it could not upload the firmware.

Oh i see,
so i will try to change from Oracle virtualbox to another VM and i will update the status and i will let you know but thank you for your prompt answer.
Have a nice day!

Dear Vincent,
Just to update you, after switch to VMware, i could upload the code too so as you said, i guess there is a problem in the USB drive of Virtual box.
Thank you