help-grub
[Top][All Lists]
Advanced

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

Re: EasyBCD and GRUB2


From: S O
Subject: Re: EasyBCD and GRUB2
Date: Wed, 26 Dec 2012 13:15:16 -0800 (PST)

Well, this is definitely a bug in EasyBCD, and I found a workaround.

EasyBCD has various methods for booting partition, selectable in EasyBCD UI when boot menu entry is created.

One of selections is "GRUB2" method, which causes some EasyBCD code to be executed at boot (one of "AutoNeoGrub*.mbr" files in C:\NST). This is what one is supposed to use with GRUB2 partitions, and what is apparently broken.

Another methods are "SysLinux" and "BSD" which are likely to be just aliases for the same thing -- loading boot block off the partition and transferring control to it.

Once I chose any of those methods, master GRUB partition loads correctly and I am able to boot Linux instances fine too.

- Sergey


From: S O <address@hidden>
To: Andrey Borzenkov <address@hidden>
Cc: "address@hidden" <address@hidden>
Sent: Wednesday, December 26, 2012 12:16 PM
Subject: Re: EasyBCD and GRUB2

Ok, at a further glance it looks like grub-mkimage compresses i386-pc images by default, even if no compression option is specified, with default compression in this case set to COMPRESSION_LZMA.

"unlzma" says that core.img file is in wrong format, so I assume not the whole file is compressed and there is apparently (?) no easy way to examine embedded prefix string in core.img.

In the meanwhile, I paid attention to the clue that the culprit may be WINLOAD/EasyBCD rather than GRUB. Linux3 (which is Fedora 64-bit) has all its grub stuff installed not in (Linux3)/boot/grub, but in (Linux3)/boot/grub2, and it somehow does come up. This seems to suggest that EasyBCD/WINLOAD actually loads Linux3 partition rather than master GRUB partition, since the knowledge about "/boot/grub2" has to come from somewhere, and off the top of my head I assume it can come only from Linix3 "core.img" itself and GRUB by itself cannot default to "/boot/grub2" path. Does it sound a correct reasoning?

- Sergey


From: S O <address@hidden>
To: Andrey Borzenkov <address@hidden>
Cc: "address@hidden" <address@hidden>
Sent: Wednesday, December 26, 2012 11:25 AM
Subject: Re: EasyBCD and GRUB2

Thanks for advise. I countered this issue by issuing all relevant insmod's in master grub.cfg file before the menu, but chainloading is a better solution indeed.

However, right now the whole scheme stopped working altogether after adding one more Linux instance partition.

Now GRUB comes up with initial value of prefix not for the master partition, but for new added partition.

I use /dev/sda2 for master grub partition, and that is where GRUB used to come from while I had two Linux instances, but adding third Linix instance to /dev/sda8 caused master grub to come up with Linux3's grub.cfg. I thought may be Linux3 install somehow may have screwed up /dev/sda2 (even though grub.cfg there is intact), so I rebuilt /dev/sda2 and re-created EasyBCD entry just in case, but it did not help.

To verify that grub-install invokes grub-mkimage with correct --prefix value I embedded printout statement into grub-install before all invocations of grub-mkimage. Printout displays correct expected value for prefix "(,msdos2)/boot/grub" passed to grub-mkimage --prefix.  

Yet when I run "strings" or "grep" on produced core.img I do not see this prefix string or any parts of it (such as "msdos", "boot" or "grep") inside produced core.img.

Is core.img compressed or is prefix string otherwise somehow scrambled inside core.img -- or does its absence in plain text in core.img means the failure of grub-mkimage to embed the prefix string?

At a glance, I do not see any compression option in grub-install, so I assume core.img is likely to be uncompressed and requested prefix string then indeed may be missing in core.img?



From: Andrey Borzenkov <address@hidden>
To: S O <address@hidden>
Cc: "address@hidden" <address@hidden>
Sent: Tuesday, December 25, 2012 10:58 PM
Subject: Re: EasyBCD and GRUB2

On Wed, Dec 26, 2012 at 8:55 AM, S O <address@hidden> wrote:
> menuentry "MyLinux2" {
>    search --no-floppy --set root --label MYLINUX2
>    set prefix=($root)/boot/grub
>    configfile $prefix/grub.cfg
> }
>
> and so on.
>
> Thus GRUB is actually loaded only from master partition (which should reduce
> the risks of "blocklist" issues in case of backups etc.), but then menu
> directs it to instance-specific partition and grub.cfg in that partition.

Word of caution. ${prefix} also defines location of grub2 modules. So
you have to absolutely ensure that grub2 build in every OS is the same
as master. Otherwise you are risking running binaries from different
builds with undefined results.

I would rather use chain loading; you can directly load core.img using

chainload $prefix/i386-pc/core.img

(or x84_64-efi or rather exotic i386-efi)

which ensures your core.img and modules are consistent. There is no
blocklists involved, grub2 will read files so you are free to move
them around as you like.







reply via email to

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