Cannot change boot options to run with alternate kernel

I am unable to get my DietPi machine to alter its boot parameters, to run an alternate kernel I have compiled. (full disclosure: I have noobie-level experience with Linux)

I have searched the existing open and closed issues

Required Information

  • DietPi version | G_DIETPI_VERSION_CORE=9 G_DIETPI_VERSION_SUB=5 G_DIETPI_VERSION_RC=1 G_GITBRANCH='master' G_GITOWNER='MichaIng' G_LIVE_PATCH_STATUS[0]='not applicable'
  • Distro version | bookworm
  • Kernel version | Linux DietPi 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux
  • Architecture | amd64
  • SBC model | Native PC (x86_64)
  • Power supply used | HDPlex 400W DC-ATX Converter
  • SD card used | Kingston 128GB SSDNow 100 SSD (as OS drive)

Additional Information:

This is a single-use computer, whose sole purpose is to host MPD and provide music playback to my HiFi system. The setup is built on a very specific recipe of hardware & software, including the compiling of a specific kernel with a set of prescribed options. It has been working flawlessly for about a year.

HISTORY:
The modified kernel is linux-5.19.17 (from kernel.org, obviously). At the time (approx a year ago) uname -r returned a value of 5.10 -amd64 (thereabouts) on the fresh instance of DietPi.

A month ago I messed up the installation by running a restore - from what turns out to be a corrupted backup - and the system would not boot. As a remedy, I swapped in a larger OS drive and loaded a fresh DietPi (v9.5.1). Prev OS drive is connected as source for old backups. Then, attempted to restore from remaining two un-corrupted backups.

The restore ran smoothly, but upon reboot the system hung, displaying this on the console screen:

I repeated the above steps, using the other full backup… with the exact same bad result. No choice but to rebuild from scratch (ie: following recipe as before).

CURRENT ISSUE:
I am unable to get DietPi to boot using my custom-compiled linux-5.19.17-100HZv2 kernel. None of the info I’ve found searching seems to apply to my situation, on a Native PC (x86_64) platform. The components appear in /boot:

root@DietPi:~# ls -l /boot
total 312109
-rw-r--r-- 1 root root   4009296 Jun 27 07:34 System.map-5.19.17-100HZv2
-rw-r--r-- 1 root root        83 May  3 13:36 System.map-6.1.0-21-amd64
-rw-r--r-- 1 root root    235231 Jun 27 07:34 config-5.19.17-100HZv2
-rw-r--r-- 1 root root    259504 May  3 13:36 config-6.1.0-21-amd64
drwxr-xr-x 4 root root      4096 Jun 27 04:22 dietpi
-rw-r--r-- 1 root root     18092 Jun  9 19:54 dietpi-LICENSE.txt
-rw-r--r-- 1 root root     16109 Jun  9 19:54 dietpi-README.md
-rw------- 1 root root      3950 Jun 10 16:00 dietpi-wifi.txt
-rw-r--r-- 1 root root     17869 Jun 27 04:49 dietpi.txt
drwxr-xr-x 3 root root       512 Jan  1  1970 efi
drwxr-xr-x 5 root root      4096 Jun 27 07:37 grub
-rw-r--r-- 1 root root 268006189 Jun 27 07:34 initrd.img-5.19.17-100HZv2
-rw-r--r-- 1 root root  31854751 Jun 27 04:22 initrd.img-6.1.0-21-amd64
-rw-r--r-- 1 root root   6963872 Jun 27 07:34 vmlinuz-5.19.17-100HZv2
-rw-r--r-- 1 root root   8169408 May  3 13:36 vmlinuz-6.1.0-21-amd64
root@DietPi:~#

and are referenced in /boot/grub/grub.cfg

#
# 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
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  83728969-54d5-4eb3-8d9c-064d4bcabe0d
else
  search --no-floppy --fs-uuid --set=root 83728969-54d5-4eb3-8d9c-064d4bcabe0d
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=C
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=0
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=0
  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 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-83728969-54d5-4eb3-8d9c-064d4bcabe0d' {
	load_video
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt2'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  83728969-54d5-4eb3-8d9c-064d4bcabe0d
	else
	  search --no-floppy --fs-uuid --set=root 83728969-54d5-4eb3-8d9c-064d4bcabe0d
	fi
	echo	'Loading Linux 6.1.0-21-amd64 ...'
	linux	/boot/vmlinuz-6.1.0-21-amd64 root=UUID=83728969-54d5-4eb3-8d9c-064d4bcabe0d ro net.ifnames=0 consoleblank=0
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-6.1.0-21-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-83728969-54d5-4eb3-8d9c-064d4bcabe0d' {
	menuentry 'Debian GNU/Linux, with Linux 6.1.0-21-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-21-amd64-advanced-83728969-54d5-4eb3-8d9c-064d4bcabe0d' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  83728969-54d5-4eb3-8d9c-064d4bcabe0d
		else
		  search --no-floppy --fs-uuid --set=root 83728969-54d5-4eb3-8d9c-064d4bcabe0d
		fi
		echo	'Loading Linux 6.1.0-21-amd64 ...'
		linux	/boot/vmlinuz-6.1.0-21-amd64 root=UUID=83728969-54d5-4eb3-8d9c-064d4bcabe0d ro net.ifnames=0 consoleblank=0
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-6.1.0-21-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 6.1.0-21-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-6.1.0-21-amd64-recovery-83728969-54d5-4eb3-8d9c-064d4bcabe0d' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  83728969-54d5-4eb3-8d9c-064d4bcabe0d
		else
		  search --no-floppy --fs-uuid --set=root 83728969-54d5-4eb3-8d9c-064d4bcabe0d
		fi
		echo	'Loading Linux 6.1.0-21-amd64 ...'
		linux	/boot/vmlinuz-6.1.0-21-amd64 root=UUID=83728969-54d5-4eb3-8d9c-064d4bcabe0d ro single net.ifnames=0
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-6.1.0-21-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 5.19.17-100HZv2' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.19.17-100HZv2-advanced-83728969-54d5-4eb3-8d9c-064d4bcabe0d' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  83728969-54d5-4eb3-8d9c-064d4bcabe0d
		else
		  search --no-floppy --fs-uuid --set=root 83728969-54d5-4eb3-8d9c-064d4bcabe0d
		fi
		echo	'Loading Linux 5.19.17-100HZv2 ...'
		linux	/boot/vmlinuz-5.19.17-100HZv2 root=UUID=83728969-54d5-4eb3-8d9c-064d4bcabe0d ro net.ifnames=0 consoleblank=0
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-5.19.17-100HZv2
	}
	menuentry 'Debian GNU/Linux, with Linux 5.19.17-100HZv2 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.19.17-100HZv2-recovery-83728969-54d5-4eb3-8d9c-064d4bcabe0d' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  83728969-54d5-4eb3-8d9c-064d4bcabe0d
		else
		  search --no-floppy --fs-uuid --set=root 83728969-54d5-4eb3-8d9c-064d4bcabe0d
		fi
		echo	'Loading Linux 5.19.17-100HZv2 ...'
		linux	/boot/vmlinuz-5.19.17-100HZv2 root=UUID=83728969-54d5-4eb3-8d9c-064d4bcabe0d ro single net.ifnames=0
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-5.19.17-100HZv2
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### 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 ###

Curiously, when executed a year ago, these commands “just worked”…

make modules_install
make install
update-grub

and upon reboot, my desired kernel was the active one.

This year, update-grub is not giving the desired result, still getting…

root@DietPi:~# uname -r
6.1.0-21-amd64

I’m at a loss for how to get this to work as desired. Could it be as simple as the order in which the menuentry items appear in grub.cfg ? Note the 6.1.0-21 set appears before the 5.19.17 set.

Please help me get this machine Rockin-N-Rollin again :wink: !

Thank you in advance for help and guidance.

You can edit /etc/default/grub and set GRUB_TIMEOUT=0 to a higher value like 5 or 10. This way you should see the menu options.

Ah yes, the timeout parameter - thanks for that. Doing so allowed me to jump into the Advanced submenu, where the choice of two kernels was available. Choosing Linux 5.19.17-100HZv2 indeed put me into the desired kernel version. Great… One Step Forward !!

This interaction requires a screen & keyboard to be attached directly to the computer - not practical going forward. The machine should boot into the specified kernel un-attended, without intervention - like it has been doing this past year. Just like turning on a CD player :wink:.

Routine admin tasks are handled via SSH session - and in fact the video card (temporarily installed in the motherboard for “emergency” work) should be removed for improved music playback quality.

NEXT (OBVIOUS) QUESTION:
How do I set the default boot kernel to be Linux 5.19.17-100HZv2 ?

I tried setting GRUB_DEFAULT=3, but that didn’t change anything I could observe.

Once that is working and the computer will start up like an audio appliance - with no fuss - I can set
GRUB_TIMEOUT= back to zero and be happy listening to Music again.

maybe this could give a hint? GRUB - ArchWiki

@Joulinar: Yessss ! Thank you so much for pointing me at the correct documentation to reference, when working in the DietPi world. I’m now a tiny bit more dangerous (knowledgeable) with Linux ! :nerd_face: !

To get my Linux 5.19.17-100HZv2 kernel to boot as the default, I had specify it in /etc/default/grub

#GRUB_DEFAULT=0
GRUB_DEFAULT='gnulinux-advanced-83728969-54d5-4eb3-8d9c-064d4bcabe0d>gnulinux-5.19.17-100HZv2-advanced-83728969-54d5-4eb3-8d9c-064d4bcabe0d'
GRUB_TIMEOUT=0

All is well - it starts up as before. Now I can remove the local video card and proceed with the rest of the system tweaking… to get back to the Beautiful Music state I had before I created this disastrous side-adventure.

Thanks again for your patient support :clap:

UPDATE: A week later, a torturous handful of necessary compile options & tweaks… and now Beautiful Music prevails !!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.