Skip to content

Misc GRUB + boot related changes#27

Open
mika wants to merge 5 commits into
masterfrom
mika/grubonly
Open

Misc GRUB + boot related changes#27
mika wants to merge 5 commits into
masterfrom
mika/grubonly

Conversation

@mika

@mika mika commented Apr 30, 2026

Copy link
Copy Markdown
Member

Addressing #26 (not yet ready though, messed up something about /var/lib/tftpboot/boot/grub/grml* files which are missing and having wrong paths for kernel/initrd files then)

mika added 2 commits April 30, 2026 13:40
To match the behavior of our default ISO boot.

Closes: #25
We switched to GRUB 2 for BIOS boot instead of isolinux
in grml-live recently, see grml/grml-live#459
Now we no longer provide the expected files on our ISO any longer.

Booting BIOS systems via PXE using grml-terminalserver on recent Grml
ISOs now fails with:

  PXELINUX 6.04 PXE 20250811 Copyright (c) 1994-2015 H. Peter Anvin et al

  Failed to load ldlinux.c32
  Boot failed: press a key to retry, or wait for reset...

So point both isc-dhcp-server and dnsmasq at grub/i386-pc/core.0 for
BIOS/legacy clients instead of pxelinux.0. The GRUB i386-pc netboot
image is generated via grub-mknetdir (from grub2-common, requires
grub-pc-bin for the i386-pc modules), and shares the same grub/grub.cfg
already served to EFI clients. Generation is decided whether pxelinux.0
is present in the TFTP directory, which indicates that BIOS boot support
is expected, regardless of how the terminalserver system itself booted.

pxelinux.0 and pxelinux.cfg/default remain in the TFTP tree for
backwards compatibility with clients that request pxelinux explicitly.

While at it, also drop the legacy /lib/live/mount/medium and grml-live
template fallback code paths from grub-pxelinux_config, keeping only the
/run/live/medium path in use since December 2018.

Closes: #26
@zeha

zeha commented Apr 30, 2026

Copy link
Copy Markdown
Member

i think the problem here is a mismatch between what grml2usb expects and does and what the ISO provides and grml-terminalserver then copies.

grml2usb always writes "multiboot" config, thus the grub config expects (/var/lib/tftpboot/)/boot/grmlfullarm64/vmlinuz. But a normal ISO provides only /boot/vmlinuz, and grml-terminalserver copies that to /var/lib/tftpboot/boot/vmlinuz. Same for initrd.

I think thats best fixed in grml2usb, either by adding vmlinuz, initrd copying to --bootloader-only or some other option...

@mika

mika commented Apr 30, 2026

Copy link
Copy Markdown
Member Author

Indeed. But what's strange is that even with the cp -r "${filename}" "${TFTPD_DATA_DIR_}/boot/" then in the end the files are missing then on my system, something looks fishy but I didn't yet manage to track this down. I'd strongly prefer if we don't have a hard dependency between grml-terminalserver and specific grml2usb versions and if that could stay as-is with backwards compatibility.

@mika

mika commented Apr 30, 2026

Copy link
Copy Markdown
Member Author

Alright, managed to get this initially working, at least for BIOS + EFI boot when booting grml-full-2026.04-amd64.iso and invoking grml-terminalserver. It clearly needs further testing with older releases yet, including arm64 and further review whether all changes really make sense as such or something is just a workaround for something I broke elsewhere. :)

@mika
mika requested review from jkirk and zeha July 12, 2026 00:04
@mika

mika commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

I'll try to further verify this together with grml/grml-live#548, but I think it's ready for an actual round of review :)

@mika
mika marked this pull request as ready for review July 12, 2026 00:05
Comment thread templates/grub-bios_config Outdated
echo "${TFTPD_DATA_DIR_}/grub/i386-pc/core.0 exists already, nothing to do."
else
echo "Generating GRUB i386-pc netboot image for BIOS PXE boot"
grub-mknetdir --net-directory="${TFTPD_DATA_DIR_}" --subdir=grub

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do this (Additionally for now i guess) also do this in grml-live and pack the relevant files into the iso? (not squashfs)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah maybe, didn't look into this yet (and I guess I could use some second pair of eyes + another brain to make sure we don't add too much duplicated code and all of it still makes sense, so far I tried to get it working with what we have, also want to avoid having a too strict version dependency between Grml ISOs and grml-terminalserver)

Remove all pxelinux/syslinux installation and configuration code, now
pxelinux.0, pxelinux.cfg/, boot.msg, logo.16, ISOLIN_PATH_,
PXE_BOOT_MSG_, and PXE_BOOT_LOGO_ are all gone. The grub-pxelinux_config
template gets renamed to grub-bios_config to reflect that GRUB now
handles both BIOS and EFI network boot.

The GRUB BIOS setup is handled depending on grub-pc-bin being present or
not, which as expected skips the i386-pc setup on arm64.

We drop the dependency on pxelinux, and add grub-pc-bin  (as required by
grub-mknetdir to generate grub/i386-pc/core.0) to Recommends, as we have
an architecture all package.

Drop the deprecated ldbsd.com / addon__*_bsd.cfg support, while at it.
@mika
mika requested a review from zeha July 12, 2026 09:37
mika added 2 commits July 12, 2026 15:02
… defaults

Now that we support $prefix instead of hardcoded /boot/grub usage in our
GRUB configuration files (see
grml/grml-live#548), we can also support custom
GRUB themes and alike.

Set up `grub` directory in tftpboot directory (/var/lib/tftpboot by
default) for booting GRUB via PXE/netboot, providing all files that
might be relevant for booting.

Avoid rewriting the configuration files on the fly, and instead bring
grub.cfg as close as possible to what we're using on the live system
also (the GRUB netboot binary sadly doesn't neither support sourcing
files with regexp nor testing for files with [ -e ....]).

NOTE: we are *not* setting up / including `addons.cfg`, as all entries
are known to be failing (the test for the files all fail as stated in
the previous paragraph already), even when removing the tests and
adjusting the paths to use $prefix/../addons/ instead of /boot/addons/,
it doesn't work and chainloading the addons via PXE/netboot fail with:

  error: Access violation

See grml/grml-live#321
While 32-bit UEFI hopefully isn't common any longer, let's support
it if either the grub-efi-ia32-signed or grub-efi-ia32-unsigned
packages are available, given we also support it in grml-live's
config/media-scripts/GRMLBASE/31-grub.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants