1

I'm attempting to load Windows 10 and two different installations of 16.04 LTS (with potentially other distributions in the future). I've installed Win10, 16.04 v1 and 16.04 v2, but when I run sudo update-grub only the installation of 16.04 v2 is detected and added to the boot.cfg file. Why isn't 16.04 v1 detected, and what's the simplest way to install multiple distributions of Linux such that they will be detected [by GRUB2]?

I've tried the following:

  • Add /boot as partition 1
  • Install Windows (using defaults)
  • Install Ubuntu v1 (selecting partition 4 as / and bootloader on /dev/sda)
  • Install Ubuntu v2 (selecting partition 5 as / and bootloader on /dev/sda)

This failed because I could only update grub successfully from Ubuntu v2, (partition 5) and I wanted to use Ubuntu v1 as the default install.

Then I tried:

  • Add /boot as partition 1
  • Install Windows (using defaults)
  • Install Ubuntu v1 (selecting partition 4 as / and bootloader on /dev/sda)
  • Install Ubuntu v2 (selecting partition 5 as / and bootloader on /dev/sda5)

This failed because now I can only update grub from Ubuntu v2 (partition 5), and it doesn't successfully detect the installation on partition 4.

All that being said, how can I install subsequent distributions (after the first Ubuntu install) and not have them gobble up the grub install? Did I mess something up when choosing where to put the bootloader during installation? (See below for detailed installation steps)


More details

Installation steps I used:

  1. Boot from Ubuntu Live USB (16.04.4 LTS).
  2. Using gparted, write new GPT to SSD and add boot partition (1GiB) to the start of the SSD. (Shutdown)
  3. Boot from Win10 Installation USB.
  4. Install Windows 10 (Pro 64bit, if it matters). (Shutdown)
  5. Boot into Ubuntu Live USB, selecting Try Ubuntu.
  6. Using gparted, adding partitions as follows:
    • (partition number, size, label)
    • 4, 50 GB, ubuntu1
    • 5, 20 GB, ubuntu2
    • 6, 33 GB, isos
    • ...(last), 9 GB, swap
  7. Install Ubuntu, selecting Something else and designating partition 4 for / of the first installation of Ubuntu.
    • The bootloader installs in the default spot on /dev/sda, over writing the windows bootloader. Remove installation media and shutdown.
  8. Boot Ubuntu v1 to make sure it works ... success. (Shutdown)
  9. Boot to Windows (selecting via GRUB at boot time) to make sure it works ... success. (Shutdown)

From here I've tried two different methods, both are failing...

Method 1

  1. Boot into Ubuntu Live USB, selecting Try Ubuntu.
  2. Click Install Ubuntu selecting Something else.
    • Designate partition 5 for / for this second installation of Ubuntu.
  3. Leave bootloader settings alone and install.

Result: Bootloader is associated with partition 5, not partition 4.

Method 2

  1. Boot into Ubuntu Live USB, selecting Try Ubuntu.
  2. Click Install Ubuntu selecting Something else.
    • Designate partition 5 for / for this second installation of Ubuntu.
  3. Tell bootloader to install to /dev/sda5 in hopes the MBR and current boot setup are left alone.

Result: Bootloader is associated with partition 5, not partition 4, and the ubuntu installation on partition 4 isn't detected during update-grub


Side note: Yes, I am using sudo update-grub when running update-grub. I've also tried sudo update-grub2 and gotten the same results.
This is a Dell XPS 13 9360 with UEFI, if it matters.

user3.1415927
  • 178
  • 1
  • 14
  • I suggest you read https://en.wikipedia.org/wiki/Power-on_self-test , https://en.wikipedia.org/wiki/BIOS , https://en.wikipedia.org/wiki/Master_boot_record , https://en.wikipedia.org/wiki/GUID_Partition_Table , https://en.wikipedia.org/wiki/UEFI . One will have the Answer. Read the others to understand that one. – waltinator Nov 16 '18 at 14:47
  • If using UEFI, you do not need nor want a bios_grub partition nor a /boot partition. But only one Ubuntu will be default boot. With UEFI that is /boot/efi/EFI/ubuntu/grub.cfg which only has three lines to find the default boot install. See this: https://ubuntuforums.org/showthread.php?t=2406043&p=13816719#post13816719 & https://askubuntu.com/questions/738132/ubuntu-14-04-doesnt-boot-grub-prompt lGrub's os-prober should find other installs, but I normally turn off os-prober and add my own entries into 40_custom. – oldfred Nov 16 '18 at 17:46
  • This is all very confusing. What versions of Ubuntu are showing in Grub and which one is successfully booting now? You shouldn't need to write any boot partition as Ubuntu automatically makes its own EFI partition and flags it as ESP at installation. – Paul Benson Nov 16 '18 at 19:10
  • @oldfred When I first installed Ubuntu on a clean SSD, what looked to be a boot partition was created. It's showing up in disks as partition type EFI system. I am successfully adding options in 40_custom so that I can boot ISO files from the internal drive like in this answer: https://askubuntu.com/a/1025686/182241 – user3.1415927 Nov 16 '18 at 20:01
  • Just do not confuse an ESP - efi system partition used for UEFI booting with an Ubuntu /boot partition which you may only need if using LVM or a server type install. If tying to directly boot ISO from grub getting path correct. It is not as seen when mounted in Ubuntu as it is before anything is mount. And Ubuntu has changed vmlinux and initrd to add or delete .efi or .lz with differnt versions. I have had to open ISO to check which is correct in grub in ISO itself. – oldfred Nov 16 '18 at 21:13
  • @oldfred Ohhhh, maybe that's my problem - because the partition is flagged as esp. I don't understand the rest of your comment though. I have successfully booted an iso by adding it to the 40_custom file already. I believe the technique is in the linked answer. I'm not trying to boot from ISO, I'm trying to boot from the hard drive, the installed OS. – user3.1415927 Nov 17 '18 at 03:08
  • Your link is on directly booting ISO. This is on booting an install using your own entry in 40_custom: https://askubuntu.com/questions/344125/how-to-add-a-grub2-menu-entry-for-booting-installed-ubuntu-on-a-usb-drive/344359#344359 My first boot entries in 40_custom were often just copies of the os-prober entries created before I turned off os-prober. – oldfred Nov 17 '18 at 03:30

1 Answers1

0

I dont't known why grub not detected second ubuntu, but you can add custom config into grub config, in to file named custom:

$ ls /etc/grub.d/
00_header        10_linux      20_memtest86+  30_uefi-firmware  41_custom
05_debian_theme  20_linux_xen  30_os-prober   40_custom         README

Check whats added for ubuntu 1 in config(placed in /boot/), make same in 40_custom but with actual uuids for ubunti 2

Run sudo update-grub after making changes.

LeonidMew
  • 2,734
  • 1
  • 21
  • 38
  • Sure, but how do I install future distros without nuking grub? (That's the question...) – user3.1415927 Nov 16 '18 at 20:02
  • Hope it will detect them. May be problem in similar distros. I have different distros installed, not only last digit different, and it works – LeonidMew Nov 16 '18 at 22:20