View previous topic :: View next topic |
Author |
Message |
Jim5678 n00b
Joined: 23 Jan 2024 Posts: 13
|
Posted: Tue Oct 22, 2024 11:48 am Post subject: Set Grub default to newest kernel |
|
|
Hello,
Is there a way to set the default kernel grub uses to the most recently installed kernel. I'm building my kernels manually and installing using
Code: |
genkernel --install initramfs --mdadm
grub-mkconfig -o /boot/grub/grub.cfg
grub-install --efi-directory=/efi |
Thanks |
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2179
|
Posted: Tue Oct 22, 2024 3:43 pm Post subject: |
|
|
If you install your kernels to a /boot directory or filesystem, and that filesystem is ext4 or other Linux, you should be able to use a symbolic link to the current kernel. This won't work if you install your kernels to a directory in the EFI partition, as that's a Microsoft filesystem that don't support symbolic links.
The original installkernel script handled the case where there is an existing "vmlinuz" symbolic link to "vmlinuz-6.11.5" or whatever, together with similar symbolic links for "config" and "System.map". For compatibility, if there was no existing symbolic link, it wouldn't create one, but otherwise it would peform a pirouette to maintain "vmlinuz", "vmlinuz.old" and so forth links to the versions currently and most previously installed. The relatively new Gentoo version of installkernel can, I think, still work this way, depending on USE flags.
That said, I don't use genkernel, so I've no idea if it can do the same, but I'd hope so. _________________ Greybeard |
|
Back to top |
|
|
Ralphred l33t
Joined: 31 Dec 2013 Posts: 656
|
Posted: Tue Oct 22, 2024 4:33 pm Post subject: |
|
|
Goverp wrote: | ...stuff... | Indeed.
If you are following the latest revision of the handbook for EFI boot, there is no need to "install" kernels at all, just symlink /boot/vmlinuz{.old} et al to bzimage etc. in the respective source trees.
Also, why are we using compressed kernels when space is at such a low premium nowadays? |
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2179
|
Posted: Tue Oct 22, 2024 5:01 pm Post subject: |
|
|
Ralphred wrote: | ...If you are following the latest revision of the handbook for EFI boot, there is no need to "install" kernels at all, just symlink /boot/vmlinuz{.old} et al to bzimage etc. in the respective source trees. ... |
That's neat, but if you discover your latest and greatest kernel is broken, you need a way to get at the previous working one - or maybe keep a recovery "disk" to hand.
FWIW, I've just found kernel 6.11.4 won't boot on my laptop with its hard drive replaced by an SSD. 6.11.3 and 6.11.5 both fine, all three with the same .config. As soon as I found it wouldn't boot, back to "vmlinuz.old", already in my GRUB menu. _________________ Greybeard |
|
Back to top |
|
|
no101 n00b
Joined: 10 Oct 2022 Posts: 13 Location: Piney Woods
|
|
Back to top |
|
|
Ralphred l33t
Joined: 31 Dec 2013 Posts: 656
|
Posted: Tue Oct 22, 2024 5:51 pm Post subject: |
|
|
Goverp wrote: | As soon as I found it wouldn't boot, back to "vmlinuz.old", already in my GRUB menu. | Well, technically if I bothered to "do it the way mentioned" vmlinuz.old would point to bzimage in 6.8.2's source tree, so a "backup" would still exist.
n101 wrote: | it also regenerates grub. | I'm really "precious" about my grub.cfg files: I always run a grub-mkconfig >/dev/null to make sure it's got everything, and run a grub-mkconfig >/boot/grub/grub.cfg-[kernel version] before updating because I have semi-complicated menu entry generation. Letting something automate that process feels like letting a stranger use your kitchen to me... |
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2179
|
Posted: Wed Oct 23, 2024 9:41 am Post subject: |
|
|
Ralphred wrote: | ... and run a grub-mkconfig >/boot/grub/grub.cfg-[kernel version] before updating because I have semi-complicated menu entry generation. Letting something automate that process feels like letting a stranger use your kitchen to me... |
Indeed. I haven't used the output from grub-mkconfig for years, and hardly ever change grub.cfg.
Back in the days of "GRUB legacy", i.e. version 1, you wrote your own grub.conf, and it was a one-time operation, unless you wanted to tweak your boot cmdline. Then GRUB 2 arrives, and to make things easier, they provide grub-mkconfig to provide an initial grub.cfg. So far, so good. Then Ubuntu (I don't know if it's actually their fault, but I might as well blame them) decide to stop using the vmlinuz symlinks, so now installing a kernel requires regenerating your grub.cfg. Madness. _________________ Greybeard |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|