Page 1 of 1
How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 12:50 am
by siamhie
(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.
grub.jpg
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))
I have searched through the forum which is how I found out how to edit the names but not anything regarding grub itself.
If I missed a thread, please point me in that direction.
This is my grub.cfg file.
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="1"
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=2
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=2
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/10_linux ###
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'fluxbox, with Linux 6.6.63-x64v3-xanmod1' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.63-x64v3-xanmod1-advanced-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
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-6.6.63-x64v3-xanmod1
}
menuentry 'fluxbox, with Linux 6.6.63-x64v3-xanmod1 (systemd)' --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 'fluxbox, with Linux 6.1.0-28-amd64' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-28-amd64-advanced-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
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-6.1.0-28-amd64
}
menuentry 'fluxbox, with Linux 6.1.0-28-amd64 (systemd)' --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/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_memtest86+ ###
if [ "${grub_platform}" == "efi" ]; then
if [ "${grub_cpu}" == "x86_64" ]; then
true
menuentry "Memory Test (64-bit UEFI)" {
insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f
chainloader /boot/uefi-mt/mtest-64.efi
}
fi
fi
### END /etc/grub.d/20_memtest86+ ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'XFCE (on /dev/nvme1n1p1)' --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
initrd /boot/initrd.img-6.1.0-28-amd64
}
menuentry 'XFCE, with Linux 6.1.0-28-amd64 (on /dev/nvme1n1p1)' --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
initrd /boot/initrd.img-6.1.0-28-amd64
}
menuentry 'XFCE, with Linux 6.1.0-28-amd64 (systemd) (on /dev/nvme1n1p1)' --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
}
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###
### BEGIN /etc/grub.d/40_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.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
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
### END /etc/grub.d/41_custom ###
QSI
Code: Select all
Snapshot created on: 20241130_0604
System:
Kernel: 6.6.63-x64v3-xanmod1 arch: x86_64 bits: 64 compiler: gcc v: 14.2.0
clocksource: tsc avail: hpet,acpi_pm
parameters: BOOT_IMAGE=/boot/vmlinuz-6.6.63-x64v3-xanmod1
root=UUID=<filter> ro quiet init=/lib/systemd/systemd
Desktop: Fluxbox v: 1.3.7 with: tint2 tools: avail: light-locker vt: 7
dm: LightDM v: 1.32.0 Distro: MX-23.4_fluxbox_x64 Libretto May 19 2024
base: Debian GNU/Linux 12 (bookworm)
Machine:
Type: Desktop Mobo: Micro-Star model: B550-A PRO (MS-7C56) v: 2.0
serial: <superuser required> uuid: <superuser required> UEFI: American
Megatrends LLC. v: A.F0 date: 10/11/2023
CPU:
Info: model: AMD Ryzen 9 5950X bits: 64 type: MT MCP arch: Zen 3+ gen: 4
level: v3 note: check built: 2022 process: TSMC n6 (7nm) family: 0x19 (25)
model-id: 0x21 (33) stepping: 2 microcode: 0xA20120E
Topology: cpus: 1x cores: 16 tpc: 2 threads: 32 smt: enabled cache:
L1: 1024 KiB desc: d-16x32 KiB; i-16x32 KiB L2: 8 MiB desc: 16x512 KiB
L3: 64 MiB desc: 2x32 MiB
Speed (MHz): avg: 2478 high: 3400 min/max: 2200/5083 boost: disabled
scaling: driver: acpi-cpufreq governor: ondemand cores: 1: 2200 2: 3400
3: 2200 4: 2200 5: 2200 6: 3400 7: 2714 8: 2200 9: 3395 10: 2200 11: 2200
12: 2200 13: 3400 14: 2200 15: 3400 16: 2200 17: 2200 18: 2200 19: 2200
20: 2200 21: 2200 22: 2200 23: 2200 24: 2200 25: 3400 26: 2200 27: 3400
28: 2200 29: 2200 30: 2200 31: 2200 32: 2200 bogomips: 217610
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Vulnerabilities: <filter>
Graphics:
Device-1: AMD Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT]
vendor: Tul / PowerColor driver: amdgpu v: kernel arch: RDNA-2 code: Navi-2x
process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 4 speed: 16 GT/s
lanes: 16 ports: active: DP-1 empty: DP-2,DP-3,HDMI-A-1 bus-ID: 2d:00.0
chip-ID: 1002:73df class-ID: 0300
Display: x11 server: X.Org v: 1.21.1.7 compositor: Compton v: 1 driver: X:
loaded: amdgpu unloaded: fbdev dri: radeonsi gpu: amdgpu display-ID: :0
screens: 1
Screen-1: 0 s-res: 2560x1440 s-dpi: 96 s-size: 677x381mm (26.65x15.00")
s-diag: 777mm (30.58")
Monitor-1: DP-1 mapped: DisplayPort-0 model: HP X27q serial: <filter>
built: 2021 res: 2560x1440 hz: 165 dpi: 109 gamma: 1.2
size: 597x336mm (23.5x13.23") diag: 685mm (27") ratio: 16:9 modes:
max: 2560x1440 min: 720x400
API: EGL v: 1.5 hw: drv: amd radeonsi platforms: device: 0 drv: radeonsi
device: 1 drv: swrast gbm: drv: kms_swrast surfaceless: drv: radeonsi x11:
drv: radeonsi inactive: wayland
API: OpenGL v: 4.6 vendor: amd mesa v: 23.1.2-1~mx23ahs glx-v: 1.4
es-v: 3.2 direct-render: yes renderer: AMD Radeon RX 6700 XT (navi22 LLVM
15.0.6 DRM 3.54 6.6.63-x64v3-xanmod1) device-ID: 1002:73df
memory: 11.72 GiB unified: no
Audio:
Device-1: AMD Navi 21/23 HDMI/DP Audio driver: snd_hda_intel v: kernel pcie:
gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 2d:00.1 chip-ID: 1002:ab28
class-ID: 0403
Device-2: AMD Starship/Matisse HD Audio vendor: Micro-Star MSI
driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16
bus-ID: 2f:00.4 chip-ID: 1022:1487 class-ID: 0403
API: ALSA v: k6.6.63-x64v3-xanmod1 status: kernel-api
tools: alsactl,alsamixer,amixer
Server-1: PipeWire v: 1.2.2 status: active with: 1: pipewire-pulse
status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
Device-1: Intel Wi-Fi 6 AX210/AX211/AX411 160MHz driver: iwlwifi v: kernel
pcie: gen: 2 speed: 5 GT/s lanes: 1 bus-ID: 05:00.0 chip-ID: 8086:2725
class-ID: 0280
IF: wlan0 state: up mac: <filter>
Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: Micro-Star MSI driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
lanes: 1 port: f000 bus-ID: 2a:00.0 chip-ID: 10ec:8168 class-ID: 0200
IF: eth0 state: down mac: <filter>
Info: services: NetworkManager,wpa_supplicant
Bluetooth:
Device-1: Intel AX210 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-2.3:7 chip-ID: 8087:0032
class-ID: e001
Report: rfkill ID: hci0 rfk-id: 2 state: down bt-service: N/A rfk-block:
hardware: no software: no address: see --recommends
Drives:
Local Storage: total: 8.64 TiB used: 1.07 TiB (12.4%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:2 vendor: Western Digital
model: WDS500G1X0E-00AFY0 size: 465.76 GiB block-size: physical: 512 B
logical: 512 B speed: 63.2 Gb/s lanes: 4 tech: SSD serial: <filter>
fw-rev: 613000WD temp: 33.9 C scheme: GPT
ID-2: /dev/nvme1n1 maj-min: 259:0 vendor: Western Digital
model: WDS500G3XHC-00SJG0 size: 465.76 GiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
fw-rev: 102000WD temp: 30.9 C scheme: GPT
ID-3: /dev/sda maj-min: 8:0 vendor: Seagate model: ST8000DM004-2CX188
size: 7.28 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
tech: HDD rpm: 5425 serial: <filter> fw-rev: 0001 scheme: GPT
ID-4: /dev/sdb maj-min: 8:16 vendor: Samsung model: SSD 870 EVO 500GB
size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
tech: SSD serial: <filter> fw-rev: 1B6Q scheme: GPT
Partition:
ID-1: / raw-size: 465 GiB size: 456.63 GiB (98.20%) used: 10.88 GiB (2.4%)
fs: ext4 dev: /dev/nvme0n1p2 maj-min: 259:4
ID-2: /boot/efi raw-size: 779 MiB size: 777.5 MiB (99.80%)
used: 288 KiB (0.0%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:3
Swap:
Kernel: swappiness: 15 (default 60) cache-pressure: 50 (default 100)
zswap: no
ID-1: swap-1 type: partition size: 64 GiB used: 0 KiB (0.0%) priority: -2
dev: /dev/sdb2 maj-min: 8:18
Sensors:
System Temperatures: cpu: 28.6 C mobo: N/A gpu: amdgpu temp: 36.0 C
mem: 36.0 C
Fan Speeds (rpm): N/A gpu: amdgpu fan: 0
Repos:
Packages: pm: dpkg pkgs: 2252 libs: 1169 tools: apt, apt-get, aptitude,
nala, synaptic pm: rpm pkgs: 0
No active apt repos in: /etc/apt/sources.list
Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
1: deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
Active apt repos in: /etc/apt/sources.list.d/debian.list
1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
Active apt repos in: /etc/apt/sources.list.d/mx.list
1: deb http://la.mxrepo.com/mx/repo/ bookworm main non-free
Active apt repos in: /etc/apt/sources.list.d/nordvpn.list
1: deb https://repo.nordvpn.com/deb/nordvpn/debian stable main
Active apt repos in: /etc/apt/sources.list.d/xanmod-release.list
1: deb [signed-by=/usr/share/keyrings/xanmod-archive-keyring.gpg] http://deb.xanmod.org releases main
Active apt repos in: /etc/apt/sources.list.d/extrepo_librewolf.sources
1: deb [arch=amd64 arm64] https://repo.librewolf.net librewolf main
Info:
Memory: total: 32 GiB available: 31.27 GiB used: 2.18 GiB (7.0%)
Processes: 495 Power: uptime: 3h 55m states: freeze,mem,disk suspend: deep
avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
suspend, test_resume image: 12.47 GiB services: upowerd Init: systemd
v: 252 target: graphical (5) default: graphical tool: systemctl
Compilers: gcc: 12.2.0 Shell: quick-system-in default: Bash v: 5.2.15
running-in: quick-system-in inxi: 3.3.35
Boot Mode: UEFI
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 3:12 am
by BitterTruth
The grub.cfg file is generated from a combination of other files found in:
1) /boot/ (kernels and initrd are stored here - feel free to have a look. It might surprise you what old kernels you still have lying around)
2) /etc/grub.d/ (snippets/small files)
this is where the config file is getting stuff like this from:
### BEGIN
/etc/grub.d/05_debian_theme ### <-------------------- actually a file
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###
3) /etc/default/grub (standard grub file that you are supposed to do minor edits - MUST BE FOLLOWED by the 'sudo update-grub' command for the changes to take effect)
It is generally not recommended to edit the grub.cfg file because it is auto-generated after a kernel update or if you do update-grub. Either of those events will undo any changes.
As things stand you have 3 choices:
1) TEMPORARY - edit the grub.cfg (safer in my opinion)
2) ADVANCED PERMANENT - check what kernels you have installed, remove any that you don't need, then edit the 2 snippet files (SEE BELOW) followed by sudo update-grub. IF YOU EDIT THE GRUB.CFG ONLY, DO NOT DO UPDATE-GRUB.
3) use a graphical tool - I used to use grub-customizer but I am not sure if it is in the newer repos. Even back then, it was no longer maintained or had issues.
* MX Boot Options doesn't seem to have options to delete/rename/move entries around
EDITING THE GRUB.CFG OR THE SNIPPET FILES
WARNING - EDITING THE FILE INCORRECTLY WILL MAKE YOUR PC UNBOOTALE. IT GOES WITHOUT SAYING THAT YOU SHOULD MAKE A BACKUP OF THIS, AND ANY OTHER FILES THAT YOU EDIT, FIRST
The sections most interesting for you would be starting here:
Code: Select all
### BEGIN /etc/grub.d/10_linux ### <--------------------- actual file where the menu entries are
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'fluxbox, with Linux 6.6.63-x64v3-xanmod1' --class fluxbox --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.6.63-x64v3-xanmod1-advanced-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
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-6.6.63-x64v3-xanmod1
}
AND HERE:
Code: Select all
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'XFCE (on /dev/nvme1n1p1)' --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
initrd /boot/initrd.img-6.1.0-28-amd64
}
menuentry 'XFCE, with Linux 6.1.0-28-amd64 (on /dev/nvme1n1p1)' --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
initrd /boot/initrd.img-6.1.0-28-amd64
}
menuentry 'XFCE, with Linux 6.1.0-28-amd64 (systemd) (on /dev/nvme1n1p1)' --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
}
### END /etc/grub.d/30_os-prober ###
Notice the layout pattern/format:
menuentry 'name-you-would-like-to-be-displayed'
{
search --no-floppy --fs-uuid --set=root 20cfcd8f-3e81-49d4-a5f4-35784be52c3f <-------------- partition id
echo 'Loading Linux 6.6.63-x64v3-xanmod1 ...' <-------------- message you want to display once the entry is chosen
linux /boot/vmlinuz-6.6.63-x64v3-xanmod1 root=UUID=20cfcd8f-3e81-49d4-a5f4-35784be52c3f ro quiet
(the kernel - look for menu entries that say systemd)
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-6.6.63-x64v3-xanmod1 <---------------- the ramdisk file to load
} <---------- these brackets are important
Look through each of the entries and cut and paste, move them around as you wish. Just be careful that you copy full sections.
If you want, you can have the grub.cfg file open and an empty file and just paste the sections that you want into it. Once you are happy with it, post it here and one of the devs can check it for you. Alternatively, somebody might suggest a GUI tool for you.
EDIT: A helpful guide:
https://linuxnorth.wordpress.com/2011/0 ... revisited/
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 4:08 am
by asqwerth
I believe the key script in /etc/grub.d/ directory is the file named 10_linux
If you don't mind the whole normal grub menu appearing below, I can suggest a way to place your 3 favourite grub menu entries at the top, by creating a /boot/grub/custom.cfg file, and then renaming /etc/grub.d/41_custom as /etc/grub.d/09_custom.
The 41_custom script is the one that reads what's in custom.cfg and lists them on the grub menu page. By numbering it 09, ie, earlier than the 10_linux script that creates the menu entries in grub.cfg, your custom entries will be displayed first.
I have been using this for a long time on my multiboot machine. Nice and permanent, yet easy to edit anytime you want to change what's in custom.cfg.
No update-grub needed!
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 7:33 am
by BitterTruth
I can confirm that grub-customizer is in Debian 12 repos.
I know you said you don't want to go back to grub-customizer but what you could also do is:
1) install grub-customizer,
2) make the changes you want
3) have a look at the new grub.cfg that grub-customizer has generated (copy or save it)
4) uninstall grub-customizer
5) Have a look at the grub.cfg again. If it is back to the original, rename it AND replace it with the grub-customizer copy.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 8:46 am
by asqwerth
I believe grub-customiser creates their own version of the boot menu elsewhere, they don't ever write over the original grub.cfg.
The problem with GC is that sometimes it creates double and triple copies of their boot menu, especially when somehow you see more than one copy of os_prober get copied into their boot menu. The copies may multiply over time.
That was my experience using it but that was more than 10 years ago, though I don't think it's been updated much.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 9:05 am
by fehlix
siamhie wrote: ↑Tue Dec 03, 2024 12:50 am
(I don't want to go back to Grub Customizer)
Good. Grub Customizer has shown to create issues, at least in MX Linux. So my personal recommendation don't use.
siamhie wrote: ↑Tue Dec 03, 2024 12:50 am
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.
Do not edit /boot/grub/grub.cfg, b/c it get's overwritten next update-grub run:
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
#
To adjust resp menu title entries, you may adjust two lines, the first and the last within /etc/lsb-release:
Code: Select all
PRETTY_NAME="MX 23.4 Libretto"
DISTRIB_DESCRIPTION="MX 23.4 Libretto"
E.g. on Fluxbox install change to
Code: Select all
PRETTY_NAME="MX Fluxbox"
DISTRIB_DESCRIPTION="MX Fluxbox"
update-grub will scan for all installed kernels, so you can only reduce the number of kernels by removing old kernels.
And by default will also scan for both sysvinit an systemd entries.
But this can be tweaked easily to only show systemd entries. Later more if you are interested.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 9:52 am
by siamhie
I thought it would be easier to respond to all three of you at once currently.
BitterTruth wrote: ↑Tue Dec 03, 2024 3:12 am
1) TEMPORARY - edit the grub.cfg (safer in my opinion)
2) ADVANCED PERMANENT - check what kernels you have installed, remove any that you don't need, then edit the 2 snippet files (SEE BELOW) followed by sudo update-grub. IF YOU EDIT THE GRUB.CFG ONLY, DO NOT DO UPDATE-GRUB.
3) use a graphical tool - I used to use grub-customizer but I am not sure if it is in the newer repos. Even back then, it was no longer maintained or had issues.
Since it says this at the top of the grub.cfg file "# DO NOT EDIT THIS FILE", I will not be editing this file.
I tried grub-customizer during my MX-21 days and think I had issues which is why I don't want to revisit that program.
asqwerth wrote: ↑Tue Dec 03, 2024 4:08 am
If you don't mind the whole normal grub menu appearing below, I can suggest a way to place your 3 favourite grub menu entries at the top, by creating a /boot/grub/custom.cfg file, and then renaming /etc/grub.d/41_custom as /etc/grub.d/09_custom.
I would like to have just three entries on my grub screen all booting systemd.
Fluxbox-6.6
XFCE-6.1
Fluxbox-6.1
I would like to know more on this custom.cfg file you mention. Would I edit my grub.cfg file to my liking and save it as custom.cfg in the boot directory?
Then save the 41_custom file as 09_custom in the /etc/grub.d/ directory?
fehlix wrote: ↑Tue Dec 03, 2024 9:05 am
To adjust resp menu title entries, you may adjust two lines, the first and the last within /etc/lsb-release:
I've taken care of that part already.
update-grub will scan for all installed kernels, so you can only reduce the number of kernels by removing old kernels.
I only have two kernels installed in fluxbox.
Code: Select all
ls -l /boot/ | grep vmlinuz
-rw-r--r-- 1 root root 8177600 Nov 22 14:27 vmlinuz-6.1.0-28-amd64
-rw-r--r-- 1 root root 11231744 Nov 22 10:17 vmlinuz-6.6.63-x64v3-xanmod1
My daily driver Xanmod and my backup Debian.
Later more if you are interested.
I am very interested.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 10:46 am
by asqwerth
@siamhie you said:
I would like to know more on this custom.cfg file you mention. Would I edit my grub.cfg file to my liking and save it as custom.cfg in the boot directory?
Then save the 41_custom file as 09_custom in the /etc/grub.d/ directory?
My suggested way will NOT give you ONLY 3 entries on the on-screen boot menu, since the grub.cfg entries will come after whatever is in custom.cfg. However, you will have your favourite custom entries right at the top.
Plus:
1] it's safe and quick to do and subsequently edit. No messing with or editing the actual scripts in /etc/grub.d/ beyond renumbering 41_custom.
2] no need to touch or edit grub.cfg at all
3] No need to update-grub whenever you edit the custom.cfg file.
All you have to do is to create a file called
/boot/grub/custom.cfg, and copy and paste whatever grub entries you choose from the grub.cfg file into custom.cfg.
The reason for renumbering 41_custom to 09_custom, is so that your system reads 09_custom before 10_linux, and places your custom entries before the boot entries in grub.cfg. Otherwise your custom entries will be placed after your grub entries.
Below, I set out the custom.cfg file with the 3 entries you want. However note that the first 5 lines may not actually be necessary. When I first started, I wasn't sure, so I simply copied these starting lines from the beginning of the /etc/grub.d/40_custom script, which is a totally different method of adding custom entries which does require updating grub every time. This is not necessary for custom.cfg, which will be read by the 41_custom script.
You may wish to open 41_custom script to see what it does.
Also, when you install new kernels, you will need to read the newly generated grub.cfg and copy and paste the correct entries into custom.cfg.
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.
#
# ----------------------------------
# Fluxbox 6.6 xanmod -systemd
# ----------------------------------
menuentry 'fluxbox, with Linux 6.6.63-x64v3-xanmod1 (systemd)' --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
}
# ----------------------------------
# XFCE 6.1 -systemd
# ----------------------------------
menuentry 'XFCE, with Linux 6.1.0-28-amd64 (systemd) (on /dev/nvme1n1p1)' --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
}
# ----------------------------------
# Fluxbox 6.1 -systemd
# ----------------------------------
menuentry 'fluxbox, with Linux 6.1.0-28-amd64 (systemd)' --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
}
For me, as I have about 13 or 14 different Linux distros installed on my PC, I can't be booting into my main distro to update grub whenever there is a kernel upgrade in a distro, so I label all my distro partitions, and made custom entries to read the
custom.cfg grub.cfg file of whichever distro I chose. What this does is when I select a custom entry, it calls up a second menu, namely the grub.cfg of the selected distro, and I then boot into the necessary boot entry in the distro I selected.
Below, I set out the first 2 entries in my custom.cfg. I just threw in a whole lot of insmod lines for each of my menu entries, some will be more applicable than others for each distro.
For instance, /dev/sda has legacy msdos partition table, while /dev/sdb is gpt partition table:
Code: Select all
# ----------------------------------
# Manjaro XFCE Configfile at sdb2
# ----------------------------------
menuentry "2015 Manjaro XFCE Configfile sdb2" --class manjaro --class gnu-linux --class gnu --class os {
insmod part_gpt
insmod part_msdos
insmod ext2
insmod chain
insmod multiboot
insmod configfile
search --set=root --label ManjXFCE
configfile /boot/grub/grub.cfg
}
# ----------------------------------
# MX23 XFCE RC3 at sda1
# ----------------------------------
menuentry "MX23 XFCE RC3 Configfile sda1" --class mx --class gnu-linux --class gnu --class os {
insmod part_gpt
insmod part_msdos
insmod ext2
insmod chain
insmod multiboot
insmod configfile
search --set=root --label MX23-RC3
configfile /boot/grub/grub.cfg
}
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 10:50 am
by siamhie
Ok, this is what I have so far. This is what my custom.cfg file looks like.
Code: Select all
### 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="1"
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=2
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=2
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/10_linux ###
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
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 '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/10_linux ###
### BEGIN /etc/grub.d/30_os-prober ###
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
}
### END /etc/grub.d/30_os-prober ###
I haven't touched anything in /etc/grub.d/ yet because I want to know if I'm on the right track.
*Btw, I do have a current snapshot in case anything goes wrong during this learning experience.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 10:53 am
by asqwerth
I just posted the custom.cfg contents just above your post. You don't need all the bits you included.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 10:57 am
by siamhie
asqwerth wrote: ↑Tue Dec 03, 2024 10:46 am
@siamhie you said:
I would like to know more on this custom.cfg file you mention. Would I edit my grub.cfg file to my liking and save it as custom.cfg in the boot directory?
Then save the 41_custom file as 09_custom in the /etc/grub.d/ directory?
My suggested way will NOT give you ONLY 3 entries on the on-screen boot menu, since the grub.cfg entries will come after whatever is in custom.cfg. However, you will have your favourite custom entries right at the top.
Seems you responded just as I was typing a new comment. I did look at the contents of 41_custom and had a question.
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
Does this also get added to my custom.cfg file at the end?
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 11:01 am
by asqwerth
No. The custom.cfg is a pretty clean file with just the boot entries you want. Don't change 41_custom and just let it do its thing.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 2:31 pm
by siamhie
asqwerth wrote: ↑Tue Dec 03, 2024 11:01 am
No. The custom.cfg is a pretty clean file with just the boot entries you want. Don't change 41_custom and just let it do its thing.
Ok, so just run my usual sudo update-grub from terminal then? (I will monitor the output of what displays on the screen)
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 3:27 pm
by asqwerth
No update grub needed. Just edit the custom.cfg and reboot. That's it.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 4:25 pm
by fehlix
siamhie wrote: ↑Tue Dec 03, 2024 10:57 am
Does this also get added to my custom.cfg file at the end?
Perhaps post the custom.cfg you have created under /boot/grub/custom.cfg as text code-block.
This is to avoid any potential typos within that file, may stop to show the added entries,
and you might wonder what's going on.
E.g this way:
Open terminal as normal user and run:
Code: Select all
xclip -selection clipboard -i /boot/grub/custom.cfg
This would send the content of custom.cfg into the "clipboard".
Now within the editor of a reply post, click on [</>] code-block icon,
to get the code-block tags inserted - thos guys: [
code][/code]
The cursor is now located between the code block tags.
Press
Ctrl+v to paste the custom.cfg from the clipboard.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 4:32 pm
by siamhie
fehlix wrote: ↑Tue Dec 03, 2024 4:25 pm
siamhie wrote: ↑Tue Dec 03, 2024 10:57 am
Does this also get added to my custom.cfg file at the end?
Perhaps post the custom.cfg you have created under /boot/grub/custom.cfg as text code-block.
This is to avoid any potential typos within that file, may stop to show the added entries,
and you might wonder what's going on.
E.g this way:
Open terminal as normal user and run:
Code: Select all
xclip -selection clipboard -i /boot/grub/custom.cfg
This would send the content of custom.cfg into the "clipboard".
Now within the editor of a reply post, click on [</>] code-block icon,
to get the code-block tags inserted - thos guys: [
code][/code]
The cursor is now located between the code block tags.
Press
Ctrl+v to paste the custom.cfg from the clipboard.
Here is the results of
Code: Select all
xclip -selection clipboard -i /boot/grub/custom.cfg
Code: Select all
### 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="1"
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=2
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=2
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/10_linux ###
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
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 '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/10_linux ###
### BEGIN /etc/grub.d/30_os-prober ###
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
}
### END /etc/grub.d/30_os-prober ###
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 4:35 pm
by siamhie
asqwerth wrote: ↑Tue Dec 03, 2024 3:27 pm
No update grub needed. Just edit the custom.cfg and reboot. That's it.
Just saw this post. I had updated grub and I'm close but no quite there.
Seems my custom.cfg entries were added to the end of my grub menu.
close.jpg
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 5:07 pm
by fehlix
siamhie wrote: ↑Tue Dec 03, 2024 4:32 pm
Here is the results of
Code: Select all
xclip -selection clipboard -i /boot/grub/custom.cfg
Code: Select all
### 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="1"
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=2
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=2
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/10_linux ###
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
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 '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/10_linux ###
### BEGIN /etc/grub.d/30_os-prober ###
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
}
### END /etc/grub.d/30_os-prober ###
Hmme ... , I guessed it...
Please do not have anything else but only the menu entries within custom.cfg
Here the same reduced to menu entries only:
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
}
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
}
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
}
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 8:57 pm
by siamhie
fehlix wrote: ↑Tue Dec 03, 2024 5:07 pm
siamhie wrote: ↑Tue Dec 03, 2024 4:32 pm
Here is the results of
Code: Select all
xclip -selection clipboard -i /boot/grub/custom.cfg
Code: Select all
### 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="1"
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=2
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=2
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/10_linux ###
function gfxmode {
set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
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 '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/10_linux ###
### BEGIN /etc/grub.d/30_os-prober ###
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
}
### END /etc/grub.d/30_os-prober ###
Hmme ... , I guessed it...
Please do not have anything else but only the menu entries within custom.cfg
Here the same reduced to menu entries only:
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
}
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
}
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
}
Ah OK. That's how my custom.cfg started when I wrote it and I added the other sections from the grub.cfg file thinking I needed them.
Grub still confuses me compared to the LILO days.
I'll edit the custom.cfg file back to what I originally had it. Do I still run update-grub afterwards?
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 11:17 pm
by asqwerth
No. No update grub needed. EVER. The custom.cfg file is just a list of grub entries. No scripting bits.
I mean, I gave you the whole contents of the custom.cfg for you to copy and paste quite a few posts ago.
Re: How do you edit the grub menu by hand?
Posted: Tue Dec 03, 2024 11:24 pm
by asqwerth
If your custom.cfg entries are at the end of normal grub entries, did you remember to renumber 41_custom?
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 9:24 am
by siamhie
asqwerth wrote: ↑Tue Dec 03, 2024 11:17 pm
No. No update grub needed. EVER. The custom.cfg file is just a list of grub entries. No scripting bits.
I mean, I gave you the whole contents of the custom.cfg for you to copy and paste quite a few posts ago.
I had gotten that but cleaned up the menuentries.
Code: Select all
menuentry 'fluxbox, with Linux 6.6.63-x64v3-xanmod1 (systemd)'
to
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 9:44 am
by siamhie
asqwerth wrote: ↑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?
@asqwerth I had actually created a /boot/grub/custom.cfg file with those three entries and let 41_custom do it's thing.
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
I still end up with the new entries at the bottom of the grub screen.
new-grub-menu.jpg
I have now copied the contents of /boot/grub/custom.cfg to /etc/grub.d/40_custom and deleted the /boot/grub/custom.cfg file.
One thing I did notice is that MX Boot Options never picked up on the /boot/grub/custom.cfg file but since I transferred those entries to 40_custom, MXBO picks them up.
mxbo.jpg
I will now try your earlier suggestion to rename 40_custom to 09_custom and it should put my entries at the beginning.
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 9:54 am
by asqwerth
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
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 10:09 am
by siamhie
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
I only update grub when Xanmod releases a new 6.6 LTS kernel they have grabbed from the archives.
Debian's 6.1 LTS kernel doesn't get updated often which is my backup kernel for fluxbox and main kernel for XFCE.
So the only entry I would have to edit the most is this one.
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
}
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 11:35 am
by siamhie
I suppose this will be as close to a custom grub menu with only three entries showing as I will get.
At least they are at the top now.
close-to-three.jpg
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 2:13 pm
by fehlix
To be honest, not only did the title of the topic lead to confusing
assumptions right from the start, but now the adjustments you have made
are causing even more confusion (at least for me).
May I suggest the following: Just rephrase what you are trying to
accomplish, and post all the relevant changes you have made so far, I
mean the files you have customized. Otherwise, I don't think I can give
any more tips without fear of adding to the confusion.
Re: How do you edit the grub menu by hand? [Solved]
Posted: Wed Dec 04, 2024 4:30 pm
by siamhie
fehlix wrote: ↑Wed Dec 04, 2024 2:13 pm
To be honest, not only did the title of the topic lead to confusing
assumptions right from the start, but now the adjustments you have made
are causing even more confusion (at least for me).
I apologize for the confusion the thread has turned into. The title of the thread was editing grub by hand and this is what I started my post with.
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))
So to sum up what I have done is this.
1. copied the contents of /boot/grub/custom.cfg to /etc/grub.d/40_custom and saved the 40_custom file as 09_custom
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
}
2. deleted /boot/grub/custom.cfg
3. updated grub and my three custom entries were now at the top of every thing else
The next steps I did might not be right or correct but it worked (for my scenario)
4. removed the executable permissions from 10_linux, 20_linux_xen, 20_memtest86+,
30_os-prober, 30_uefi-firmware, 40_custom and 41_custom
5. updated grub
Now I have just the three entries I wanted showing and I can choose which one to be default in MX Boot Options.
My newly generated grub.cfg file
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 ###
MX Boot Options
simple.png
Grub Screen
simpler.jpg
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 4:45 pm
by fehlix
OK, thanks.
The picture got now a bit clearer.
So what you want, is disable generation of grub menu entries, and have your own. OK fine.
And you would need manually adjust the grub menu after every kernel upgrade, or removal
Probably one way to go, but that not what I would recommend in general to do.
Anyway, good luck.
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 5:16 pm
by fehlix
siamhie wrote: ↑Wed Dec 04, 2024 4:30 pm
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
}
To avoid a potential issue, with booting into latest installed kernel,
e.g. just after kernel upgrade, and you missed manually adjusting the grub menu:
You may try this menuentry, potentially to be put on top,
e.g. as an example for fluxbox:
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
}
The difference is , latest kernel installation creates alway two symlinks /vmlinuz and /initrd.img:
E.g in the example above as:
Code: Select all
/vmlinux -> boot/vmlinuz-6.6.63-x64v3-xanmod1
/initrd.img -> boot/initrd.img-6.6.63-x64v3-xanmod1
As those symlinks are relative symlinks, you can use it as booting into latest installed.
Similar would be, /vmlinuz.old and /initrd.img.old pointing to the one which was previous the latest.
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 5:17 pm
by siamhie
fehlix wrote: ↑Wed Dec 04, 2024 4:45 pm
OK, thanks.
The picture got now a bit clearer.
So what you want, is disable generation of grub menu entries, and have your own. OK fine.
And you would need manually adjust the grub menu after every kernel upgrade, or removal
Probably one way to go, but that not what I would recommend in general to do.
Anyway, good luck.
My days of chasing/experimenting with the latest kernels are done. I'm sticking with the LTS kernels (Xanmod-6.6 and Debian-6.1).
If either of those kernels have an update, I can always re-enable the executable flag for 10_linux and 30_os-prober and copy the
entry found in the grub.cfg file and apply it to the 09_custom file.
I'll go ahead and mark what I did in post #28 as solved.
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 5:29 pm
by siamhie
fehlix wrote: ↑Wed Dec 04, 2024 5:16 pm
To avoid a potential issue, with booting into latest installed kernel,
e.g. just after kernel upgrade, and you missed manually adjusting the grub menu:
You may try this menuentry, potentially to be put on top,
e.g. as an example for fluxbox:
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
}
The difference is , latest kernel installation creates alway two symlinks /vmlinuz and /initrd.img:
E.g in the example above as:
Code: Select all
/vmlinux -> boot/vmlinuz-6.6.63-x64v3-xanmod1
/initrd.img -> boot/initrd.img-6.6.63-x64v3-xanmod1
As those symlinks are relative symlinks, you can use it as booting into latest installed.
Similar would be, /vmlinuz.old and /initrd.img.old pointing to the one which was previous the latest.
Seems you have responded before I could publish post #31.
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 5:51 pm
by fehlix
siamhie wrote: ↑Wed Dec 04, 2024 5:29 pm
Seems you have responded before I could publish post #31.
So at least you now have a fallback in case you missed to adjust the grub menu manually.
Re: How do you edit the grub menu by hand?
Posted: Wed Dec 04, 2024 9:05 pm
by siamhie
fehlix wrote: ↑Wed Dec 04, 2024 5:51 pm
siamhie wrote: ↑Wed Dec 04, 2024 5:29 pm
Seems you have responded before I could publish post #31.
So at least you now have a fallback in case you missed to adjust the grub menu manually.
Yes. Always have a backup and then have a backup for that backup.

Re: How do you edit the grub menu by hand?
Posted: Thu Dec 05, 2024 10:26 am
by siamhie
@fehlix Wanted to give you an update on adding kernels with my setup. What a breeze.
I re-enabled the executable flag for the /etc/grub.d/10_linux file.
Installed the Liquorix kernel from the repos. Let the installation update grub.
Copy the (systemd) Liquorix entry from grub.cfg to my /etc/grub.d/09_custom file.
Disable the executable flag for the /etc/grub.d/10_linux file.
Ran sudo update-grub.
mxbo.png
Re: How do you edit the grub menu by hand?
Posted: Thu Dec 05, 2024 10:31 am
by asqwerth
Nice work!
Re: How do you edit the grub menu by hand?
Posted: Thu Dec 05, 2024 10:35 am
by siamhie
asqwerth wrote: ↑Thu Dec 05, 2024 10:31 amNice work!
Thanks
@asqwerth
Between you and
@fehlix bouncing ideas around, I think I have a handle now on customizing grub.
I still miss the simple days of LILO.
