Can only boot Windows 10 through grub. How do I disable this?

Solution 1:

Two part solution:

Part 1: Remove Ubuntu entry from the EFI partition in the internal disk

See: How do I remove "Ubuntu" in the bios boot menu? (UEFI)

Step 1: Boot Ubuntu from a Live DVD/USB in UEFI mode and select Try Ubuntu without installing option.

Step 2: Open a terminal by Ctrl+Alt+T and install efibootmgr:

sudo apt-get install efibootmgr

Step 3: Then add to the kernel efi support

sudo modprobe efivars

Step 4: Then run sudo efibootmgr to check your boot entries. It will return something like this:

BootCurrent: 0004
Timeout: 2 seconds
BootOrder: 2001,0003,0005,0006,0000
Boot0000* Lenovo Recovery System
Boot0001* EFI Network 0 for IPv6 (B8-88-E3-84-F3-EF)
Boot0002* EFI Network 0 for IPv4 (B8-88-E3-84-F3-EF)
Boot0003* Windows Boot Manager
Boot0004* EFI USB Device (SanDisk)
Boot0005* ubuntu
Boot2001* EFI USB Device

Step 5: Then delete the option you dont want. In this example, Ubuntu is entry 5. the following could be called to delete entry 5 and remove it from the BootOrder.

(CAUTION: Before executing the following command make sure you enter the correct Boot entry number)

sudo efibootmgr -b 5 -B 

Step 6: Delete the Ubuntu folder in the EFI partition.

Suppose your EFI partition was /dev/sda2, then mount it on an empty folder anywhere.

sudo mkdir /mnt/efipart
sudo mount /dev/sda2 /mnt/efipart

Now we have to find the directory Ubuntu or any other distro's name in this partition. It is mostly under EFI/distro_name.

Remove that directory and its contents by (PLEASE MAKE SURE YOU ARE DELETING THE CORRECT DIRECTORY)

sudo rm -r ubuntu

This ends Part 1. This is a good time to

Check if it worked

Shut down the computer and disconnect all external drives and remove the Live DVD if you were using one. Start the computer. If all went well, It should directly boot Windows 10 as it did before installing Ubuntu.

Part 2: Fix grub and EFI in the External hard drive where you have Ubuntu

See Is it still possible to install Ubuntu to an external harddrive with UEFI?

Step 1: Again boot Ubuntu from a Live DVD/USB in UEFI mode and select Try Ubuntu without installing option.

Connect the external hard drive with Ubuntu you want to fix. Note down the drive name. Here I will assume it is /dev/sdc, but yours may be different.

Step 2: Install the grub-efi-amd64-bin package.

sudo apt install grub-efi-amd64-bin

This will only install the resources needed. It will not switch your existing MBR style installation to UEFI and turn things upside down.

Step 3: Shrink your Ubuntu partition in GParted to make space for an ESP. Recommended sizes for ESPs range from 100 MB to 500 MB. I made around 250 MB.

Note: It shouldn't matter where your ESP is located on the disk and shrinking your Ubuntu partition by a few megabytes from the end should be quick and safe. Shrinking at the beginning is not safe.

One caveat though, your ESP should be a primary partition and not be part of an extended partition or a logical volume, partition numbers from 1 to 4 are fine, numbers above indicate an extended partition on MBR partition tables.

Choose FAT32 as filesystem and set the boot flag.

Step 4: Mount the ESP partition you just created and the root file system you shrunk.

sudo mkdir -p /mnt/esp
sudo mount /dev/sdc3 /mnt/esp
sudo mkdir -p /mnt/rootfs
sudo mount /dev/sdc1 /mnt/rootfs

Note: In this example, /dev/sdc3 is the ESP partition and /dev/sdc1 is the root partition. Yours may be different. The mountpoints /mnt/esp and /mnt/rootfs are just examples chosen to work with the remaining part of this answer.

Install GRUB's EFI image and a minimal configuration file with:

sudo grub-install --efi-directory /mnt/esp --boot-directory /mnt/rootfs/boot --target x86_64-efi --removable /dev/sdc

Step 5: Check and update /etc/fstab file using the following command:

sudo nano /etc/fstab

Your UEFI installation of Ubuntu may include a line similar to the one below in /etc/fstab.

UUID=1234-567F /boot/efi vfat defaults 0 1

where 1234-567F is an example. If such a line exist, find the UUID of your new EFI partition in the external drive using Gparted or with the command sudo blkid. Update the UUID in the file and save and exit the nano editor with Ctrl+X followed by Y and Enter.

That is it. Now the external drive should boot.

Hope this helps