35

I'm installing Debian 9 on an HP ProLiant DL180. When I boot from a USB drive, it opens grub2 and when I type boot it gives an error : you need to load kernel first.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
mend4x
  • 517

4 Answers4

55

From grub-rescue type set then hit the Tab , it will help you to set the first parameters , e,g.:

set prefix=(hd0,gpt2)/boot/grub
set root=(hd0,gpt2)
insmod normal
normal 

you need to load kernel first

To load the kernel forward with the following commands:

insmod linux
linux /vmlinuz root=/dev/sda2
initrd /initrd.img
boot 

Change /dev/sda2 with your root partition , change gpt2 with msdos if you don't have a GUID partition table.

To correctly set your boot parameters, see Ubuntu documentation : search and set

GAD3R
  • 66,769
6

In my case, secure boot was on. I just turned it off and it worked for me. Try to turn secure boot off

Command to check secure boot status

mokutil --sb-state
AKMalkadi
  • 341
3

You have to define a kernel file and usually an initrd file and the kernel command line, too, before you can run the boot command (see the Grub documentation).

Normal boot media offer a menu from which you can select and entry. A Grub command line is not for you. Either you are using your Grub wrongly or you should use a different boot medium.

Hauke Laging
  • 90,279
2

Encountered the same error on a workstation with bootable partitions on both of two fixed disks (/dev/sda, /dev/sdb); couldn't find a solution here or elsewhere. Describing my own fix here, as found by trial and error:

Upon

grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda

the GRUB boot menu showed all operating systems installed in various partitions on /dev/sda and /dev/sdb (Windows, SuSE 15.3 and earlier). Booting entries from /dev/sda worked fine, choosing one from /dev/sdb gave the error

you need to load the kernel first...

/boot/grub2/grub.cfg showed the two hard disks as "hd0" and "hd1". F2 at startup shows these entries in BIOS (old machine, no EFI):

Main:

SATA Port 0 [ST3500413AS]-(S0)] SATA Port 1 [Optiarc DVD RW-(S1)] SATA Port 2 None SATA Port 3 [ST3500413AS]-(S3)] SATA Port 4 None SATA Port 5 None

Boot -> Boot priority order:

1:      SATA CD: Optiarc DVD RW-(S1)
2:      Bootable Add-in Cards
3:      SATA 0:  ST3500413AS-(S0)
4:      SATA 3:  ST3500413AS-(S3)

I'm wondering whether the empty SATA Port 2 is causing the problem?

My fix has been to manually edit /boot/grub2/grub.cfg (egad, explicitly discouraged in file header!) and to replace all instances of "hd1" by "hd2". Then again:

grub2-install /dev/sda


GRUB's boot menu is the same as before, but booting works for all entries now, including those on /dev/sdb.

user3238459
  • 51
  • 1
  • 6