help-grub
[Top][All Lists]
Advanced

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

Re: GRUB only offers a rescue shell


From: Pascal Hambourg
Subject: Re: GRUB only offers a rescue shell
Date: Thu, 13 Jul 2017 22:20:03 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Le 13/07/2017 à 21:12, Jordan Uggla a écrit :
On Wed, Jul 12, 2017 at 9:09 AM, Hao Lee <address@hidden> wrote:

3. Attach the whole image to /dev/loop0 and attach the first partition
to /dev/loop1

sudo losetup /dev/loop0 hd.img

You're fine up to here.

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/.

Agreed.

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.

I did not think that grub-install was able to detect that a /dev/mapper device was actually a partition of another device.

An alternative method is to make the kernel aware that the loop device is partitioned by loading the loop module with the max_part= option or adding the -P/--partscan option to losetup.

That is because grub-install detected that /boot/grub/ was on a "disk"
with no partition table, and thus didn't include the part_msdos module
in the core.img. Again, the solution to that problem is described
above.

Or one could force grub-install to include the part_msdos module in the core image with the --modules=part_msdos option.



reply via email to

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