Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Change boot kernel headless remote Debian 11 machine [Solved]

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Change boot kernel headless remote Debian 11 machine [Solved]

#1 Post by coppolino97 »

Hi all,
I have a remote headless linux machine, nobody can use a keyboard to change during system boot kernel.
I need to change headless linux machine kernel used to boot Debian 11.

cat /etc/os-release

Code: Select all

PRETTY_NAME="Debian GNU/Linux bullseye/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
In this remote Linux PC there are these kernels installed:
dpkg --list | grep linux-image

Code: Select all

ii  linux-image-4.19.0-9-amd64        4.19.118-2+deb10u1             amd64        Linux 4.19 for 64-bit PCs (signed)
ii  linux-image-5.10.0-3-amd64        5.10.13-1                      amd64        Linux 5.10 for 64-bit PCs (signed)
ii  linux-image-5.10.0-8-amd64        5.10.46-5                      amd64        Linux 5.10 for 64-bit PCs (signed)
ii  linux-image-5.14.0-2-amd64        5.14.9-2                       amd64        Linux 5.14 for 64-bit PCs (signed)
ii  linux-image-amd64                 5.10.13-1                      amd64        Linux for 64-bit PCs (meta-package)
In this moment system is running
uname -r

Code: Select all

5.14.0-2-amd64
In my case I need to set that remote PC starts using "linux-image-5.10.0-3-amd64".

I noted that inside the system there is etc/default/grub file.

Code: Select all

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
After that I noted file /boot/grub/grub.cfg.
Here I copied a part of this long file. In this piece of code there are different settings about Grub menu.

Code: Select all

menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-87f34e93-5364-4558-b677-6c9d9605b020' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
        else
          search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
        fi
        echo    'Loading Linux 5.14.0-2-amd64 ...'
        linux   /boot/vmlinuz-5.14.0-2-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro net.ifnames=0 biosdevname=0 quiet
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-5.14.0-2-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-87f34e93-5364-4558-b677-6c9d9605b020' {
        menuentry 'Debian GNU/Linux, with Linux 5.14.0-2-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.14.0-2-amd64-advanced-87f34e93-5364-4558-b677-6c9d9605b020' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
                else
                  search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
                fi
                echo    'Loading Linux 5.14.0-2-amd64 ...'
                linux   /boot/vmlinuz-5.14.0-2-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro net.ifnames=0 biosdevname=0 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-5.14.0-2-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 5.14.0-2-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.14.0-2-amd64-recovery-87f34e93-5364-4558-b677-6c9d9605b020' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
                else
                  search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
                fi
                echo    'Loading Linux 5.14.0-2-amd64 ...'
                linux   /boot/vmlinuz-5.14.0-2-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro single net.ifnames=0 biosdevname=0
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-5.14.0-2-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 5.10.0-8-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-8-amd64-advanced-87f34e93-5364-4558-b677-6c9d9605b020' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
                else
                  search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
                fi
                echo    'Loading Linux 5.14.0-2-amd64 ...'
                linux   /boot/vmlinuz-5.14.0-2-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro single net.ifnames=0 biosdevname=0
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-5.14.0-2-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 5.10.0-8-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-8-amd64-advanced-87f34e93-5364-4558-b677-6c9d9605b020' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
                else
                  search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
                fi
                echo    'Loading Linux 5.10.0-8-amd64 ...'
                linux   /boot/vmlinuz-5.10.0-8-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro net.ifnames=0 biosdevname=0 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-5.10.0-8-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 5.10.0-8-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-8-amd64-recovery-87f34e93-5364-4558-b677-6c9d9605b020' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
                else
                  search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
                fi
                echo    'Loading Linux 5.10.0-8-amd64 ...'
                linux   /boot/vmlinuz-5.10.0-8-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro single net.ifnames=0 biosdevname=0
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-5.10.0-8-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 5.10.0-3-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-3-amd64-advanced-87f34e93-5364-4558-b677-6c9d9605b020' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
                else
                  search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
                fi
                echo    'Loading Linux 5.10.0-3-amd64 ...'
                linux   /boot/vmlinuz-5.10.0-3-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro net.ifnames=0 biosdevname=0 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-5.10.0-3-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 5.10.0-3-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.10.0-3-amd64-recovery-87f34e93-5364-4558-b677-6c9d9605b020' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
                else
                  search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
                fi
                echo    'Loading Linux 5.10.0-3-amd64 ...'
                linux   /boot/vmlinuz-5.10.0-3-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro single net.ifnames=0 biosdevname=0
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-5.10.0-3-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 4.19.0-9-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-9-amd64-advanced-87f34e93-5364-4558-b677-6c9d9605b020' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
                else
                  search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
                fi
                echo    'Loading Linux 4.19.0-9-amd64 ...'
                linux   /boot/vmlinuz-4.19.0-9-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro net.ifnames=0 biosdevname=0 quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-4.19.0-9-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 4.19.0-9-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-9-amd64-recovery-87f34e93-5364-4558-b677-6c9d9605b020' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  87f34e93-5364-4558-b677-6c9d9605b020
                else
                  search --no-floppy --fs-uuid --set=root 87f34e93-5364-4558-b677-6c9d9605b020
                fi
                echo    'Loading Linux 4.19.0-9-amd64 ...'
                linux   /boot/vmlinuz-4.19.0-9-amd64 root=UUID=87f34e93-5364-4558-b677-6c9d9605b020 ro single net.ifnames=0 biosdevname=0
                echo    'Loading initial ramdisk ...'
How can I do? How can I set to boot Debian 11 using "linux-image-5.10.0-3-amd64" kernel?
Thanks so much for your help! :D

Best regards
Last edited by coppolino97 on 2021-10-21 18:37, edited 1 time in total.
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: Change boot kernel headless remote Debian 11 machine

#2 Post by Aki »

Hello,

grub2 usually boots (as default) the more recent installed kernel (linux-image-5.14.0-2-amd64, in you case).

You have multiple choices; for example:

1) uninstall linux-image-5.10.0-8-amd64 and linux-image-5.14.0-2-amd64: linux-image-5.10.0-3-amd64 will be the default kernel (note: this is not the current default current kernel for Debian Bullseye a.k.a. Debian 11)

2) setup the GRUB_DEFAULT variable in /etc/default/grub [1] and update grub configuration

3) install kexec [2] and boot the kernel that you want from command line after booting from whatever kernel the computer starts.

Your choice probably depends on what you can do it something goes wrong.


[1] https://www.gnu.org/software/grub/manua ... figuration
[2] https://manpages.debian.org/bullseye/ke ... .8.en.html
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Change boot kernel headless remote Debian 11 machine

#3 Post by coppolino97 »

Hello @Aki
1) uninstall linux-image-5.10.0-8-amd64 and linux-image-5.14.0-2-amd64: linux-image-5.10.0-3-amd64 will be the default kernel (note: this is not the current default current kernel for Debian Bullseye a.k.a. Debian 11)
Ok about uninstall inux-image-5.10.0-8-amd64.
Can I remove linux-image-5.14.0-2-amd64 despite the system is running linux-image-5.14.0-2-amd64 kernel?
2) setup the GRUB_DEFAULT variable in /etc/default/grub [1] and update grub configuration
I looked documentation about "GRUB_DEFAULT" variable in /etc/default/grub.
I have understood that I can set

Code: Select all

GRUB_DEFAULT=Debian GNU/Linux, with Linux 5.10.0-3-amd64
Is it right?
3) install kexec [2] and boot the kernel that you want from command line after booting from whatever kernel the computer starts.
I did not know this option before. I will look it deeply.

Thanks for your help
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: Change boot kernel headless remote Debian 11 machine

#4 Post by Aki »

Hello,

The "rule of the thumb" is not to uninstall a running program, therefore I strongly recommend not to uninstall a running kernel.

According to /boot/grub/grub.cfg you sent, I suppose it would be better using the id entry for GRUB_DEFAULT, e.g.:

Code: Select all

GRUB_DEFAULT="gnulinux-5.10.0-8-amd64-advanced-87f34e93-5364-4558-b677-6c9d9605b020"
Hope that helps.

EDIT 2021/10/09:
In your case, due to submenu, GRUB_DEFAULT should be:

Code: Select all

GRUB_DEFAULT="gnulinux-advanced-87f34e93-5364-4558-b677-6c9d9605b020>gnulinux-5.10.0-8-amd64-advanced-87f34e93-5364-4558-b677-6c9d9605b020"
Last edited by Aki on 2021-10-09 15:19, edited 2 times in total.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

Re: Change boot kernel headless remote Debian 11 machine

#5 Post by sunrat »

I have to ask why you would want to install 5.10.0-3 when 5.10.0-8 is basically the same kernel with security patches applied?
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Change boot kernel headless remote Debian 11 machine

#6 Post by coppolino97 »

Hi @sunrat
I need to install a backup agent on this remote headless Debian 11 machine.
This software need to install Linux Kernel Headers.

I noted that is installed on this machine Linux Kernel Header for 5.14.0-2-amd64, but compiling software fails.

I would try to roll back to linux-image-5.10.0-8-amd64, install linux headers for 5.10.0-8-amd64 that I can download, and than install, from here:
https://packages.debian.org/bullseye/li ... .0-8-amd64

Finally I would remove 5.14.0-2-amd64 kernel and headers.

Thanks for your help
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

brian_p
Posts: 196
Joined: 2015-11-05 10:32
Has thanked: 1 time
Been thanked: 5 times

Re: Change boot kernel headless remote Debian 11 machine

#7 Post by brian_p »

coppolino97 wrote: 2021-10-06 17:00 Hi all,
I have a remote headless linux machine, nobody can use a keyboard to change during system boot kernel.
I need to change headless linux machine kernel used to boot Debian 11.
  • Backup your grub.cfg tp grub.cfg-kernel-orig.
  • Copy grub.cfg-kernel-orig to grub.cfg-kernel-new.
  • Edit grub.cfg-kernel-new to use the wanted kernel.
  • Replace grub.cfg with grub.cfg-kernel-new.
  • Reboot. Fingers crossed there aren't any typos or mistakes in editing!
--
Brian.

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: Change boot kernel headless remote Debian 11 machine

#8 Post by Aki »

@coppolino97 : can you update if there’s something new about the subject on topic ?
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Change boot kernel headless remote Debian 11 machine

#9 Post by coppolino97 »

Hi @Aki,
Thanks for your help!

I followed your suggestions, I rebooted remote Linux machine without problem.

Thanks
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: Change boot kernel headless remote Debian 11 machine [Solved]

#10 Post by Aki »

Hello,
Thank you very much for the update. I'm glad I helped you to sort it out.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Post Reply