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
  • 215
  • 2
  • 9
  • 4 and 5 should be switched around, home is for all your data/downloads. Ubuntu uses swap file now, so don't need swap partition. Should see what your other OS is installed as, stuff works better if all OSs installed the same way. Imagine your internal drive is UEFI with GPT partition table, unless very old computer. – crip659 Jun 19 '20 at 15:34

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

  • Yes how do I get rid all of that and reinstall MBR and grub and grub uefi in a certain partition? I am quiet certain my linux ext4 and its home folder is accessible. Do I just remove it in Gparted? And then what do I need to do? Is there ubuntu package that can automatically do this for me? – user23139 Jun 19 '20 at 15:20
  • get rid of what ? i guess you missed to create a /boot partition during manual install ( pictured steps: https://askubuntu.com/questions/343268/how-to-use-manual-partitioning-during-installation ) – Benji over_9000 'benchonaut' Jun 19 '20 at 15:26
  • from your link "(Optional) Create separate partitions for /boot, /tmp and /var. Set their size according to your needs" – user23139 Jun 19 '20 at 15:55
  • go for it , create no boot/efi partition and fail again ;) https://help.ubuntu.com/community/BootPartition , also doing the swap behind the root partition might help , (and yes, ubuntu scripts look for a /boot partition .. so since you do not have a standard setup ( e.g. first partition ext4/xfs rootfs staring at the disk begin) you are advised to have one https://help.ubuntu.com/community/CreateBootPartitionAfterInstall – Benji over_9000 'benchonaut' Jun 19 '20 at 19:27
  • 2
    it turns out it has nothing to do with /boot or /boot/efi i have tried both of them. My BIOS is a laptop BIOS that is so bad it cannot detect external hard drives. I managed to boot to it using grub installed on a separate flashdisk. You answered my question correctly on how to reinstall the GRUB. I mark this as accepted. – user23139 Jun 20 '20 at 00:25
  • 1
    @REDACTEDーーーーーーーーーーーーーーーーーーーーーー which kind of bios is it ( phoenix/award ?) and what machine manufacturer do you have ? – Benji over_9000 'benchonaut' Jun 24 '20 at 00:37