help-grub
[Top][All Lists]
Advanced

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

Re: Installing GRUB to drive image


From: Charles Yost
Subject: Re: Installing GRUB to drive image
Date: Thu, 29 Mar 2012 12:54:53 -0400

On Thu, Mar 29, 2012 at 5:00 AM, Jordan Uggla <address@hidden> wrote:
> On Wed, Mar 28, 2012 at 10:32 PM, Charles Yost <address@hidden> wrote:
>> Here are the commands I used.
>>
>> #!/bin/bash
>> # disk is a 1GB image, with 4 primary partitions, starting at: 1049kB,
>> 50M, 71M, 547M
>> # grub is compiled and waiting in the the grub directory next to disk.img
>> IMAGE_FILE=disk.img
>> IMAGE_FILE_LOOP=$(losetup --find)
>> IMAGE_FILE_LOOP_BASE=$(basename ${IMAGE_FILE_LOOP})
>> losetup --verbose ${IMAGE_FILE_LOOP} ${IMAGE_FILE}
>
> I can understand this use of losetup in the script, and only this use,
> because this is a script and using "losetup --find" you can
> conveniently and safely store the loop device being used for later in
> the script. If it were not in a script then I would simply do "kpartx
> -a -v /path/to/image" and let kpartx setup the loopback device as well
> since it's one less step to worry about.
>
>> BOOT_LOOP=$(losetup --find)
>> losetup --verbose ${BOOT_LOOP} /dev/mapper/${IMAGE_FILE_BASENAME}p1
>
> I explicitly said not to do this and this is what is causing the
> problem. Just do
>
> mount /dev/mapper/${IMAGE_FILE_BASENAME}p1 /mnt/disk_image-boot
>

When I tried this, here is what happens. The grub-install script exits
with the following:
/usr/sbin/grub-probe: error: no such disk
Auto-detection of a filesystem of /dev/mapper/loop1p1 failed.
Try with --recheck.
If the problem persists please report this together with the output of
"/usr/sbin/grub-probe
--device-map="/mnt/image_os-boot/grub/device.map" --target=fs -v
/mnt/image_os-boot/grub" to <address@hidden>

If I try running grub-install again and adding --recheck, I get the same error.

The contents of /mnt/image_os-boot/grub/device.map are the physical
disks on my system.

The output of the suggested grub-probe commandline is:
/usr/sbin/grub-probe: info: the size of hd0 is 488397168.
/usr/sbin/grub-probe: info: the size of hd0 is 488397168.
/usr/sbin/grub-probe: info: the size of hd0 is 488397168.
/usr/sbin/grub-probe: info: the size of hd0 is 488397168.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd0 is 488397168.
/usr/sbin/grub-probe: info: the size of hd0 is 488397168.
/usr/sbin/grub-probe: info: the size of hd0 is 488397168.
/usr/sbin/grub-probe: info: the size of hd0 is 488397168.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: the size of hd1 is 4001760.
/usr/sbin/grub-probe: info: changing current directory to /dev.
/usr/sbin/grub-probe: info: changing current directory to mapper.
/usr/sbin/grub-probe: info: opening loop1p1.
/usr/sbin/grub-probe: error: no such disk.


>> cp grub/* /mnt/disk_image-os
>
> If the grub directory referenced here contains anything other than a
> grub.cfg file then I am suspicious that you're doing something wrong.
> grub-install will create and populate the grub directory itself, you
> should *not* be copying around grub's modules manually. Having a
> pre-populated grub directory won't prevent grub-install from working
> as it will overwrite files as needed, but you should still remove this
> cp command to avoid confusing yourself or others.
>
This is not the same as the grub directory that resides in /boot. This
is the compiled grub source. So grub-setup and grub-mkimage, etc.

Thanks,
=> Charles



reply via email to

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