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

 

 

 

Add new Kernel to menu.lst not working

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
Teebarmar
Posts: 23
Joined: 2021-09-27 15:29
Has thanked: 4 times

Add new Kernel to menu.lst not working

#1 Post by Teebarmar »

I'm a beginner and participate in a Linux course. The Linux in use is Debian Stretch. One thing to do is to create a further kernel and add it to the boot menu. I created the new Kernel, but fail on getting it added to the boot menu.

Linux debianKurs 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3 (2017-12-03) x86_64
Vmware workstation player 16

In addition I created a further Kernel. Thus my list under the boot directory is as follows.
root@debianKurs:/boot# ls -l
insgesamt 69312
-rw-r--r-- 1 root root 7237584 Sep 26 16:54 bzImage-4.12.0.8-amd64
-rw-r--r-- 1 root root 186443 Dez 3 2017 config-4.9.0-4-amd64
drwxr-xr-x 6 root root 4096 Sep 27 17:34 grub
-rw-r--r-- 1 root root 4741029 Sep 26 16:57 initrd.img-4.12.0.8-amd64
-rw-r--r-- 1 root root 18992587 Sep 26 11:44 initrd.img-4.9.0-4-amd64
-rw-r--r-- 1 root root 3741588 Sep 26 16:54 System.map-4.12.0.8-amd64
-rw-r--r-- 1 root root 3183573 Dez 3 2017 System.map-4.9.0-4-amd64
-rwxr-xr-x 1 root root 34833280 Sep 26 16:54 vmlinux-4.12.0.8-amd64
-rw-r--r-- 1 root root 4208416 Dez 3 2017 vmlinuz-4.9.0-4-amd64

I got told that update-grub would not recognize any bzImage automatically and to edit the 40_custom file under /etc/grub.d to add an entry.
-rwxr-xr-x 1 root root 321 Sep 27 17:26 40_custom
root@debianKurs:/etc/grub.d# cat 40_custom
#!/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 "bzImage-4.12.0.8-amd64" {
set root (hd0,0)
linux /boot/bzImage-4.12.0.8-amd64 root/dev/sda1 ro
}root@debianKurs:/etc/grub.d#

Then I run update-grub
}root@debianKurs:/etc/grub.d# update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
/usr/sbin/update-grub: Zeile 930: [: all: Ganzzahliger Ausdruck erwartet. (Integer expression expected.)
Found kernel: /boot/vmlinuz-4.9.0-4-amd64
Updating /boot/grub/menu.lst ... done

The menu.lst still only shows 4.9.04 things
title Debian GNU/Linux, kernel 4.9.0-4-amd64 (single-user mode)
root (hd0,0) (hd0,0) (hd0,0) (hd0,0) (hd0,0) (hd0,0) (hd0,0) (hd0,0)
kernel /boot/vmlinuz-4.9.0-4-amd64 root=UUID=587dbc40-b102-44be-82cd-49b4e8b690e6 ro
initrd /boot/initrd.img-4.9.0-4-amd64

As such, when I shutdown the system and restart it and select Advanced Option it will still only offer me the 4.9.04 version.
Any ideas?

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Add new Kernel to menu.lst not working

#2 Post by p.H »

Teebarmar wrote: 2021-09-27 16:27 I got told that update-grub would not recognize any bzImage automatically
Why then don't you just rename the kernel image ?
Teebarmar wrote: 2021-09-27 16:27 edit the 40_custom file under /etc/grub.d
This is for GRUB 2 (aka "GRUB").
Teebarmar wrote: 2021-09-27 16:27 Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
This is GRUB 1 (aka "GRUB legacy").
Teebarmar wrote: 2021-09-27 16:27 when I shutdown the system and restart it and select Advanced Option
The "Advanced options" submenu is a GRUB 2 boot loader feature.

GRUB 1 and GRUB 2 are not compatible in any way. They use different config file syntax and locations. It seems that you have a mix of both versions :
- Boot loader is from GRUB 2 and uses /boot/grub/grub.cfg (built from scripts in /etc/grub.d/)
- update-grub is from GRUB 1 and generates /boot/grub/menu.lst

You must choose which version of GRUB you want to install and use. If you want to stick with GRUB 2, reinstall package grub-pc. If you want to switch to GRUB 1 install package grub-legacy. But I advise against GRUB 1 which is obsolete and may not handle modern setups properly.

Teebarmar
Posts: 23
Joined: 2021-09-27 15:29
Has thanked: 4 times

Solved

#3 Post by Teebarmar »

Solved:

Start the system
It will boot my old version
Log in as root
reinstall grub-pc (apt-get install grub-pc)
reboot the system
See now the bzImage-4.12.0.8-amd64 related menu entry
Can select it
It will then try to boot with that
If then errors show up saying the boot fails that is then a different problem and not the subject reported here.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Add new Kernel to menu.lst not working

#4 Post by p.H »

Teebarmar wrote: 2021-09-28 12:30 If then errors show up saying the boot fails that is then a different problem and not the subject reported here.
Maybe not so unrelated. The menu entry in your original post contains several mistakes.
You should copy the menu entry for another kernel from /boot/grub/grub.cfg and adjust the kernel and initramfs names.

Post Reply