Package: debian-installer
Severity: important
Hi,
[ I'm going to call “dark menu” the “accessible dark contrast” menu;
also, I've palette-indexed a few screenshots in the hope to reach
both the BTS and the mailing list. ]
I didn't spot this immediately as it only shows up when using netboot,
e.g. using netboot's mini.iso or netboot-gtk's mini.iso (the same is
very likely via PXE too), under UEFI, with x86 images (i.e. amd64).
Fixing x86: netboot vs. netinst
===============================
The welcome screen is all nice, with a nice background and appropriate
colors. But as soon as one enters a submenu, colors get reset to some
default values, and everything looks bad.
See:
- netboot-1-welcome.png
- netboot-2-advanced-submenu.png
The same *doesn't* happen when using netinst instead (all other things
being equal), because in that case the minimal grub.cfg that's generated
by build/util/grub-gencfg during a debian-installer build is replaced by
one generated by debian-cd, via its tools/boot/bookworm/boot-x86:
# Create grub menu entries to match the isolinux ones
sed -i '/^menuentry/Q' $CDDIR/boot/grub/grub.cfg;
$BASEDIR/tools/boot/$DI_CODENAME/parse_isolinux \
boot$N/isolinux $CDDIR $BASEDIR/data/$DI_CODENAME/grub-theme.in "$DISKINFO_DISTRO" "$DEBIAN_KERNEL" "$DEBVERSION" \
>> $CDDIR/boot/grub/grub.cfg
I have not investigated further, but it looks like it uses some theme
instead of (or in addition to) hardcoded colors, which makes everything
looks good.
See:
- netinst-1-welcome.png
- netinst-2-advanced-submenu.png
This even allows entering the dark menu, getting black and white colors,
and getting back to the regular menu, getting the initial colors back.
Compare:
- netboot-3-dark-submenu.png [enter]
- netboot-4-welcome-again.png [exit]
versus:
- netinst-3-dark-submenu.png [enter]
- netinst-4-welcome-again.png [exit]
Back to the grub.cfg generated by debian-installer, let's look at what
happens for a netboot-gtk build, we have two grub.cfg:
build/dest/netboot/gtk/debian-installer/amd64/grub/x86_64-efi/grub.cfg
build/dest/netboot/gtk/debian-installer/amd64/grub/grub.cfg
The first one calls various `insmod` then sources the second one. Let's
look at the second one (only mentioning the most relevant parts):
if background_image /isolinux/splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
elif background_image /splash.png; then
set color_normal=light-gray/black
set color_highlight=white/black
else
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
fi
[…]
menuentry 'Install' {
set background_color=black
linux /debian-installer/amd64/linux vga=788 --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu --hotkey=a 'Advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
[…]
submenu '... Desktop environment menu ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
[…]
submenu --hotkey=d 'Accessible dark contrast installer menu ...' {
set menu_color_normal=white/black
set menu_color_highlight=yellow/black
set color_normal=white/black
set color_highlight=yellow/black
background_image
set gfxpayload=keep
menuentry '... Install' {
set background_color=black
linux /debian-installer/amd64/linux vga=788 theme=dark --- quiet
initrd /debian-installer/amd64/initrd.gz
}
submenu --hotkey=a '... Advanced options ...' {
set menu_color_normal=white/black
set menu_color_highlight=yellow/black
set color_normal=white/black
set color_highlight=yellow/black
background_image
set gfxpayload=keep
[…]
So we have two attempts at loading a background image and applying
specific colors, with a fallback to “usual” colors. But then, in each
and every submenu that is not “dark”, the fallback colors are hardcoded,
which explains why non-dark submenus look bad.
I'm therefore proposing *not* to force those colors in normal submenus,
and to only force colors when in the dark menu (and its submenus).
That would solve non-dark submenus' looking bad, but would not solve the
case of entering then exiting the dark menu: we would stick to black and
white colors. Solving this properly might involve finally addressing
this todo at the top of the grub-gencfg script:
# TODO: Theme generation from template
and/or forcing “appropriate” colors (see the two background_image calls
at the top of the file and the fallback) in all cases…
All that seems cumbersome and definitely not critical enough to be
investigated before Bookworm. If users enter the dark menu, either they
know what they're doing or they're going to learn what high contrast
looks like until they start the installer, or until they give up and
power-cycle their machine. :)
Using diffoscope against a full build with or without the attached
patch, I've verified that the only changes on amd64 are in:
netboot/debian-installer/amd64/grub/grub.cfg
netboot/mini.iso
netboot/netboot.tar.gz
netboot/gtk/debian-installer/amd64/grub/grub.cfg
netboot/gtk/mini.iso
netboot/gtk/netboot.tar.gz
In all cases, grub.cfg has the hardcoded colors going away. In both
mini.iso cases, the output has a lot of noise due to I think slight
changes in file sizes/block usage (no, I'm not becoming an ISO expert
today).
See how the only affected build targets are netboot and netboot-gtk,
leaving the “CD-oriented” ones alone, meaning no impact on debian-cd
builds. I consider this change to be safe for x86.
Not breaking arm64
==================
Now, build/util/grub-gencfg is used on some other architectures:
- ia64, which I'll ignore entirely;
- arm*, which got me worried a little.
Contrary to x86 that has some heavy duty machinery to keep isolinux and
grub menus aligned, arm* seem to ship directly the generated grub.cfg in
the “CD-oriented” bits, and we're seeing the same output with either
netboot* builds or netinst.
See:
- arm64-grub.png
(And yes, I'm going to pretend I've not seen the wrapping issue!)
This means that the diffoscope output lists more things between two full
arm64 builds, with or without the patch:
- netboot and netboot-gtk files, as in the am64 case, all fine;
- netboot/SD-card-images/firmware.*
- netboot/gtk/SD-card-images/firmware.*
- images/u-boot/*
- cdrom/debian-cd_info.tar.gz
- cdrom/gtk/debian-cd_info.tar.gz
The SD-card-images and u-boot bits seems to only be about a few bytes,
likely a serial number of some kind, and I'm not worried about that.
Seeing debian-cd_info.tar.gz there got me worried, keeping in mind the
original intent was to fix netboot* on x86!
That being said, let's look at a grub.cfg for arm64:
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
insmod gzio
menuentry 'Install' {
set background_color=black
linux /debian-installer/arm64/linux --- quiet
initrd /debian-installer/arm64/initrd.gz
}
menuentry 'Graphical install' {
set background_color=black
linux /debian-installer/arm64/linux --- quiet
initrd /debian-installer/arm64/gtk/initrd.gz
}
submenu --hotkey=a 'Advanced options ...' {
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
set gfxpayload=keep
menuentry '... Graphical expert install' {
set background_color=black
linux /debian-installer/arm64/linux priority=low ---
initrd /debian-installer/arm64/gtk/initrd.gz
}
[…]
Here, we see that we have the “usual”/“feedback” colors hardcoded at the
top, there's no background_image call, and there's no condition at all.
So dropping the re-hardcoding of the same colors in submenus doesn't
look like it should break anything (I'm pretty sure I tested that a few
days ago, with my first local netinst arm64 build; but I'll probably
giving it another spin after uploading debian-installer with the patch,
waiting for the various buildd/ftp/release bits to happen).
Also, for some reason, with or without patching the debian-installer
build, the color “reset” after entering/exiting the dark menu just works
on arm64. In passing, I'm seeing a warning/error message when entering
the dark menu, but that might just be some limitation of the
virtualization environment (maybe some unsupported video mode change).
Conclusion
==========
This bug report is more for later reference than anything, to fully
document the reasons, worries, and reassurances about the change, so
that we can get back to it if anything breaks, without having to
rediscover that rabbit hole…
Cheers,
--
Cyril Brulebois (kibi@debian.org) <https://debamax.com/>
D-I release manager -- Release team member -- Freelance Consultant
Attachment:
netboot-1-welcome.png
Description: PNG image
Attachment:
netboot-2-advanced-submenu.png
Description: PNG image
Attachment:
netboot-3-dark-submenu.png
Description: PNG image
Attachment:
netboot-4-welcome-again.png
Description: PNG image
Attachment:
netinst-1-welcome.png
Description: PNG image
Attachment:
netinst-2-advanced-submenu.png
Description: PNG image
Attachment:
netinst-3-dark-submenu.png
Description: PNG image
Attachment:
netinst-4-welcome-again.png
Description: PNG image
Attachment:
arm64-grub.png
Description: PNG image
--- a/build/util/grub-gencfg
+++ b/build/util/grub-gencfg
@@ -119,8 +119,7 @@ sub start_submenu ($;%)
}
else
{
- print_indented("set menu_color_normal=cyan/blue\n");
- print_indented("set menu_color_highlight=white/blue\n");
+ # Don't force colors in other submenus
}
print_set_theme($theme);
print_indented("set gfxpayload=keep\n");