Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Set Grub default to newest kernel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Jim5678
n00b
n00b


Joined: 23 Jan 2024
Posts: 12

PostPosted: Tue Oct 22, 2024 11:48 am    Post subject: Set Grub default to newest kernel Reply with quote

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
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2152

PostPosted: Tue Oct 22, 2024 3:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 618

PostPosted: Tue Oct 22, 2024 4:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2152

PostPosted: Tue Oct 22, 2024 5:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
no101
n00b
n00b


Joined: 10 Oct 2022
Posts: 13
Location: Piney Woods

PostPosted: Tue Oct 22, 2024 5:09 pm    Post subject: Reply with quote

https://wiki.gentoo.org/wiki/Kernel/Removal#Using_eclean-kernel

eclean-kernel is awsome. Not only does it clean stale entries from /boot, it also regenerates grub.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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