1

I'm struggling with getting VirtualBox to start a virtual machine using an external USB disk, instead of a virtual hard disk.

When I try to start the VM, it does not start and I see the error:

Failed to open a session for the virtual machine Test2.
The virtual machine 'Test2' has terminated unexpectedly during startup with exit code 1 (0x1).
Result Code: NS_ERROR_FAILURE (0x80004005)
Component: MachineWrap
Interface: IMachine {85632c68-b5bb-4316-a900-5eb28d3413df}

The VM logs are empty.

The USB disk already boots correctly if I choose it as boot device from BIOS. (It has 2 partitions, an MBR bootloader, working grub2 config and an OS in each partition.)

To setup the VM environment, I:

  • Installed VirtualBox on Ubuntu 20.04 desktop using the "Ubuntu Software" GUI
  • Configured my user account's groups with: sudo usermod -a -G disk $USER and sudo usermod -a -G vboxusers $USER
  • Created a virtual hard drive file pointing to target physical drive with: VBoxManage internalcommands createrawvmdk -filename /home/james/VirtualBox-targets/OS-on-dev-sdb.vmdk -rawdisk /dev/sdb
  • chmod a+rw on the target drive & its partitions /dev/sdb*
  • Opened VirtualBox > File > Virtual Media Manager. Checked virtual HDD is visible. Changed its Type to "Writethrough".
  • Created a new VM, opened its Storage section and added the virtual HDD OS-on-dev-sdb.vmdk as a new Hard Drive under Controller:IDE

I try starting the new VM, using Virtual Box > [VM] > Normal Start. The error appears consistently every time.

So far, I've tried:

  • Rebooting a few times
  • Uninstalling VirtualBox, removing the VMDK files, removing the VM folders, downloading & re-installing Oracle's .deb, reconfiguring the same raw disks and VMs as above. See same error message.
  • Configuring the VM storage as IDE then as SATA (I am pretty sure the physical USB drive is IDE)
  • Creating the raw disks with -rawdisk /dev/sdb and with -rawdisk /dev/disk/by-id/wwn-...
  • Checking the USB disk still boots okay if chosen from BIOS boot devices.

Update: @FedKad's pointer helped. The extension pack meant the VM got a step further.

The VM now loads the grub bootloader & the bootloader's menu options are presented. An option can be selected.

However, each option raises a similar error:

Waiting 10 seconds for device /dev/disk/by-uuid/e95e5… <etc>
ERROR: device 'UUID=e95e5… not found. Skipping fsck
…
You are now being dropped into an emergency shell

It looks like the linux kernel is not being properly connected with its partition.

Tried a few permutation of VM virtual HDD and USB device settings.

With VM started and no USB device selected, see grub menu in VM. On selecting an OS, see same error:

ERROR: device 'UUID=e95e5… not found. Skipping fsck

With VM started and when grub menu appears select USB device, see new error:

Error: no such device: e95e5…

With USB device filter setup for external drive before VM starts & then VM restarted:

FATAL: Could not read from the boot medium! System halted.

Tried UUID VM instead. With USB filter setup:

FATAL: Could not read from the boot medium! System halted.

Tried some reboots and repeats. See same problem.

james-h
  • 43
  • Does this answer your question? How to set up USB for Virtualbox? – FedKad Mar 18 '22 at 19:15
  • Looks promising. I downloaded & tried installing the extension. I see a new error "The installer failed with exit code 1: VBoxExtPackHelperApp: error: The owner is not root: '/usr'." I tried rerunning under sudo, then as root. See the same problem, even when running VB as root. Any ideas? – james-h Mar 18 '22 at 21:36
  • To clarify, you want VirtualBox to use an external disk rather than its own virtualized storage, and you want that external disk to allow booting as well? Is the goal simply to install Ubuntu on the external disk so it can be used elsewhere? – matigo Mar 18 '22 at 23:05
  • I've resolved installing the extension. Turned out /usr had iffy ownership perms. Once this was sorted, the extension installed fine. Just needed to doubl-click on the downloaded file & follow the prompts. – james-h Mar 18 '22 at 23:50
  • @matigo - Yes, I want to use the external disk rather than virtualised storage & yes I want to boot the virtualised OS from the external disk. The goal is to run a set of experimental OS installations on a replaceable external disk, and to run them from within an established and stable OS. VirtualBx looks like a potentially useful approach. – james-h Mar 18 '22 at 23:54
  • 1
    For what you’ve described, VirtualBox is wholly unnecessary. Install the OSes you wish to test on the external drive, leaving the internal storage device alone. Either that, or store the .vdi that VirtualBox uses on the external disk as it is – matigo Mar 19 '22 at 00:21
  • @FedKad - The USB extension has taken things a healthy step forward. There's still something blocking the OS starting. I've added an uodate to my post. – james-h Mar 19 '22 at 02:08
  • @matigo - I may not have explained myself very well. My target environment is to boot the machine into a known good, stable OS. This provides me with internet access, my research documents etc. From within this stable OS I want to experiment with unstable OS on the same machine, while retaining internet & document access. Hence the external drive/VirtuaBox approach. This contrasts with boot from BIOS into the unstable OS, where I lose access to the network, docs etc. – james-h Mar 19 '22 at 12:48
  • Why are you so intent on having the VM not use a virtual disk image, though? There is no benefit — that I can see — to using the external disk as a non-virtual device. Performance will be the same. Is the goal to later have the host OS interact with files on the external when the VM is not running? – matigo Mar 19 '22 at 13:56
  • @matigo Ah! I (finally!) understand what you meant. Virtual disk image located on the external USB drive. A good idea. It's not 100% what I need, as I would still need to boot into the external drive OS directly from BIOS, once all the setup and what not was done via the stable Ubuntu OS and VirtualBox. Unless these virtual disks can be presented to BIOS as normal disk partitions somehow? In which case, this would be a great idea. – james-h Mar 19 '22 at 16:31
  • Virtualization does not use the BIOS. It presents itself as a complete system to the client OS. Using VirtualBox (or other virtualization tools) removes the need for over complicated setups. VMs are meant to be treated as disposable appliances, not carefully-configured installations – matigo Mar 19 '22 at 21:20

0 Answers0