update-grub fügt nicht alle Kernel zum Grub-Menü hinzu

update-grub fügt nicht alle Kernel zum Grub-Menü hinzu

Ubuntu 21.10.

Ich baue Kernel wie dokumentiert unterhttps://help.ubuntu.com/community/Kernel/CompileUndhttps://wiki.ubuntu.com/Kernel/BuildYourOwnKernel.

DEB_BUILD_OPTIONS=parallel=$(getconf _NPROCESSORS_ONLN) AUTOBUILD=1 NOEXTRAS=1 \
    fakeroot debian/rules binary-arch

Dieser Kompilierungsbefehl hat das gleiche Ergebnis:

make --jobs=$(getconf _NPROCESSORS_ONLN) bindeb-pkg \
    LOCALVERSION=-custom-$(git describe | tr '[:upper:]' '[:lower:]')

Dadurch werden einige .debPakete erstellt:

$ ls -hal ../*.deb
-rw-r--r-- 1 amedee amedee 8,2M feb 26 02:17 ../linux-headers-5.13.19-ubuntu-5.13.0-22.22_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb
-rw-r--r-- 1 amedee amedee  70M feb 26 02:18 ../linux-image-5.13.19-ubuntu-5.13.0-22.22_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb
-rw-r--r-- 1 amedee amedee 1,2M feb 26 02:17 ../linux-libc-dev_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb

Ich installiere sie so:

sudo dpkg --install \
    ../linux-headers-5.13.19-ubuntu-5.13.0-22.22_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb \
    ../linux-image-5.13.19-ubuntu-5.13.0-22.22_5.13.19-ubuntu-5.13.0-22.22-6_amd64.deb

Dies ist dann der Inhalt von /boot:

$ ls -hal /boot/*5.13*
-rw-r--r-- 1 root root 252K nov  5 10:21 /boot/config-5.13.0-22-generic
-rw-r--r-- 1 root root 251K feb 26 02:15 /boot/config-5.13.19-ubuntu-5.13.0-22.22
-rw-r--r-- 1 root root  40M feb 22 16:21 /boot/initrd.img-5.13.0-22-generic
-rw-r--r-- 1 root root  37M feb 26 02:20 /boot/initrd.img-5.13.19-ubuntu-5.13.0-22.22
-rw------- 1 root root 5,7M nov  5 10:21 /boot/System.map-5.13.0-22-generic
-rw-r--r-- 1 root root 5,6M feb 26 02:15 /boot/System.map-5.13.19-ubuntu-5.13.0-22.22
-rw------- 1 root root 9,8M nov  5 13:51 /boot/vmlinuz-5.13.0-22-generic
-rw-r--r-- 1 root root 8,5M feb 26 02:15 /boot/vmlinuz-5.13.19-ubuntu-5.13.0-22.22

Aktualisieren Sie initramfs (was strenggenommen nicht notwendig ist, da dies bereits geschehen ist, aber zur Sicherheit):

$ sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-5.13.19-ubuntu-5.13.0-22.22
update-initramfs: Generating /boot/initrd.img-5.13.0-22-generic

Dann führe ich aus update-grub:

amedee@kerbol:~/repos/ubuntu-impish$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.13.0-22-generic
Found initrd image: /boot/initrd.img-5.13.0-22-generic
Found linux image: /boot/vmlinuz-5.13.0-22-generic
Found initrd image: /boot/initrd.img-5.13.0-22-generic
Adding boot menu entry for UEFI Firmware Settings
done

Mein kompilierter Kernel 5.13.19-ubuntu-5.13.0-22.22wird nicht von zum Grub-Menü hinzugefügt update-grub. Ich weiß, dass ich ihn manuell hinzufügen kann, aber das birgt das Risiko von Tippfehlern. Ich muss auch viele Kernel kompilieren, weil ich versuche, einen möglichen Fehler mithilfe von zu finden git bisect. Das Kernel-Problem, das ich behebe, tritt in neueren Mainline-Kerneln nicht auf, sondern nur in (einigen, aber nicht allen) Ubuntu 21.10-Kerneln, also mache ich das nur, um etwas zu lernen und meine Neugier zu befriedigen.

Was muss ich tun, damit update-grubmein kompilierter Kernel aus dem /bootVerzeichnis zum Grub-Menü hinzugefügt wird?

Antwort1

Die folgenden drei Befehle lösen dieses Problem, indem sie das ausführbare Bit ausschalten 09_lowlatencyund das Bit für aktivieren 10_linux, entsprechend dem Text in /etc/grub.d/README.lowlatency.

# chmod -x /etc/grub.d/09_lowlatency
# chmod +x /etc/grub.d/10_linux
# update-grub

Lösung gefunden beihttps://askubuntu.com/a/1228269/149519.

So bestätigen Sie, dass es jetzt wie erwartet funktioniert:

$ ls -hal /boot ; echo ; sudo update-grub
total 107M
drwxr-xr-x  4 root root 4,0K feb 28 04:42 .
drwxr-xr-x 20 root root 4,0K feb 26 01:13 ..
-rw-r--r--  1 root root 252K nov  5 10:21 config-5.13.0-22-generic
-rw-r--r--  1 root root 251K feb 26 02:15 config-5.13.19-ubuntu-5.13.0-22.22
drwx------  4 root root 4,0K jan  1  1970 efi
drwxr-xr-x  5 root root 4,0K feb 28 04:42 grub
lrwxrwxrwx  1 root root   28 feb 28 04:26 initrd.img -> initrd.img-5.13.0-22-generic
-rw-r--r--  1 root root  40M feb 26 13:55 initrd.img-5.13.0-22-generic
-rw-r--r--  1 root root  37M feb 26 13:54 initrd.img-5.13.19-ubuntu-5.13.0-22.22
-rw-------  1 root root 5,7M nov  5 10:21 System.map-5.13.0-22-generic
-rw-r--r--  1 root root 5,6M feb 26 02:15 System.map-5.13.19-ubuntu-5.13.0-22.22
lrwxrwxrwx  1 root root   25 feb 28 04:27 vmlinuz -> vmlinuz-5.13.0-22-generic
-rw-------  1 root root 9,8M nov  5 13:51 vmlinuz-5.13.0-22-generic
-rw-r--r--  1 root root 8,5M feb 26 02:15 vmlinuz-5.13.19-ubuntu-5.13.0-22.22

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.13.19-ubuntu-5.13.0-22.22
Found initrd image: /boot/initrd.img-5.13.19-ubuntu-5.13.0-22.22
Found linux image: /boot/vmlinuz-5.13.0-22-generic
Found initrd image: /boot/initrd.img-5.13.0-22-generic
Adding boot menu entry for UEFI Firmware Settings
done

verwandte Informationen