1

I've installed Windows 10 on an external USB 3.0 HDD. Currently, the only way I can boot it is by going into my BIOS boot options and choosing it from the list.

I've installed Ubuntu 16.04 on an internal M.2 SSD, but the Ubuntu installer didn't automatically add an option for GRUB2 to boot the external drive like I expected.

I'm not sure how to add a menu entry which tells grub to boot from the external drive which has Windows 10 installed. I know I can use the search command with the external drive's uuid to set the root variable, but I'm not sure how to use the boot command after that, or which file to edit to add boot options.

UPDATE: I ended up doing something like the accepted answer, but much simpler

menuentry "Windows 10" {
    set root=(hd0,msdos1)
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
  • Well, The "Simplicity" you added to the answer might cause some problems and run windows on other drives, or not run windows if you plug in extra USBs. I think. – aliqandil Oct 11 '18 at 2:39
1

Typically Grub runs os-prober on mounted partitions and adds entries automatically.

For custom menu entries you can add your own configuration to /etc/grub.d/40_custom. I'd recommend this option because relying on os-prober requires that the partition of the other OS is always mounted whenever Grub's configuration is updated, which is the case when update manager installs a new Linux kernel or updates the grub package itself (e.g. security updates).

For the next steps I assume your Ubuntu boots with UEFI and Windows 10 does the same, if that's not the case look here or in the MBR section of the the article in the Arch wiki where I borrowed the following code from:

menuentry "Microsoft Windows Vista/7/8/8.1 UEFI-GPT" {
    insmod part_gpt
    insmod fat
    insmod search_fs_uuid
    insmod chain
    search --fs-uuid --set=root $hints_string $fs_uuid
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

Place this in your 40_custom and replace the $hints_string and $fs_uuid variables with the output from the grub-probe commands. To do that you need to mount the EFI system partition (that's what ESP stand for) of the Windows To Go drive. The easiest way is to launch gnome-disks, select your drive and the partition, then click the play button (‣) and note where it mounted the drive (usually /media/your_username) and replace $esp with this string (add quotation marks if necessary) in the following commands:

# fs_uuid
grub-probe --target=fs_uuid $esp/EFI/Microsoft/Boot/bootmgfw.efi

# hints_string
grub-probe --target=hints_string $esp/EFI/Microsoft/Boot/bootmgfw.efi
  • See my update, thanks though! – Broseph Aug 1 '16 at 3:24
1

Try simply telling GRUB to attempt to detect other OSs.

Lauch a terminal (CTRL+ALT+T), and run the following command:

sudo update-grub

If that doesn't work, try booting from a live DVD/USB and running this command from the terminal:

sudo grub-install /dev/sda #Replace block accordingly
  • The question is about a removable drive, why do you assume that it is already mounted and that it will always be mounted when update-grub is triggered? Yours is an example of poor quality answers based on too many assumptions and not leveraging the open source nature of the system (package filelists like packages.ubuntu.com/xenial/amd64/os-prober/filelist, the whereis command to find out which script calls what). Please take more effort when answering such kind of questions. – LiveWireBT Jul 31 '16 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.