Page 1 of 1

Debian Guest on External Drive won't Finish Booting

Posted: 2. Feb 2017, 18:12
by joshuamoore
I just installed Debian Stretch on an external USB laptop drive. The drive boots normally when I don't use VirtualBox, but it will not boot when I try to use it in a virtual machine.

The drive uses an EFI partition, so after setting up the virtual machine, I navigate to the grubx64.efi file and begin booting. At that point I see the Grub menu. If I let it boot normally, it will hang at a line about checking inodes, blocks, and files. When I use rescue mode, it hangs on lines about not having a floppy interface. The hard drive icon will generally have a red dot blinking on it, but it doesn't look like anything is happening. If I use the menu for ACPI shutdown, I'll see a flash of the shutdown messages.

Any idea what might be happening or how to troubleshoot this?

Re: Debian Guest on External Drive won't Finish Booting

Posted: 2. Feb 2017, 20:15
by mpack
The usual mistake is to kick off the VM with the host owning the drive, then part way through the boot ownership is yanked by a USB filter and assigned to the VM. OS's don't like having their boot drive disappear in the middle of a boot.

Re: Debian Guest on External Drive won't Finish Booting

Posted: 6. Feb 2017, 02:13
by joshuamoore
Thanks for the feedback. I don't think I understand what you mean by the ownership change.

The host is Windows 10 and the drive is partitioned for a standard Debian desktop with EFI, swap, and ext4. Windows doesn't recognize it with a drive letter or anything but it's listed as Drive 1 with the diskmgmt tool.

Is there something else that is normally done? I've used this process successfully in the past with older non-efi drives, and never had to do anything special in Windows.

Re: Debian Guest on External Drive won't Finish Booting

Posted: 6. Feb 2017, 11:47
by mpack
Do you have a USB filter enabled for the host drive that the VM is on?

USB is not designed to let PCs share devices. One PC owns the device. If your VM (which is a separate PC) grabs ownership then your host must lose ownership, and hence lose the use of that drive. If the VM was booting up from that drive then it will fail.

Note that the host drive is not the same as the VMs virtual drive, represented by a container file on the host drive.

Re: Debian Guest on External Drive won't Finish Booting

Posted: 6. Feb 2017, 16:16
by joshuamoore
I just looked up how USB filters work in VirtualBox, and now I think my description might not have been specific enough. My host OS (Windows 10) is on an internal SSD, factory installed by Dell, with an up-to-date version of VirtualBox installed. I created the VMDK file to point to an external USB backup drive, added that file as a storage device in my VM, and I don't have any USB filters set. The USB drive is set up separately with a normal Debian install, and I can boot into it by selecting it in the UEFI boot menu when I turn the computer on. However, if I boot into the internal drive with Windows, I can't get the Debian drive to finish booting, even after I enable EFI and select the EFI file on the external drive. I'll see grub pop up and a couple status messages during the boot process, but then it appears to freeze.

I suppose it's possible that it's just taking a really long time to boot, but the computer is new with a Core i7 processor. Booting directly into the USB drive only takes about 15 seconds, and when I've done this with other drives (older Debian installs without EFI support) I don't see any significant delay during the VM boot process.

Re: Debian Guest on External Drive won't Finish Booting

Posted: 6. Feb 2017, 17:25
by Perryg
RAW access with a Windows host requires the use of administrator IIRC. So perhaps you have a permission issue. I don't advocate using RAW for most users due the the inherent danger it implies. Even if you get this going trying to use it in both worlds, virtual and real, you more than likely will have issues with one or both. Have you read the manual on this type of access and the dangers involved?

Re: Debian Guest on External Drive won't Finish Booting

Posted: 7. Feb 2017, 04:18
by joshuamoore
Well, now you have me a little worried. I'll get into the manual to read about it a little more. Maybe you have a good link?

I'm familiar with the need to run things as administrator. The other times I've done this involved a drive out of a computer that had a motherboard failure. I wanted to get in quickly for some specific tasks, and this seemed convenient. The drive ended up failing a short while later. After I removed it from the failed motherboard, I only used it when attached to the virtual machine. Hopefully, that didn't contribute to the drive failure. :-/

In this case I actually WANTED to use the drive in "both worlds" because of some of the ways I'll be working with it. Even if I can't minimize the risks and decide not to do this, I'm still curious as to why the drive won't finish booting. Normally, I'm pretty good at troubleshooting, but I've been stuck on this for a while. I've got it moving through Grub and much of the initialization, but then things just stop. For now, I'm booting directly to that drive when I use it.

Re: Debian Guest on External Drive won't Finish Booting

Posted: 7. Feb 2017, 05:06
by Perryg
Here is your online like. http://www.virtualbox.org/manual/ch09.html#rawdisk

Read it carefully and a Windows user will need to help as I have told you all I know not be a Windows user and the fact that I do not assist anyone with RAW for obvious reasons. I have used it to test with on Linux and it works fairly easily in that architecture but you have to be careful and not miss any steps or try to access the drive with the host while it is active. Other thing will be the guest additions. You may want to install them but this can make the drive not boot or work properly when you actually native boot it.