Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 11:24 pm
If your custom.cfg entries are at the end of normal grub entries, did you remember to renumber 41_custom?
Support for MX and antiX Linux distros
http://www.forum.mxlinux.org/
Code: Select all
menuentry 'fluxbox, with Linux 6.6.63-x64v3-xanmod1 (systemd)'
Code: Select all
menuentry 'Fluxbox-6.6'
Code: Select all
#!/bin/sh
cat <<EOF
if [ -f \${config_directory}/custom.cfg ]; then
source \${config_directory}/custom.cfg
elif [ -z "\${config_directory}" -a -f \$prefix/custom.cfg ]; then
source \$prefix/custom.cfg;
fi
EOF
asqwerth wrote: ↑Wed Dec 04, 2024 9:54 am If you copy the menu items to 40_custom, then you NEED to update-grub every time you change the contents of 40_custom. It just doesn't work the same way as 41_custom + the custom.cfg file.
Script numbers 40 and 41 do things differently.
Things in custom.cfg won't be picked up by grub or MX boot options because it's not part of grub.cfg. It's just a separate list of custom entries from grub.cfg, that 41_custom script can detect and tag on to the grub menu. If you renumber 41 to 09, then the script adds it before the grub.cfg entries, otherwise the custom.cfg entries are tagged on after the grub.cfg entries.
40_custom is different. For this script, you are SUPPOSED to add the custom entries to ths 40_custom file itself, and then update-grub. That way, it is seen together with grub.cfg. I guess you can try renumbering it as 09 and see what happens.
I don't use 40_custom on my system because I don't want to update-grub all the time
Code: Select all
menuentry 'Fluxbox-6.6' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.63-x64v3-xanmod1-init-systemd-20cfcd8f-3e81-49d4-a5f4-35784be52c3f' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f
echo 'Loading Linux 6.6.63-x64v3-xanmod1 ...'
linux /boot/vmlinuz-6.6.63-x64v3-xanmod1 root=UUID=20cfcd8f-3e81-49d4-a5f4-35784be52c3f ro quiet init=/lib/systemd/systemd
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-6.6.63-x64v3-xanmod1
}
siamhie wrote: ↑Tue Dec 03, 2024 12:50 am (I don't want to go back to Grub Customizer)
I have the menu set up in flat mode currently and (through this forum) found how to edit the names of the entries to make it easier to find them.
What I would like to do is have just three entries showing in this order.
Fluxbox-6.6
(this menuentry 'fluxbox, with Linux 6.6.63-x64v3-xanmod1 (systemd))
XFCE-6.1
(this menuentry 'XFCE, with Linux 6.1.0-28-amd64 (systemd))
Fluxbox-6.1
(this fluxbox, with Linux 6.1.0-28-amd64 (systemd))
Code: Select all
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Fluxbox-6.6' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.63-x64v3-xanmod1-init-systemd-20cfcd8f-3e81-49d4-a5f4-35784be52c3f' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f
echo 'Loading Linux 6.6.63-x64v3-xanmod1 ...'
linux /boot/vmlinuz-6.6.63-x64v3-xanmod1 root=UUID=20cfcd8f-3e81-49d4-a5f4-35784be52c3f ro quiet init=/lib/systemd/systemd
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-6.6.63-x64v3-xanmod1
}
menuentry 'XFCE-6.1' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.1.0-28-amd64--471fd16c-b914-4193-8af6-42bc4fed4954' {
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 471fd16c-b914-4193-8af6-42bc4fed4954
linux /boot/vmlinuz-6.1.0-28-amd64 root=UUID=471fd16c-b914-4193-8af6-42bc4fed4954 ro quiet splash init=/lib/systemd/systemd
initrd /boot/initrd.img-6.1.0-28-amd64
}
menuentry 'Fluxbox-6.1' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-28-amd64-init-systemd-20cfcd8f-3e81-49d4-a5f4-35784be52c3f' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f
echo 'Loading Linux 6.1.0-28-amd64 ...'
linux /boot/vmlinuz-6.1.0-28-amd64 root=UUID=20cfcd8f-3e81-49d4-a5f4-35784be52c3f ro quiet init=/lib/systemd/systemd
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-6.1.0-28-amd64
}
Code: Select all
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=1024x768
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f
insmod gfxmenu
loadfont ($root)/boot/grub/themes/mx_logo_ribbon/DejaVuSans-Bold14.pf2
loadfont ($root)/boot/grub/themes/mx_logo_ribbon/DejaVuSans10.pf2
loadfont ($root)/boot/grub/themes/mx_logo_ribbon/DejaVuSans12.pf2
loadfont ($root)/boot/grub/themes/mx_logo_ribbon/ascii.pf2
insmod png
set theme=($root)/boot/grub/themes/mx_logo_ribbon/theme.txt
export theme
if [ "${recordfail}" = 1 ] ; then
set timeout=30
else
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=3
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=3
fi
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/09_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Fluxbox-6.6' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.63-x64v3-xanmod1-init-systemd-20cfcd8f-3e81-49d4-a5f4-35784be52c3f' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f
echo 'Loading Linux 6.6.63-x64v3-xanmod1 ...'
linux /boot/vmlinuz-6.6.63-x64v3-xanmod1 root=UUID=20cfcd8f-3e81-49d4-a5f4-35784be52c3f ro quiet init=/lib/systemd/systemd
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-6.6.63-x64v3-xanmod1
}
menuentry 'XFCE-6.1' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.1.0-28-amd64--471fd16c-b914-4193-8af6-42bc4fed4954' {
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 471fd16c-b914-4193-8af6-42bc4fed4954
linux /boot/vmlinuz-6.1.0-28-amd64 root=UUID=471fd16c-b914-4193-8af6-42bc4fed4954 ro quiet splash init=/lib/systemd/systemd
initrd /boot/initrd.img-6.1.0-28-amd64
}
menuentry 'Fluxbox-6.1' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-28-amd64-init-systemd-20cfcd8f-3e81-49d4-a5f4-35784be52c3f' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f
echo 'Loading Linux 6.1.0-28-amd64 ...'
linux /boot/vmlinuz-6.1.0-28-amd64 root=UUID=20cfcd8f-3e81-49d4-a5f4-35784be52c3f ro quiet init=/lib/systemd/systemd
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-6.1.0-28-amd64
}
### END /etc/grub.d/09_custom ###
To avoid a potential issue, with booting into latest installed kernel,siamhie wrote: ↑Wed Dec 04, 2024 4:30 pmCode: Select all
#!/bin/sh exec tail -n +3 $0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry 'Fluxbox-6.6' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.63-x64v3-xanmod1-init-systemd-20cfcd8f-3e81-49d4-a5f4-35784be52c3f' { load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f echo 'Loading Linux 6.6.63-x64v3-xanmod1 ...' linux /boot/vmlinuz-6.6.63-x64v3-xanmod1 root=UUID=20cfcd8f-3e81-49d4-a5f4-35784be52c3f ro quiet init=/lib/systemd/systemd echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-6.6.63-x64v3-xanmod1 } menuentry 'XFCE-6.1' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-6.1.0-28-amd64--471fd16c-b914-4193-8af6-42bc4fed4954' { insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 471fd16c-b914-4193-8af6-42bc4fed4954 linux /boot/vmlinuz-6.1.0-28-amd64 root=UUID=471fd16c-b914-4193-8af6-42bc4fed4954 ro quiet splash init=/lib/systemd/systemd initrd /boot/initrd.img-6.1.0-28-amd64 } menuentry 'Fluxbox-6.1' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-28-amd64-init-systemd-20cfcd8f-3e81-49d4-a5f4-35784be52c3f' { load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_gpt insmod ext2 search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f echo 'Loading Linux 6.1.0-28-amd64 ...' linux /boot/vmlinuz-6.1.0-28-amd64 root=UUID=20cfcd8f-3e81-49d4-a5f4-35784be52c3f ro quiet init=/lib/systemd/systemd echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-6.1.0-28-amd64 }
Code: Select all
menuentry 'Fluxbox latest kernel installed' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-latest-installed-init-systemd-20cfcd8f-3e81-49d4-a5f4-35784be52c3f' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f
echo 'Loading Linux latest installed ...'
linux /vmlinuz root=UUID=20cfcd8f-3e81-49d4-a5f4-35784be52c3f ro quiet init=/lib/systemd/systemd
echo 'Loading initial ramdisk ...'
initrd /initrd.img
}
Code: Select all
/vmlinux -> boot/vmlinuz-6.6.63-x64v3-xanmod1
/initrd.img -> boot/initrd.img-6.6.63-x64v3-xanmod1