GRUB2 Not Loading from MBR

I have a new computer that I have imaged using PXE. It loads a kernel, initrd and verifies if it needs to apply an image. If it does, it goes through some logic of partitioning (BIOS, non-GPT) the disk and applying a disk image (SLES 12 SP2) which it TFTPs over the network. From this environment, it then loads the kernel and initrd directly from the boot partition and kicks off systemd from the root partition. However, if I try to boot the drive directly without PXE booting, I get the generic “No bootable OS found” error and no GRUB.

So from the OS, I got through the usual routine..

The drive is an SSD. Verify my current disk and partitioning:

# fdisk -l
Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x63305a1b

Device     Boot   Start       End   Sectors    Size Id Type
/dev/sda1          2048   2056319   2054272 1003.1M 82 Linux swap / Solaris
/dev/sda2       2058240 250067789 248009550  118.3G 83 Linux

# lsblk
NAME   MAJ:MIN RM    SIZE RO TYPE MOUNTPOINT
sda      8:0    0  119.2G  0 disk 
├─sda1   8:1    0 1003.1M  0 part [SWAP]
└─sda2   8:2    0  118.3G  0 part /

# cat /proc/scsi/scsi
Attached devices:
  Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: SanDisk SD7SN3Q- Rev: 0006
  Type:   Direct-Access                    ANSI  SCSI revision: 05

Install GRUB2 to the MBR:

# grub2-install /dev/sda                                                                                                                                                                                                                           
Installing for i386-pc platform.
Installation finished. No error reported.

Then generate my configuration:

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.120-92.70-default
Found initrd image: /boot/initrd-4.4.120-92.70-default
done

Now in the UEFI options, I have UEFI boot disabled. Instead, it tries to legacy PXE and legacy boot the drive. So I’d expect when it attempts to boot said disk, it will look at the first 512MB to find the MBR and boot GRUB. This part does not seem to happen however.. Is there anything else I could possibly check to see where this may be going wrong?

Answer

Had to mark the partition bootable using fdisk.

Attribution
Source : Link , Question Author : azurepancake , Answer Author : azurepancake

Leave a Comment