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.

4 Answers 4

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

5
  • 1
    Worked perfectly, thanks Commented Feb 6, 2020 at 11:22
  • i got this "unknown filesystem" after running linux /vmlinux root=/dev/sda2 Commented Jun 7, 2020 at 0:20
  • @AlexanderMills I have added a link to correctly set the root partition.
    – GAD3R
    Commented Jun 7, 2020 at 10:55
  • From the default menuentry in set pager=1; cat (hd0,gpt2)/boot/grub/grub.cfg, I saw "linux /vmlinuz-6.1.0-2-rt-amd64 root=UUID=4ed3962d-ea68-4e6a-903d-a1fef9df2817 ro nosmt" and "linux /vmlinuz root=UUID=4ed3962d-ea68-4e6a-903d-a1fef9df2817 ro nosmt" was what worked for me. Commented Feb 5, 2023 at 5:08
  • I didn't set GRUB_DISABLE_LINUX_UUID=true in my GRUB configuration, so it was using UUIDs to refer to filesystems instead of devices like /dev/sda2. Commented Feb 5, 2023 at 5:17
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
1
  • 2
    After installing twice, I found that this was the only one helped...Superb thanks.
    – David
    Commented May 16, 2023 at 15:06
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.

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .