help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: GRUB only offers a rescue shell


From: Hao Lee
Subject: Fwd: GRUB only offers a rescue shell
Date: Sat, 15 Jul 2017 13:51:55 +0800

>> sudo losetup -o $((2048*512)) /dev/loop1 hd.img
>
> This is where your problem is. When you run grub-install it detects
> two disks, /dev/loop0 and /dev/loop1 where /dev/loop0 appears to be a
> partitioned disk with none of its partitions mounted and /dev/loop1
> appears to be a disk without any partition table where the whole disk
> is mounted to /mnt/. grub-install performs an installation that would
> work if that were the case (try passing /dev/loop0 and /dev/loop1 as
> disks to bochs and it should boot).
>
> Instead, you should run "sudo kpartx -a /dev/loop0" which will probe
> the partition table of /dev/loop0 and add device nodes in /dev/mapper/
> for each of the partitions found. In this case, it would create a
> device node /dev/mapper/loop0p1 . When grub-probe looks at
> /dev/mapper/loop0p1 it will be able to detect that it is a partition
> of the disk /dev/loop0 and thus grub-install will configure things
> appropriately.

Thank you very much.

This is indeed where my problem is. I have tried the kpartx command
and it's an awesome tool. I have failed many times these days and
today I finally make a bootable disk image!

I also find that when Bochs boot with this disk image for the first
time, it will prompt me with the following error:

error: file `/boot/grub2/i386-pc/normal.mod' not found.
Entering rescue mode...
grub rescue>

However, when I re-run Bochs with the same image, it will enter normal
mode directly without any error. After that, I re-run the Bochs many
times and the error no longer occurs.

At last, I find that this may because I haven't detached /mnt and
deleted partition mappings before running Bochs.

Thanks for your help and other people's advice. Now I can continue
creating my kernel debugging environment.

Regards,
Hao Lee



reply via email to

[Prev in Thread] Current Thread [Next in Thread]