17

I am trying to boot my own simple OS kernel using GRUB stage2_eltorito. However, the compiled ISO simply leads to a GRUB prompt. I looked up online, and I saw I need to load my kernel. However, when I try to load my kernel, it says I need to load a hard disk first, using the root command. How do I load my ISO file's partition to load my kernel? Thanks in advance!

2 Answers 2

16

There is your howto:

https://www.linux.com/learn/how-rescue-non-booting-grub-2-Linux

or here:

https://askubuntu.com/questions/38082/how-do-i-manually-boot-from-the-grub-prompt-after-do-release-upgrade

In short:

grub> set pager=1
grub> ls
(hd0) (hd0,msdos2) (hd0,msdos1)
grub> ls (hd0,1)/
lost+found/ bin/ boot/ cdrom/ dev/ etc/ home/  lib/
lib64/ media/ mnt/ opt/ proc/ root/ run/ sbin/ 
srv/ sys/ tmp/ usr/ var/ vmlinuz vmlinuz.old 
initrd.img initrd.img.old

This is just example, you have to modify it to your situation. You have examples in linked howtos.

1
  • 1
    Thank you!! ls (hd0, gptX), where X is partition number, worked for me and I finally found out where my OS was located
    – testing_22
    Commented Oct 22, 2021 at 19:25
10

The grub ls -l command will show all devices and partitions with their UUID-s.

thanks to

7
  • 4
    ls -l is not valid because -l is not a valid option for ls. You will get the error error: file '-l' not found
    – shrewmouse
    Commented May 21, 2020 at 16:14
  • 1
    @shrewmouse Please check the version of GRUB you are using, I believe this applies to version 2 only.
    – gregn3
    Commented May 21, 2020 at 16:20
  • It's grub2 and the documentation that you link to doesn't even have the a -l option.
    – shrewmouse
    Commented May 21, 2020 at 16:39
  • 2
    It works when in the GRUB command prompt, before booting the OS. I have just checked, I have GRUB version 2.04.
    – gregn3
    Commented May 21, 2020 at 17:03
  • 1
    ls -l worked for me. Ubuntu MATE 21.04. Commented May 25, 2021 at 3:57

You must log in to answer this question.

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