Page 1 of 1

Grub can't detect USB

Posted: 29. Apr 2017, 13:37
by vboli
Hi,
i'm using VirtualBox 5.1.22. I created a VM and installed Ubuntu 17.04 (with Grub) on it. I put another linux distro on an USB to start from it via Grub.
I clicked on my VM -> Settings -> USB -> Enable USB Controller -> USB2 (EHCI) and checked my USB in the list.
Then i started my VM and pressed "ESC" while in Grub. After entering the command line with "c" i type

Code: Select all

ls -l
to list my disks but i only see

Code: Select all

(hd0) (hd0, msdos1)
I can't see my usb device. I also installed the extension pack to be able to select the USB2 (EHCI) option in the USB Settings but nothing changed.
Is this a virtualbox problem?

Re: Grub can't detect USB

Posted: 29. Apr 2017, 14:56
by mpack
The VirtualBox BIOS does not provide USB boot support. USB drivers are loaded by the guest OS after boot, not pre-boot by the VirtualBox BIOS.

Re: Grub can't detect USB

Posted: 29. Apr 2017, 15:37
by vboli
Ok i see, but if i'm at the bootloader (Grub2) already, shouldn't it behave like a physical system and detect my USB?
At this point the system should be able to load drivers shouldn't it?
I mean the disk (partition) the OS is running on, is been detected too.

Re: Grub can't detect USB

Posted: 29. Apr 2017, 15:45
by Perryg
At this point the system should be able to load drivers shouldn't it?
At this point all that is started is the kernel AFAIK. can you even run lsusb and get a positive reply?

Re: Grub can't detect USB

Posted: 29. Apr 2017, 15:47
by vboli
When in the Grub2 bootloader menu, the kernel is NOT started yet! I want to select the kernel on my USB to start another distro other then the one installed on my VM disc.
lsusb command does not work in Grub2 bootloader.

Re: Grub can't detect USB

Posted: 29. Apr 2017, 16:06
by Perryg
Since boot to USB is not in VBox BIOS the only way to get it to work is with device drivers. The only way around this AFAIK is by using RAW with the USB device and attach it as a drive not as a USB device.
While the following is not exactly the same the concept is and you should be able to modify it to your needs:
http://www.virtualbox.org/manual/ch09.html#rawdisk

By the way this is not totally accurate either:
"When in the Grub2 bootloader menu, the kernel is NOT started yet!"
A subset of the kernel is actually loaded in memory and passes control to the MBR so while it may seem that the kernel is not loaded to you is does to me. Otherwise you could boot to the grub screen with nothing but grub in the disk.

Re: Grub can't detect USB

Posted: 29. Apr 2017, 16:46
by mpack
vboli wrote:Ok i see, but if i'm at the bootloader (Grub2) already, shouldn't it behave like a physical system and detect my USB?
It behaves exactly like a physical system which has no understanding of USB encoded in its BIOS. Is grub (meaning the entire environment running at that moment) capable of using USB devices without help? If yes then it can use a USB mass storage device. If no then it cant.