Skip to main content

Booting ISO Images in Mageia Linux

Years ago, I used GRUB and memdisk to boot directly from ISO images I kept in /boot/. Things like SpinRite, F4UBD, PLPBT and so on. It was pretty straightforward on 32-bit Linux using GRUB.

Then GRUB2 came along and I found it frustrating. What made it even worse was that much of what I found on the Internet was specific to Ubuntu and the non-standard way in which Ubuntu implements things. As well, for the Ubuntu crowd, solutions were presented as recipes, so copy-paste ruled the day without any explanation as to why certain settings were chosen and what options were available. In other words, it was difficult to translate these "solutions" to anything but Ubuntu Linux.

For Mageia, it is helpful to know what the distro uses as the default directories. Mageia provides the following file:

# /etc/grub-customizer/grub.cfg
# Configuration file for grub-customizer
#(not to be confused with grub.cfg for grub2)

#Command name changes for

Mageia.MKCONFIG_CMD=grub2-mkconfig

INSTALL_CMD=grub2-install

MKFONT_CMD=grub2-mkfont

# These are the default configuration file locations used by grub2 in Mageia.

CFG_DIR=/etc/grub.d

OUTPUT_DIR=/boot/grub2

OUTPUT_FILE=/boot/grub2/grub.cfg

SETTINGS_FILE=/etc/default/grub


Also note that to avoid confusion with GRUB commands, all GRUB2 commands in Mageia are prefixed with grub2-*.

Where Is the GRUB2 Bootloader Installed?

Reboot your machine and enter the GRUB2 menu and press C which brings you to the GRUB2 command prompt. For now, the only one that you need is: ls.


To discover this, the following two commands are useful.

$ sudo grub2-probe -t device /boot/grub2

which in my case, returns /dev/sdc1.

To discover the UUID of the device, 

$sudo grub2-probe -t fs_uuid /boot/grub2

which returns for me,

40906922-182b-4c6f-8cac-3267d104ade8

While the configuration file for GRUB2 is kept in /boot/grub2/grub.cfg, it is not to be edited directly. Instead, configuration files found in /etc/grub.d are accessed to build the configuration file that is ultimately used. The filename prefixes in that directory have specific meaning to GRUB2 and by default, the file 40_custom is intended to be modified by the user. The file must be executable to be included in the final configuration.

Let's create a custom GRUB2 menu entry for F4UBCD. Falcon 4's Universal Boot CD is Grub4DOS-based and provides many system utilities as well as a running Windows MiniXP . The intent is to provide tools to repair computer systems. The ISO image contains a readme.txt file with a plethora of information The information about the ISO image is:

$ sudo isoinfo -d -i /boot/F4UBCD.iso 
CD-ROM is in ISO 9660 format
System id: Win32
Volume id: F4UBCD v4.61
Volume set id: 
Publisher id: 
Data preparer id: 
Application id: MKISOFS ISO 9660/HFS FILESYSTEM BUILDER & CDRECORD CD-R/DVD CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING
Copyright File id: 
Abstract File id: 
Bibliographic File id: 
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 357231
El Torito VD version 1 found, boot catalog is in sector 64
NO Joliet present
NO Rock Ridge present
Eltorito validation header:
    Hid 1
    Arch 0 (x86)
    ID ''
    Key 55 AA
    Eltorito defaultboot header:
        Bootid 88 (bootable)
        Boot media 0 (No Emulation Boot)
        Load segment 0
        Sys type 0
        Nsect 4
        Bootoff 42 66

But what kind of ISO image is it? Standard or Hybrid? Using fdisk -l on the image, a hybrid ISO image will look like a hard drive with partitions, a standard ISO image will look like this:
# fdisk -l  /boot/F4UBCD.iso
Disk /boot/F4UBCD.iso: 697.7 MiB, 731609088 bytes, 1428924 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

We may not need all this information, but that's how to get it if we do.

One extra component we may need is memdisk. It's part of the Syslinux package and can boot floppy images, hard disk images and some ISO images. However, Mageia7's version of syslinux does not provide memdisk.


Here's what a custom script will look like to boot a grub4dos ISP image, F4UBCD.iso.

menuentry "F4UBCD" {

This is our first line that provides the name of the menu entry to GRUB2; it always ends with a left curly bracket. The entire menu entry will end with a right curly bracket.

insmod iso9660
insmod part_msdos
insmod chain

These three lines load modules necessary for GRUB2 to look inside the image. These modules provide iso9660 support which is needed to read optical discs that use this filesystem, provide support for MS-DOS (MBR) partitions and partitioning tables and provide support for MS-DOS (MBR) partitions and partitioning tables.

chainloader (hd2,0)+1
}

This line invokes the chainloader on the hard drive discovered above.

RESOURCES

https://help-grub.gnu.narkive.com/nLb4Hafg/grub-2-how-boot-iso-with-memdisk

https://askubuntu.com/questions/1254298/boot-ubuntu-iso-pure-from-ramdisk-memdisk

http://www.ultimatebootcd.com/forums/viewtopic.php?p=9108#p9108

http://www.panticz.de/MultiBootUSB


https://www.gnu.org/software/grub/grub-documentation.html


https://pccloud9.com/Files/F4UBCD-4.61.iso

https://help.ubuntu.com/community/Grub2/CustomMenus

https://help.ubuntu.com/community/Grub2/ISOBoot

https://help.ubuntu.com/community/Grub2/ISOBoot/Examples

2

https://wiki.gentoo.org/wiki/GRUB2/Chainloading


https://unix.stackexchange.com/questions/15015/how-to-boot-from-iso-with-grub2-burg-boot-loader



Comments

Popular posts from this blog

DOS4GW.EXE Version 2.01a and Alternative DOS Extenders

DOS4GW.EXE The Tenberry DOS extender DOS4GW.EXE was used by many early DOS games. I still enjoy playing many of these games and DOS4GW.EXE is usable with DOSBox , so they can be played on Linux. However, the version of DOS4GW.EXE that was included with the game was whatever was current at the time. The most recent version that includes many bugfixes that possibly affected the games when used with DOSBox have been fixed in the latest version, 2.01a. It's not free at US$49, but you can downloaded it here . Simply substitute it for whatever version of DOS4GW.EXE your game provided and enjoy the bug-fixed goodness. Tenberry also makes a "high-performance" "pro" version of DOS4GW.EXE, but it costs $300. I think that they could sell quite a few of these to hobby users (since, you know, DOS is dead) for US$5. Open Souce to the Rescue There are better performing, free and Open Source alternatives available and worth a look. DPMI Explained Let's unders

Unreal Tournament GOTY/UT99 for Modern Linux

Released on November 16, 1999, Unreal Tournament (also known as UT99) is an arena first-person shooter for Multiplayer on-line competition or you can play against bots off-line. It features several game types, with more details provided at Wikipedia . The game was re-released on February 25, 2000 as Unreal Tournament Game of the Year Edition (GOTY) which included the three bonus packs released previously and additional mods, or game modifiers that had become popular. It is the GOTY version that is available from STEAM or  GOG.com . The GOG version for Windows installs in Linux and plays well using WINE , PlayOnLinux or Codeweaver's Crossover . There is a Linux binary available in two versions, one for the original game and one for the GOTY edition . Also provided at that site is the Official Bonus Pack with a Linux installer. All these Linux installers are created with makeself . There are some issues using such a crusty old Linux binary. Let's see why getting a Lin

Return to Castle Wolfenstein for Modern Linux

Return to Castle Wolfenstein is a first-person shooter originally released on November 19, 2001. The game, like many other classic games, is available at GOG.com and costs only US$5.99. iortcw for Linux Don't bother with old and crusty Linux binaries offered by idsoft; they are problematic and it's painful to use them on a modern Linux. Fortunately for us, there are more modern GPL-licensed Linux binaries available for 32- and 64-bit systems as well as high resolution textures packages. The project at GitHub provides source code that can also be compiled for MS Windows using MinGW. iortcw for Windows and Mac You can download pre-compiled binaries for 32- and 64-bit Linux, MS Windows and Mac from here . Let's put our files in /usr/local/games/rtcw . As root, extract the downloaded .ZIP file for your architecture to  /usr/local/games/rtcw . All we are missing are the game data files. I purchased them from GOG.com. The game installer downloaded from GOG.com can be