[SOLVED] Boot Mageia6 LiveDVD from grub2 loop device

This forum is dedicated to testing early releases and cauldron : Howtos, tips, tricks and user global feedback and thoughts...

Helpful tip :
For bugs tracking we use : https://bugs.mageia.org = The Mageia Bug Tracker
In this bug tracker you'll find already reported bugs and you'll be able to report those you have found....

[SOLVED] Boot Mageia6 LiveDVD from grub2 loop device

Postby mozg1986 » Sep 26th, '16, 17:44

Trying to do a dual boot hdd on the basis of grub2 UEFI boot.
Mount an image mageia6-liveDVD-x86_64 in loop-device to indicate to grub2 kernel and initrd, and as a result I receive an error.
error.jpg
error screen
error.jpg (33.4 KiB) Viewed 9879 times

Grub2 menuentry:
Code: Select all
menuentry 'Mageia 6 (Cauldron) x64' {
      set iso="/iso/Mageia-6-sta1-LiveDVD-PLASMA5-x86_64-DVD.iso"
      if loopback loop ${iso}
      then
         if search --no-floppy --set=root -l 'Mageia-6-PLASMA5-LiveDVD'
         then
            linux /boot/vmlinuz root=mgalive:LABEL=Mageia-6-PLASMA5-LiveDVD splash quiet noiswmd rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
            initrd /boot/cdrom/initrd.gz
            
         else search --no-floppy --set=root -l 'Boot'
         fi
      else search --no-floppy --set=root -l 'Boot'
      fi

Lines were taken from the original config grub2
Tried to use for your boot loader bootx64.efi from Mageia6 iso image - did not help
Last edited by mozg1986 on Sep 28th, '16, 19:09, edited 3 times in total.
mozg1986
 
Posts: 11
Joined: Jan 13th, '14, 07:04

Re: Boot and install Mageia6 LiveDVD from grub2 loop device

Postby benmc » Sep 27th, '16, 01:43

I see from your screengrab that you are in QEMU.

Does the .iso boot from an actual USB [or DVD] on real hardware, or does it halt at the same place?

which .iso?
benmc
 
Posts: 1218
Joined: Sep 2nd, '11, 12:45
Location: Pirongia, New Zealand

Re: Boot and install Mageia6 LiveDVD from grub2 loop device

Postby mozg1986 » Sep 27th, '16, 09:14

Yes, I try first start in qEmuBootTester, but with the real equipment, the same error (with and without SecureBoot).
Found on the Internet the following:
"alloc magic is broken" is an error that occurs in the GRUB memory management.

The GRUB memory manager uses magic numbers in each of it's memory block structures to denote whether that chunk is available or free. When a function in the GRUB loader attempts to free memory, it checks to see if that block is allocated by checking for the magic allocated number. If it doesn't match, you see this error.


It is quite possible, as I used grub2 compiled and downloaded from the Internet (plus the efi version of the previously compiled the bootloader you can just put in the right folder and everything should work).

Now I've reassembled grub2 using grub-install and get error in another form: "error: out of range" and nothing more.

The version of grub2 and the partition configuration before attempting to load the kernel in the screenshot.
driveconfig.jpg
driveconfig.jpg (82.79 KiB) Viewed 9847 times

grub-install downloaded from gnu.org and ran with the following parameters:

Code: Select all
grub-install.exe  --no-nvram --target=x86_64-efi --efi-directory=E:/ --bootloader-id=GRUB2 --boot-directory=E:/EFI/BOOT //./physicaldrive1 --removable --no-floppy --modules="normal configfile echo test true minicmd ls search gzio ntfs part_msdos part_gpt iso9660 fat ext2 hfsplus loopback boot linux halt reboot chain appleldr cpuid loadbios efi_gop efi_uga fixvideo"


Also found a discussion in which users redhat there was a similar problem after receiving updates - as I understand it, was in SecureBoot they have to run linux you want to use command "linux" and "initr", and "linuxefi" and "initrdefi"
mozg1986
 
Posts: 11
Joined: Jan 13th, '14, 07:04

Re: Boot and install Mageia6 LiveDVD from grub2 loop device

Postby mozg1986 » Sep 27th, '16, 10:30

Ha-ha-ha!!! I made another partition on the hdd, formatted it to fat, put the iso and loaded it into the loop from there. And initrd booted!
Why? WHY the developers of Mageia so hard to ignore the ntfs file system?

Decided to do so: the efi partition will increase to 10GB, and it will put the images that are not loaded with ntfs. However, the netinstall iso is fine to start if it was mounted in a loop with ntfs partition

Next problem: after running initr script /sbin/mgalive-root is trying to mount a partition labeled 'Mageia-6-PLASMA5-LiveDVD' (the label is specified in the kernel parameter root=LABEL='your desired label') file system iso9660 (or vfat, if the kernel parameter is 'liveuefi=yes'). Further, mounted the system looks for and attaches the file /loopbacks/distrib-lzma.sqfs. The inconvenient solution to this problem is to unpack the iso to the root of the vfat partition, be transmitted in the run settings label vfat partition and the parameter 'liveuefi=yes'.

In most distributions there is an opportunity to pass startup parameters the path to the iso file that you want to pre-mount, but somehow, in Mageia there is no such. I did some research on scripts in the initrd, I think there is a possibility to execute a customized script or command. Who will tell me, can it be done and how?
Last edited by mozg1986 on Sep 28th, '16, 21:22, edited 1 time in total.
mozg1986
 
Posts: 11
Joined: Jan 13th, '14, 07:04

Re: Boot and install Mageia6 LiveDVD from grub2 loop device

Postby doktor5000 » Sep 27th, '16, 16:35

mozg1986 wrote:Why? WHY the developers of Mageia so hard to ignore the ntfs file system?

Are you kidding? Mageia offers ntfs support out of the box and automatically detects and mounts windows partitions during installation.

You should complain to the grub developers, if at all - as your whole experiment is about loop-mounting and iso file and about grub2/grub-efi and UEFI.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18073
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Boot and install Mageia6 LiveDVD from grub2 loop device

Postby mozg1986 » Sep 27th, '16, 16:51

This is only for the running system (kernel modules for ntfs loaded at boot, I admit). The problem is that the LiveDVD disc, the Mageia developers have added ntfs support in the initrd, that is, in stage-1 when booting from the LiveDVD, there is no ntfs support. But netinstall iso is the way they have implemented it.
Last edited by doktor5000 on Sep 27th, '16, 21:14, edited 1 time in total.
Reason: removed fullquote
mozg1986
 
Posts: 11
Joined: Jan 13th, '14, 07:04

Re: Boot Mageia6 LiveDVD from grub2 loop device

Postby doktor5000 » Sep 27th, '16, 21:15

Please next time do not use fullquotes, but only use the Reply function. Greatly improves clarity and reading flow.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18073
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Boot Mageia6 LiveDVD from grub2 loop device

Postby gohlip » Sep 28th, '16, 07:08

re: ntfs
yes, doktor5000 is right. the capabilty is there.

The inconvenient solution to this problem is to unpack the iso to......


Have you tried to unpack it to an ext partition and run it from there?
Wouldn't that work as well?

But anyway, another point is that if you need to unpack anything to a partition (ntfs or otherwise), that is not a true isofile boot (or loop boot, whatever we want to call it).
Yes, other OS's can boot isofiles (without unpacking) - and I do it with all debian, ubuntu (and their derivatives), arch, manjaro, gparted, grml and...
And I cannot do that with Mageia (since M2) [1]
And I don't think it can be done now either.
But if you can find a way, without unpacking, let us know.
But I think you are right that Mageia grub developers have to do something to make that work,, what exactly, I don't know.

[1] -edit - and the reason I thought is that Mageia (M2, M3,M4 at least) default is grub-legacy and grub-legacy cannot handle iso boots.
While I've always used grub2 for Mageia (since M2), don't think it'll work then. Still I tried, won't work.
Why do we live? To prove not everything in nature has a purpose.
gohlip
 
Posts: 573
Joined: Jul 9th, '12, 10:50

Re: Boot Mageia6 LiveDVD from grub2 loop device

Postby mozg1986 » Sep 28th, '16, 15:10

gohlip, I don't know whether to run the following method with grub-legacy, but in grub4dos I have the following method:
Put the image on a fat partition or even ntfs, and then use hybrid mapping:
Code: Select all
title Mageia6 x64 live DVD and install
partnew (%@root:~1,3%,3) 0x00 /iso/Mageia-6-sta1-LiveDVD-PLASMA5-x86_64-DVD.iso
map /iso/Mageia-6-sta1-LiveDVD-PLASMA5-x86_64-DVD.iso (0xff)
map --hook
chainloader (0xff)


The trick is that the partnew command mounts the image as one of the sections of the boot device. If the key is already used - it will be overwritten. In the above example, the command partnew writes image data in the 4th section as the most rarely used.
mozg1986
 
Posts: 11
Joined: Jan 13th, '14, 07:04

Re: Boot Mageia6 LiveDVD from grub2 loop device

Postby mozg1986 » Sep 28th, '16, 18:22

Yes, I was able to run the LiveDVD of Mageia 6 mounted loop iso! The problem was that the text editor I use for editing .cfg files, saved files with utf8 encoding. Today at work I opened the grub2 configuration file in another editor, made some minor amendments to it, tried to start and was surprised to find that Mageia is Live loaded. My edits of the file were not able to influence the behaviour of the loader, but the editor at work saved the file in ANSI. It really solved the problem.

My working config file:
Code: Select all
insmod video_bochs
insmod video_cirrus
insmod video_fb

insmod font
if loadfont /EFI/BOOT/grub/fonts/unicode.pf2
then
   insmod gfxterm
   set gfxmode=auto
   set gfxpayload=keep
   terminal_output gfxterm
fi

insmod png
set theme=/EFI/BOOT/grub/themes/starfield/theme.txt
export theme

set default=0
set timeout=60

LANG=ru_RU
LANGUAGE=ru_RU

menuentry 'Windows UEFI/GPT' {
    search --no-floppy --set=root -f '/EFI/MICROSOFT/BOOT/bootmgfw.efi'
    chainloader ($root)/EFI/MICROSOFT/BOOT/bootmgfw.efi
}

menuentry 'Mageia 6 (Cauldron) x64' {
set iso='/iso/Mageia-6-sta1-LiveDVD-PLASMA5-x86_64-DVD.iso'
if loopback loop ${iso}
then
   if search --no-floppy --set=root -l 'Mageia-6-PLASMA5-LiveDVD'
   then configfile /EFI/BOOT/grub.cfg
   else search --no-floppy --set=root -f '/grub4dosmultiboot'
   fi
else search --no-floppy --set=root -f '/grub4dosmultiboot'
fi
}

Тhe File bootx64.EFI I have compiled with the modules:
    normal configfile echo test true minicmd ls search gzio ntfs part_msdos part_gpt iso9660 fat ext2 hfsplus loopback boot linux halt reboot chain appleldr cpuid loadbios efi_gop efi_uga fixvideo
There was a problem with booting the kernel when the disk image is on an ntfs partition (remember, if the disk image is on an ntfs partition, the Mageia core 6 LiveDVD fails to boot, grub2 is responsible for the error 'read out of range', but core Mageia 6 netinstall loaded). It's probably a bug in the Grub2 and then affect the result image size.
mozg1986
 
Posts: 11
Joined: Jan 13th, '14, 07:04

Re: [SOLVED] Boot Mageia6 LiveDVD from grub2 loop device

Postby gohlip » Sep 28th, '16, 19:38

A few interesting points ... (meaning I don't understand.. :) )

search --no-floppy --set=root -l 'Mageia-6-PLASMA5-LiveDVD'

You have a partition with label 'Mageia-6-PLASMA5-LiveDVD' that contains your iso in path '/iso/Mageia-6-sta1-LiveDVD-PLASMA5-x86_64-DVD.iso' ?
and if that partition is in ntfs, it won't work? How about putting 'insmod ntfs' ? Will it then work?


configfile /EFI/BOOT/grub.cfg

What is that grub.cfg? Why can't it be just an entry in your main grub.cfg that boots?
Can you print out this /EFI/BOOT/grub.cfg ?
And in EFI/BOOT ? Not /boot/efi (which should be fat32 anyways)?


bootx64.EFI I have compiled with the modules:
and you needed to compile this bootx64.efi ?
That's way beyond me..

And you manage to boot using grub-legacy with this 'hybrid mapping'. I had always thought it cannot be done with grub-legacy.
I also know nothing about grub4dos. I knew that grub2 is multiboot compliant, but grub4dos and grub-legacy?

Though mostly I don't know what you did, I am impressed.

If you can come up with a simple grub2 menuentry to boot a Mageia isofile something along these lines...(below just my invention), that would be perfect.

Code: Select all
menuentry "Mageia  iso" {
    insmod part_gpt
    insmod part_msdos
    insmod ext2
    insmod ntfs
    set isofile=/xxx/'Mageia-6-PLASMA5-LiveDVD'
    search --no-floppy -f --set=root $isofile
    loopback loop $isofile
    linux  (loop)/mageia/boot/mageia.vmlinuz basedir=mageia mageialabel=$mageialabel
    initrd  (loop)/mageia/boot/mageia.img
}



Anyway, glad you had something worked out. Hope you can contribute more to Mageia. Cheers.
Why do we live? To prove not everything in nature has a purpose.
gohlip
 
Posts: 573
Joined: Jul 9th, '12, 10:50

Re: [SOLVED] Boot Mageia6 LiveDVD from grub2 loop device

Postby mozg1986 » Sep 28th, '16, 20:21

search -f /some/file (or search --file /some/file)
This will display all partitions containing the file /some/file

search -u Some_UUID (or search --fs-uuid Some_UUID )
This displays all partition whose UUID is Some_UUID

search -l Some_Label (or search --label Some_Label)
This displays all partitions whose label is Some_Label

You can add a couple of options to "search"

-n (or --no-floppy) :
tells grub not look at the floppy drive when searching.

-s Some_Variable (or --set=Some_Variable)
instead of displaying all partitions found, it sets the variable Some_Variable to the first partition found.

--set
same as --set=root

Partition labeled 'Mageia-6-PLASMA5-LiveDVD' appears in me after I mount in loop .iso image. The image can reside on a fat partition or on an ntfs partition, mount it loopback module in both cases successfully. Further, the behavior of grub is different. If .iso located on a ntfs partition - grub cannot load vmlinuz and gives an error. If the .iso is located on a fat partition - grub successfully loads vmlinuz.

My task was to create a multi-boot mobile hdd with the option to boot in EFIx64 mode. On the boot media must be presented fat32 partition. For booting images .efi, located in the folder /EFI/BOOT, are used.

tYou specify? The location of the main grub.cfg, and all modules, themes and fonts for grub2, when you compile bootx64.efi with the option --boot-directory=E:/EFI/BOOT. To compile bootx64.efi need to run grub-install with --target=x86_64-efi.

In Your config you need to add insmod loopback, if it was not compiled in the loader grub. Also, in setup variable $iso You can specify full path to your .iso
About kernel options, nothing concrete can not say. For live image and for the installed system they are different.
mozg1986
 
Posts: 11
Joined: Jan 13th, '14, 07:04

Re: Boot Mageia6 LiveDVD from grub2 loop device

Postby filip » Sep 29th, '16, 09:28

mozg1986 wrote:There was a problem with booting the kernel when the disk image is on an ntfs partition (remember, if the disk image is on an ntfs partition, the Mageia core 6 LiveDVD fails to boot, grub2 is responsible for the error 'read out of range', but core Mageia 6 netinstall loaded). It's probably a bug in the Grub2 and then affect the result image size.


Did you check that *.iso file saved in fragments is OK to load?
filip
 
Posts: 478
Joined: May 4th, '11, 22:10
Location: Kranj, Slovenia

Re: [SOLVED] Boot Mageia6 LiveDVD from grub2 loop device

Postby mozg1986 » Sep 29th, '16, 09:33

Forgot to describe this important point. Images .iso you want to defragment. I did this program WinContig Windows.
mozg1986
 
Posts: 11
Joined: Jan 13th, '14, 07:04


Return to Testing : Alpha, Beta, RC and Cauldron

Who is online

Users browsing this forum: No registered users and 1 guest