OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 3:32 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: [SOLVED] GRUB2 always enters a rescue shell
PostPosted: Thu Jul 13, 2017 10:04 am 
Offline
User avatar

Joined: Thu Jul 13, 2017 9:52 am
Posts: 22
Hi,

I encounter a problem when making a bootable disk image because GRUB2 always enters a rescue shell.

I want to create a disk image and install GRUB2 on it and then use Bochs to run it. The steps are as follows.

Code:
System Environment:
OS: Fedora 25 x86
GRUB version: grub2-install (GRUB) 2.02~beta3
Bochs version: 2.6.9


1. Create an empty disk image.
Code:
dd if=/dev/zero of=hd.img bs=$((16*63*512)) count=100

2. Create a primary partition.
Code:
fdisk -u -C100 -S63 -H16 hd.img

The partition table is:
Code:
Device     Boot Start    End Sectors  Size Id Type
hd.img1          2048 100799   98752 48.2M 83 Linux

3. Attach the whole image to /dev/loop0 and attach the first partition
to /dev/loop1
Code:
sudo losetup /dev/loop0 hd.img
sudo losetup -o $((2048*512)) /dev/loop1 hd.img

4. Format the first partition to ext4 and mount it to /mnt/
Code:
sudo mkfs.ext4 /dev/loop1
sudo mount -t ext4 /dev/loop1 /mnt

5. Create GRUB directory.
Code:
sudo mkdir -p /mnt/boot/grub2

6. Install GRUB 2
Code:
sudo grub2-install --boot-directory=/mnt/boot /dev/loop0

7. Start Bochs.
Code:
bochs -f test.bxrc


These steps are straight and simple. However, GRUB2 always enters a rescue shell instead of entering normal mode.
When I use the set and ls command to show more information, I can only see (hd0) and the first partition (hd0,1) is disappeared. The screen output is as follows:

Code:
Bochs BIOS - build: 02/16/17
ata0 master: Generic 1234 ATA-6 Hard-Disk (  49 MBytes)
Press F12 for boot menu.
Booting from Hard Disk...
.
error: no such device: c5b2c483-70c2-4212-840b-da5f965d0555.
error: unknown filesystem.
Entering rescue mode...
grub rescue> set
prefix=(hd0)/boot/grub2
root=hd0
grub rescue> ls
(hd0)
grub rescue>


I don't know how to solve this problem. Could someone help me out? Many thanks!


Last edited by haolee on Sun Jul 16, 2017 7:00 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: GRUB2 always enters a rescue shell
PostPosted: Sun Jul 16, 2017 6:59 pm 
Offline
User avatar

Joined: Thu Jul 13, 2017 9:52 am
Posts: 22
Problem resolved.
http://lists.gnu.org/archive/html/help- ... 00017.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 56 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group