2

Edit: I am sorry if I used the term bootloader, MBR, GRUB, GRUB UEFI interchangeably because I am not sure what's their difference. The point is I how to repair the part/partition/bootloader/grub/mbr that is required to boot into rootfs?

I am trying to install Ubuntu 20.04 on external HDD using Ubiquity

  1. MBR on /dev/sdc
  2. Do not use partition 400 GB
  3. Swap 6 GB
  4. Linux 64 GB
  5. Home 30 GB

My "do not use partition" ended up being used by Ubiquity and the flag is boot. I assumed that is where MBR is installed and it does not need 400 GB. So I decided to:

  1. I reduced the partition with flag boot to 300 MB
  2. Format the unallocated to NTFS

Now my Laptop doesn't recognize my external HDD in BIOS boot menu, only Live USB is detected. I assumed:

  1. I messed up the MBR when shrinking with GPARTED
  2. Ubiquity does not install EFI Grub thus my BIOS cannot Boot from my hard disk

I plan to remove the "boot flag" partition reinstall MBR and UEFI Grub in the new partition hopefully that can make make me boot to Linux without reinstalling from scratch.

user23139
  • 225
  • 2
  • 10

1 Answers1

1

( you should place a /boot partition at the beginning of your disk , also EFI boot needs a fat32-EFI ESP partition )

The good:

as long as you find the inital ram disk initrd , the kernel file vmlinuz and the command line ( either from grub config or manually fiddling → e.g. find the root from /etc/fstab ) , YOU WILL BE ABLE TO BOOT from another medium (CD/USB) that has a grub/lilo/syslinux ..

  • see here for manual booting

The Bad:

the operation might be tiddly ( see below )

The ugly:

Recommendation would be : chroot from another (live or not ) linux-system after bind mounting /proc /dev/ /dev/pts and /sys, decide for whatever GRUB fits your partition layout ( either MBR if you have MBR OR UEFI if you have GPT Layout ) , and let install-grub do it's magic after you reconfigured your packages with dpkg-reconfigure -plow grub-whatever

  • to see if you have UEFI deployed: search for the EFI partition or a respecting folder in a FAT Partition

  • manually switching to EFI mostly requires changing from MBR to GPT ( so you need to backup/transfer the partition since you format the whole drive

  • also there are by default 2 ways to install grub one does UEFI one MBR , you might also deploy both , since both ways just access the /boot ot / partition , but ubuntu scripts ( and packages ) are different ones

  • in trouble you can also PXE-boot(Network)/CD-boot with GRUB

  • Remember that UEFI mostly NEEDS a GPT partition table which you might not have

  • for MBR the boot flag needs to necessarily be set in most situations , but for GRUB in a partition