[Top][All Lists]

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

Re: grub2 fails to detect partitions if it was installed into file

From: Sergey Naumov
Subject: Re: grub2 fails to detect partitions if it was installed into file
Date: Wed, 18 Jul 2018 14:20:19 +0300


I just had to use "losetup --partscan" instead of mounting the main
partition manually, as with my method there is no information about
partition size. Anyway, thanks a lot for part_msdos, it helped!

2018-07-18 12:26 GMT+03:00 Sergey Naumov <address@hidden>:

> Thanks, Pascal, that helped a bit.
> But now there is another problem:
> error: attempt to read or write outside of partition.
> So grub see partition and its content, it can even load some modules from
> (hd0,msdos1)/boot/grub/i386-pc.
> But when I'm trying to load some other modules, like "normal", I see this
> error:
> grub rescue> ls
> (hd0) (hd0,msdos2) (hd0,msdos1)
> grub rescue> ls (hd0,msdos1)/boot/grub
> ./ ../ gfxblacklist.txt unicode.pf2 i386-pc/ locale/ fonts/ grubenv
> grub.cfg
> grub rescue> set root=(hd0,msdos1)
> grub rescue> set prefix=(hd0,msdos1)/boot/grub
> grub rescue> insmod normal
> error: attempt to read or write outside of partition.
> What is also interesting, if I use --modules=part_msdos,ext2 instead of
> --modules=part_msdos, then grub tries to load a system, but neither
> succeeds nor emits rescue shell - it just hangs.
> As to your question - I used "losetup -o 1M -f image.img" to create loop
> device that I can format with mkfs.ext4.
> Thanks,
> Sergey.
> 2018-07-17 21:12 GMT+03:00 Pascal Hambourg <address@hidden>:
>> Hello,
>> Le 17/07/2018 à 18:09, Sergey Naumov a écrit :
>>> I'm trying to prepare an image that I can dd into disk or boot using PXE,
>>> so I install basic system + kernel + grub-pc into directory, then create
>>> an
>>> image file, partition it using sfdisk, mount main partiton (ext4), copy
>>> content of the rootfs into it, and then run grub-install and update-grub
>>> under chroot.
>>> Everything seems OK, grub.cfg detected kernel and initramfs installed
>>> into
>>> created image, but when I try to boot this image either on real system or
>>> using kvm, grub2 can't find device partitions. What could be a reason of
>>> it?
>>> I posted the question with more detailed explanation here:
>>> ct-partitions-if-it-was-installed-into-file
>> You really could have copied all the relevant information in your post to
>> the list, so subscribers do not have to fetch them on the web.
>> How did you make the ext4 partition in the image appear as a block device
>> so that it can be mounted ?
>> AFAIK, GRUB looking for the filesystem containing /boot/grub by UUID
>> means that grub-install believes that it is on a different drive from the
>> boot+core image. So maybe grub-install did not care to embed the MSDOS
>> partition table driver into the core image. You can try to force it with
>> grub-install --modules=part_msdos <other parameters>

reply via email to

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