I'm trying to fix a computer on which I've wrecked the bootloader.

When formatting a linux liveusb with (on a working computer):

umount /dev/sda1
sudo mkfs.ext2 /dev/sda1

and creating the liveusb with unetbootin and mint, everything appears to work (still on a working computer):

df -T /dev/sda1
Filesystem     Type 1K-blocks    Used Available Use% Mounted on
/dev/sda1      ext2  33027952 1941320  29408912   1% /media/redacted/1cbb7f98-a9e2-4105-974f-8b43dd51e48c

sudo fdisk -l /dev/sda
Disk /dev/sda: 58.6 GiB, 62948114432 bytes, 122945536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7dbfe867

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     2048 67110911 67108864  32G 83 Linux

On GRUB on broken computer (after I work my way out of rescue mode):

(proc) (hd0) (hd0,gpt6) [omitted others]

on GRUB, after inserting the liveusb:

(proc) (hd0) (hd0,gpt6) (hd1) [omitted others]

I can 'ls' an ext* partition from the hard drive, but not the ext2 liveusb I just created:

grub>ls (hd0,gpt6)
Partition hd0,gpt6: Filesystem type ext* - Last modification time... blah blah

grub>ls (hd1)
Device hd1: No known filesystem detected

I want to be able to detect the liveusb so I can follow the instructions at: https://ubuntuforums.org/showthread.php?t=1599293

How can I format the liveusb so that grub can read it?

  • 1
    Your sudo fdisk -l /dev/sda1 output looks nonsensical: the partition types are strange and Disklabel type: dos does not match what GRUB is indicating (hd0,gpt6 indicates GPT partitioning). When using fdisk, you should always point it at a whole-disk device (i.e. sudo fdisk -l /dev/sda, no partition number at the end) or else you will be interpreting the contents of a partition as if it would be the whole disk. – telcoM Jun 25 '18 at 9:51
  • Thanks for the pointer, I've edited the original question to include fdisk -l /dev/sda. The liveusb that can't be identified is hd1, not hd0 – mattg Jun 25 '18 at 16:18

I think you're asking the wrong question. You appear to be asking: "How can I use this broken bootloader (which may not work) to boot from this USB?"

You shouldn't need to go through the HDD-installed GRUB to boot it. The USB should be carrying its own version of GRUB, which you can boot directly from the firmware. What you need to do is go into the firmware menu and make sure it is set to boot from the USB first. Then, you should be able to boot your system and fix the bootloader.

This is what you would have to do if, for example, your HDD had catastrophically failed and you had to replace it with a new, blank one. There has to be a way to boot up a live USB and install a system, without needing GRUB to be installed on the HDD.

  • I think you are right. To close the situation: I had been dumped into grub rescue mode after restarting and mashing f12, shift, and esc. I ended up restarting a couple of times while working on it and one of the times after mashing those keys it booted into windows 10. I told windows 10 to reinstall itself and will partition more carefully when I install mint. Thanks! – mattg Jun 26 '18 at 0:05
  • 1
    With the correct sudo fdisk -l /dev/sda output, I can see that the USB stick is using MBR partition table and only has a single Linux partition on it. That means it is bootable only using legacy BIOS boot style. The fact that the GRUB on the broken computer indicates partitions like (hd0,gpt6) tells me the broken computer uses GPT partitioning on the system disk - which probably means it uses UEFI boot scheme. If the broken computer has its legacy BIOS compatibility support disabled, it won't be able to boot from that stick - you'll need to prepare an UEFI-bootable USB stick instead. – telcoM Jun 26 '18 at 8:00
  • 1
    A UEFI-style boot from removable media is conceptually very simple: the firmware looks for a FAT32 filesystem on the removable media, and a file named \EFI\boot\bootx64.efi on that filesystem. If that file exists, then the removable media is bootable in UEFI style, and that file will be loaded and executed as the bootloader. – telcoM Jun 26 '18 at 8:07

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.