Using GRUB4DOS for booting Linux Debian 7 on a logical partition

Gingko

New Member
#1
Hello.

I am trying for days to use EasyBCD 2.3 for booting a Linux session from a MBR hard disk with not less than 10 partitions.

For that reason I had to use logical partitions set into an extended partition in order to override the limitations of 4 primary partitions.

I use NeoSmart Linux in Grub 2 mode for that.

This usually worked in the past as long as I put the system in a primary partition, but it seems to always fail with a "unknown filesystem" error message if I set it on a logical partition.

When failing, it goes to the GRUB command line.

However, I can see that the partition is indeed detected by AutoNeoGrub0.mbr, so I didn't understand why it was not booting.

The structure of my hard disk is the following :
Code:
lsblk -f
NAME    FSTYPE LABEL              MOUNTPOINT
[… skipping other disks …]
sdc
├─sdc1  ntfs   Réservé au système
├─sdc2  ntfs   SYS_W7             /mnt/g
├─sdc3  ntfs   SYS_XP             /mnt/h
├─sdc4
├─sdc5  ext3   BOOT               /mnt/boot_new
├─sdc6  swap   SWAP               [SWAP]
├─sdc7  ext3   DEBIAN_ROOT        /
├─sdc8  ext3   OLD_RH9            /mnt/old_rh9
├─sdc9  ext3   OLD_DEB7_X86       /mnt/old_deb7_x86
├─sdc10 ntfs   DONNEES            /mnt/d
└─sdc11 vfat   FAT32              /mnt/w
Note that sdc4 is actually the extended partition enclosure, containing all the following ones.

I made a lot of searches on Internet, and I finally found a way to manually boot from the GRUB command line, by issuing the following :
Code:
set root=(hd2,7)
set prefix=(hd2,7)/boot/grub
insmod normal
normal
Here is a screenshot of what I can see when typing these lines:

20180512_183244.png

If I hit ENTER just after, the system boots normally (with the Grub selection menu).

But the strange thing is that on that screen, you can see that the boot loader was detected as (hd2,6) whereas I actually had to use (hd2,7) in order to actually boot.
As (hd2,6) is a SWAP partition, I think it may be normal that its system is unknown.
In a previous try, I set a bootloader on (hd2,5) and it was detected as (hd2,4), which is actually the extended partition enclosure.

This lets me thinking that there is a bug in GRUB4DOS which make it assigning the wrong partition number to a successful detection, thus making it trying to use the partition having the number detected minus one.
Maybe because it doesn't take in account the fact that the extended partition enclosure is also a partition.

I tried many things in order to fake the detection in order to get it to boot on my valid partition without having to enter these 4 lines each times, but I haven't found a way to do this so far.

So I would like to ask :

Is it possible to patch the AutoNeoGrub0.mbr file in order to add +1 to the partition number where it is expected? (likely if the partition is a logical one)

Best regards.

Gingko
 

mqudsi

Mostly Harmless
Staff member
#2
Hello @Gingko

That's quite a good bit of research that you've put together there!

You don't want to patch the AutoNeoGrub0.mbr file, that just points to the actual bootloader on-disk, in this case, ANG0 on the boot drive. If you open that in a hex editor, you can edit the embedded menu (at the very bottom).
 

Gingko

New Member
#3
Hello,

I don't want to patch the AutoNeoGrub0.mbr file myself, actually, I was just asking if this bug could be fixed.
For me it seems it prevents using NeoGrub for booting a linux system in an extended partition.

Likely I should have posted this message in the BugCentral section.

Gingko
 

mqudsi

Mostly Harmless
Staff member
#4
Ah, I was going to post a long-winded explanation about how EasyBCD derives the numbers and how you can compare what it detects with what is actually there so I can fix it down the road, but then thought "he probably just wants to get it working, let me tell him about patching ANG0"

:smile: