Saturday 7 May 2022

Adding a 32-bit GRUB bootloader to boot and install ISOs


Many distros no longer include both 32-bit and 64-bit bootloader support. Unfortunately some hardware including most based on the relatively recent Intel Atom processor architecture won't boot 'OOTB'. Whilst I wrote '' and '' in part to address this issue I restricted their functionality to the Ubuntu 'family' of ISOs for support purposes. One of the most frequest questions I have been asked is 'can you add support for <insert distro> ISOs?'. Unfortunately distros, even those based on or derived from Ubuntu, are often built with different directory structures and packages. As a result writing a script that caters for multiple distros becomes complex and cumbersome. However with Ubuntu looking to move to a new snap-based installer I've revisited the 32-bit boot issue. 

Initially I created a simple script '' to just add the 32-bit GRUB bootloader to the Ubuntu 'family' of ISOs. But if a different distro uses a similar file system layout then essentialy there is no reason why it also wouldn't work so I've extended this script to include an '--unsupported' option to allow running, or at least attempt running, with any ISO.

Invocation is straightforward:

linuxium@LINUXIUM:~$ -h
Usage: -h | [ --unsupported ] -i <ISO> [ --disk ] Exiting ... ISO not created.

being derived from ''. 

To create a bootable Ubuntu or similar ISO:

linuxium@LINUXIUM:~$ -i linuxmint-20.3-cinnamon-64bit.iso Running in RAM ... Extracting treetoobitiso files ... Extracting ISO ... Adding 32-bit GRUB bootloader ... Spinning ISO ... Respun ISO created as 'linuxium-linuxmint-20.3-cinnamon-64bit.iso' ... see logfile 'treetoobitiso.log' for details.

For other ISOs:

linuxium@LINUXIUM:~$ -i pop-os_22.04_amd64_intel_4.iso 'pop-os_22.04_amd64_intel_4.iso' must be an Ubuntu, Kubuntu, Lubuntu, Ubuntu Budgie, Ubuntu GNOME, Ubuntu MATE, Xubuntu or Linux Mint desktop ISO. Exiting ... ISO not created.

use the '--unsupported' option:

linuxium@LINUXIUM:~$ --unsupported -i pop-os_22.04_amd64_intel_4.iso Running in RAM ... Extracting treetoobitiso files ... Extracting ISO ... Adding 32-bit GRUB bootloader ... Spinning ISO ... Respun ISO created as 'linuxium-pop-os_22.04_amd64_intel_4.iso' ... see logfile 'treetoobitiso.log' for details.

As long as the ISO has a file system layout that is recognised by the script, it should work otherwise you will be notified:

linuxium@LINUXIUM:~$ --unsupported -i Fedora-Workstation-Live-x86_64-35-1.2.iso Running in RAM ... Extracting treetoobitiso files ... Extracting ISO ... ISO structure currently not supported. Exiting ... ISO not created.

Once booted an installation will be dependent on the ISO's installer. Typically it will try to install a 64-bit GRUB bootloader however it may also fail as whilst it recognises that it was booted by a 32-bit bootloader it likely will not have the code to handle such an installation.

So I've created a companion script '' to install a 32-bit GRUB bootloader during an installation attempt and again, whilst the Ubuntu 'family' of ISOs is supported, if the ISO is Debian/Ubuntu based (i.e. uses the 'apt' package manager) then it may also work using the '--unsupported' option.

For Ubuntu or similar ISOs perform the installation and then immediately before closing the final installation 'success' screen run the '' script.

Some ISOs use the same partitions as Ubuntu for installation which simplifies running the script.

Others use a random name for the mount point and may not leave both the 'installation' and 'boot' partitions mounted at the end of the installation. It is best to first run 'lsblk -a' to see the current state and then perform any required mounting manually.

It is possible that an installation will finish leaving no sign of the partitions so both the mount point and paritions have to be set up first prior to running the script.  

Unfortunately not all installations will complete successfully and depending on what the installer still had left to do means there may be additional manual steps required (hence the 'unsupported' caveat). In the case of Debian looking at the Calamares installer indicates that this includes removing the 'live-*' and 'calamares-settings-debian' packages.

Also if the installation does not support the 'apt' package manager then the script will refuse to run.

Finally, and perhaps of interest to anyone believing in 'snap' security or non-repudiation, specifically for the current 'canary' Ubuntu 22.04 ISO which uses the new Ubuntu ​desktop installer, it is necessary to run the '' script before starting the installation. This will inject code into the desktop installer snap to use 32-bit GRUB packages as otherwise the installation will fail and recovery becomes tedious.

Please donate to help support the development if you find the script useful by following the link