Editing grub boot menu, how to save?
Ralf Mardorf
kde.lists at yahoo.com
Sat Oct 30 17:01:45 UTC 2021
On Sat, 30 Oct 2021 17:47:22 +0200, Bo Berglund wrote:
>I had already given up when the post arrived that was seemingly so
>simple until I investigated the files and found them not to have
>anything in common with the actual menu entries.
If GRUB's automation should care about the "LSB file" and find two
identical files by different installs, it might process the identical
items, to generate something different, that still might not fit the
information you wish to get. When I used GRUB, I disabled the automation
and edited grub.cfg (or for ancient GRUB versions menu.lst myself). It's
possible to remove a lot of unneeded lines from grub.cfg and to get a
lean grub.cfg. I migrated to the syslinux bootloader, it only has got a
lean menu config. Even without an out of the box automation it's
possible to use your own automation, depending on the way kernels are
updated. Kernel updates might not change the name of a kernel or add
links with equal names against new versions of names or you need to run
your own script doing something by a hook or...
However, the administrator (you) needs to make a choice and to learn
what to do.
For example
[rocketmouse at archlinux ~]$ uname -r
4.19.212-rt92-0.300-securityink
[rocketmouse at archlinux ~]$ /bin/ls -hl /.boot/ubuntu_moonstudio/boot/vm*lowlatency /boot/*securityink.img
-rw------- 1 root root 7.0M Apr 17 2021 /.boot/ubuntu_moonstudio/boot/vmlinuz-4.4.0-210-lowlatency
lrwxrwxrwx 1 root root 28 Apr 21 2021 /.boot/ubuntu_moonstudio/boot/vmlinuz-lowlatency -> vmlinuz-4.4.0-210-lowlatency
-rw-r--r-- 1 root root 8.2M Oct 29 07:10 /boot/initramfs-linux-rt-securityink.img
My Arch Linux kernels get always the same name after an update. A name
that doesn't contain the version. My Ubuntu kernels get different
names, containing the kernel version, but there always is a link with
the same name, hence the syslinux menu entries never need to get edited.
[rocketmouse at archlinux ~]$ cat /boot/syslinux/syslinux.cfg
[snip]
LABEL Securityink
MENU LABEL Arch Linux Rt ^Securityink
LINUX ../vmlinuz-linux-rt-securityink
APPEND root=LABEL=s3.archlinux ro
INITRD ../intel-ucode.img,../initramfs-linux-rt-securityink.img
LABEL Securityink_no_mitigations
MENU LABEL Arch Linux Rt Securityink no m^itigations
LINUX ../vmlinuz-linux-rt-securityink
APPEND root=LABEL=s3.archlinux ro noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off mitigations=off
INITRD ../intel-ucode.img,../initramfs-linux-rt-securityink.img
[snip]
LABEL Moonstudio
MENU LABEL Ubuntu X ^Moon Studio lowlatency
LINUX /.boot/ubuntu_moonstudio/boot/vmlinuz-lowlatency
APPEND root=LABEL=moonstudio ro
INITRD /.boot/ubuntu_moonstudio/boot/initrd.img-lowlatency
LABEL Moonstudio_no_mitigations
MENU LABEL Ubuntu X Moon Studio lowlatency no miti^gations
LINUX /.boot/ubuntu_moonstudio/boot/vmlinuz-lowlatency
APPEND root=LABEL=moonstudio ro noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off mitigations=off audit=off
INITRD /.boot/ubuntu_moonstudio/boot/initrd.img-lowlatency
[snip]
It's not that easy to get such a lean bootloader configuration without
skills. You e.g. can not simply migrate to syslinux. Syslinux is one
alternative bootloader to GRUB, _but_ it either requires chainloading
or as I do, a special path and fstab entries to bind.
[rocketmouse at archlinux ~]$ grep bind /mnt/moonstudio/etc/fstab
/mnt/archlinux/.boot/ubuntu_moonstudio/boot /boot none bind 0 0
I suspect the easiest way to get things done to your needs, is to learn
how to configure the GRUB automation configuration files that generate
grub.cfg. For users who are more familiar with such things I would
recommend to either edit grub.cfg directly (and probably to add update
hooks) or to migrate to another bootloader.
More information about the ubuntu-users
mailing list