help-grub
[Top][All Lists]
Advanced

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

Re: installing grub2-1.99 on usb failed


From: Jordan Uggla
Subject: Re: installing grub2-1.99 on usb failed
Date: Wed, 18 May 2011 00:43:14 -0700

On Tue, May 17, 2011 at 4:08 AM, lode leroy <address@hidden> wrote:
>
> Hello,
>
> I'm trying to upgrade my pen-drive from grub-1.98 to grub-1.99,
> but after doing grub-install, I only get the rescue mode prompt.
>
> Can anyone enlighten me on what I'm doing wrong?
>
>
> root:~# qemu -hda usbstick.img
>
>
>
> GRUB loading.
>
> Welcome to GRUB!
>
>
>
> error no such device: 4c7e-12b1
>
> Entering rescue mode...
>
> grub rescue> ls
>
> (hd0)
>
> grub rescue> ls (hd0)/
>
> error: unknown filesystem.
>
> grub rescue>
>
>
>
>
> This is what I have done to make install grub on my pen-drive (image)
>
> root:~# grub-install --version
> grub-install (GRUB) 1.99
>
> root:~# losetup -v /dev/loop0 usbstick.img
>
>
> root:~# losetup -v /dev/loop1 usbstick.img -o `expr 62 \* 512`
>
> Loop device is /dev/loop0
> root:~# mount /dev/loop1 /mnt/stick
> Loop device is /dev/loop1
>
> root:~# grub-install --boot-directory=/mnt/stick/boot /dev/loop0
>
> Installation finished. No error reported.
> root:~# umount /mnt/stick
>
> root:~# losetup -d /dev/loop1
>
> root:~# losetup -d /dev/loop0
>
>
>
>
> root:~# fdisk usbstick.img
>
> Command (m for help): p
>
> Disk usbstick.img: 1027 MB, 1027416576 bytes
> 32 heads, 62 sectors/track, 1011 cylinders, total 2006673 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0xb0bcd68e
>
> Device          Boot      Start         End      Blocks   Id  System
> usbstick.img1     *          62     2005823     1002881    b  W95 FAT32
>
> Command (m for help): q
>
>
> root:~# blkid /dev/loop1
> /dev/loop1: UUID="4C7E-12B1" TYPE="vfat"
>
>
> root:~# fsck /dev/loop1
> fsck from util-linux 2.19
> dosfsck 3.0.11, 24 Dec 2010, FAT32, LFN
> /dev/loop1: 287 files, 99788/250227 clusters
>
> root:~# cat /mnt/stick/boot/grub/load.cfg
>
> search.fs_uuid 4c7e-12b1 root
> set prefix=($root)/boot/grub
>
>
>
> _______________________________________________
> Help-grub mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-grub
>

When you use losetup with an offset grub-probe (and thus grub-install)
cannot tell that /dev/loop1 is a partition on /dev/loop0. Instead it
looks to grub-install as if /dev/loop1 is a drive with no partition
table, and /dev/loop0 is another, unrelated, drive. Because of this,
grub-install does not include the part_msdos module in the core.img.
To work around this problem add --modules=part_msdos to your
grub-install command.

In the future (actually, in the experimental branch now) the supported
way to do this will be to use kpartx rather than using losetup with an
offset. So you would do "kpartx -a usbstick.img && mount
/dev/mapper/loop0p1 /mnt/stick/ && grub-install
--boot-directory=/mnt/stick/boot/ /dev/loop0".

-- 
Jordan Uggla (Jordan_U on irc.freenode.net)



reply via email to

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