Discussion:
Editing grub/EFI config on (net) installer ISO for serial install
(too old to reply)
Andy Smith
2024-07-29 10:00:01 UTC
Permalink
Hi,

I am used to installing Debian by PXE boot and serial console. For
that purpose I'm familiar with editing the isolinux config files to
have the kernel serial settings (console=ttyS… etc) in
isolinux/txt.cfg.

Now for the first time I am trying to install a system that has a
management controller that adds virtual media from ISOs, but I would
still like to see that install over the IPMI serial.

Currently when I add the Debian 12 netinst ISO as a virtual media it
EFI boots grub, not isolinux, so the output of grub only goes to the
graphical terminal (a web interface of the management controller in
this case).

I can then force the install to proceed over serial by editing the
"Install" grub option and adding the familiar:

--- console=ttyS1,115200n8

pn the end of the kernel line, and that works, so I am nearly there.

I'd really like for this thing to by default boot grub in text mode
on the serial console though.

I guess I need to find the grub configuration that is in use from
the ISO and add the usual

serial --unit=1 --speed=115200 --word=8 --parity=no --stop=1
terminal_input serial
terminal_output serial

Should I just edit that into $iso_root/boot/grub/grub.cfg and repack
the ISO?

Is there any documentation page about this? Everything I found so
far just covers the isolinux bit, which doesn't appear to be
relevant here.

Thanks,
Andy
Thomas Schmitt
2024-07-29 10:50:01 UTC
Permalink
Hi,
Post by Andy Smith
Currently when I add the Debian 12 netinst ISO as a virtual media it
EFI boots grub, not isolinux,
That's because Debian ISOs advertise a EFI System Partition with GRUB
initial boot equipment:

$ xorriso -indev debian-12.2.0-amd64-netinst.iso \
-report_el_torito plain -report_system_area plain
...
El Torito images : N Pltf B Emul Ld_seg Hdpt Ldsiz LBA
El Torito boot img : 1 BIOS y none 0x0000 0x00 4 5863
El Torito boot img : 2 UEFI y none 0x0000 0x00 18976 1119
El Torito img path : 1 /isolinux/isolinux.bin
El Torito img opts : 1 boot-info-table isohybrid-suitable
El Torito img path : 2 /boot/grub/efi.img
...
MBR partition table: N Status Type Start Blocks
MBR partition : 1 0x80 0x00 0 1286144
MBR partition : 2 0x00 0xef 4476 18976
MBR partition path : 2 /boot/grub/efi.img

The file /boot/grub/efi.img is a FAT filesystem image.
One could mount it read-write

mount -o offset=2291712 /dvdbuffer/debian-12.2.0-amd64-netinst.iso /mnt/fat

and manipulate it inside the ISO. (2291712 = 4476 * 512)
But new SYSLINUX content would be an expert task and would not work from
optical media, because SYSLINUX EFI from CDROM is broken and will hardly
ever be fixed.
Post by Andy Smith
I guess I need to find the grub configuration that is in use from
the ISO and add the usual
serial --unit=1 --speed=115200 --word=8 --parity=no --stop=1
terminal_input serial
terminal_output serial
Such stuff is in the /boot/grub/ directory of the ISO. The sparse config
in the EFI partition /mnt/fat/efi/debian/grub.cfg

search --file --set=root /.disk/id/1af76032-4f8c-416b-90c5-76b1833daf0a
set prefix=($root)/boot/grub
source $prefix/${grub_cpu}-efi/grub.cfg

loads one of the ISO files /boot/grub/*-efi/grub.cfg which both load
/boot/grub/grub.cfg :

source /boot/grub/grub.cfg


Problem is that the FAT filesystem is tightly wrapped around its content:

$ df /mnt/fat
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 9450 9446 4 100% /mnt/fat

If you can omit 32-bit EFI, then there would be plenty of room to recover
by deleting

-rwxr-xr-x 1 root root 758552 Oct 7 2023 /mnt/fat/efi/boot/bootia32.efi
-rwxr-xr-x 1 root root 3753408 Oct 7 2023 /mnt/fat/efi/boot/grubia32.efi
Post by Andy Smith
Should I just edit that into $iso_root/boot/grub/grub.cfg and repack
the ISO?
If altering the EFI partition is not viable, then surely: Yes.
(The debian-cd people might already object manipulations of their
carefully composed EFI partition.)
Post by Andy Smith
Is there any documentation page about this?
Repacking ISOs:
https://wiki.debian.org/RepackBootableISO
Especially look at this example:
https://wiki.debian.org/RepackBootableISO#In_xorriso_load_ISO_tree_and_write_modified_new_ISO

(Beware of bug with -boot_image "any" "replay" in xorriso <= 1.5.6:
Do not overwrite the BIOS boot image /isolinux/isolinux.bin by the
manipulation commands like -map.)


Have a nice day :)

Thomas
Andy Smith
2024-07-29 12:30:01 UTC
Permalink
Hi,
Post by Thomas Schmitt
Post by Andy Smith
Should I just edit that into $iso_root/boot/grub/grub.cfg and repack
the ISO?
If altering the EFI partition is not viable, then surely: Yes.
Is there some advantage in me editing one of the files in the EFI
partition as opposed to just putting the grub serial directives in
/boot/grub/grub.cfg of the ISO?
Post by Thomas Schmitt
Post by Andy Smith
Is there any documentation page about this?
https://wiki.debian.org/RepackBootableISO
https://wiki.debian.org/RepackBootableISO#In_xorriso_load_ISO_tree_and_write_modified_new_ISO
Thanks - I am okay with the actual repacking of the ISO though. I
was just wondering about the grub layout on the ISO and where my
changes should be done for this.

Thanks,
Andy
--
https://bitfolk.com/ -- No-nonsense VPS hosting
Thomas Schmitt
2024-07-29 13:00:01 UTC
Permalink
Hi,
Post by Andy Smith
Is there some advantage in me editing one of the files in the EFI
partition as opposed to just putting the grub serial directives in
/boot/grub/grub.cfg of the ISO?
None that i know of.

Editing /efi/debian/grub.cfg of the EFI partition filesystem would just
happen inside the ISO data storage without imposing the need for making
a new ISO.

The tight size of the Debian ISO EFI partition is not very inviting for
this. It also would have to be explored whether modifying the grub.cfg
file in the EFI partition can cause trouble with Secure Boot.


Have a nice day :)

Thomas

Loading...