Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Proper way to update grub.cfg when removing obsolete kernels
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
A.S. Pushkin
Guru
Guru


Joined: 09 Nov 2002
Posts: 418
Location: dx/dt, dy/dt, dz/dt, t

PostPosted: Mon Mar 11, 2019 4:16 pm    Post subject: Proper way to update grub.cfg when removing obsolete kernels Reply with quote

I hate to ask this, but I've been removing obsolete kernels.

I wary of editing grub.cfg after removing obsolete kernels for fear of
corrupting the file.

What is the best way to do this without damaging my installation.
I've already unmerged kernel sources, respective files in /boot and /lib/modules.

TIA
_________________
ASPushkin

"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Mon Mar 11, 2019 4:24 pm    Post subject: Reply with quote

Technically speaking, if you're using grub2 you should be using grub-mkconfig each time you add a new kernel and completely overwrite your old file.

... which is no good if you had to make manual edits.

The trick is to get grub-mkconfig to automatically "edit" or add the commands needed to make it automatically generate a grub.conf you need. What manual edits did you need to make?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1166
Location: /run/user/1000

PostPosted: Mon Mar 11, 2019 4:35 pm    Post subject: Reply with quote

Nothing to worry about editing grub.cfg
I keep two kernels, once I compile new one, I just edit the numbers.
For example, If you had 5.0.0 and 5.0.1 comes out you just replace 5.0.0 to be 5.0.1
I have 'previous kernel' in the menu so I edit that one as well and do the same thing, in this case that one would be 5.0.0
And you keep going like that.

Code:
linux   /boot/vmlinuz-5.0.1-gentoo root=/dev/sda1 rootfstype=ext4
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Mon Mar 11, 2019 4:41 pm    Post subject: Reply with quote

My current kernel is always bzImage and the backup is always bzImage.old. No need to reconfigure the bootloader.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Syl20
l33t
l33t


Joined: 04 Aug 2005
Posts: 619
Location: France

PostPosted: Mon Mar 11, 2019 4:54 pm    Post subject: Re: Proper way to update grub.cfg when removing obsolete ker Reply with quote

To get the same behaviour, I use symlinks. Kernel's "make install" updates them.

A.S. Pushkin wrote:
I wary of editing grub.cfg after removing obsolete kernels for fear of
corrupting the file.

Well... Make backups.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Mon Mar 11, 2019 5:02 pm    Post subject: Reply with quote

https://wiki.gentoo.org/wiki/GRUB2_Quick_Start#Manual_configuration

To corrupt this one you need some sort of accelerator ... see local liqueur store perhaps.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
josedb
Apprentice
Apprentice


Joined: 03 Nov 2006
Posts: 222

PostPosted: Wed Mar 13, 2019 5:05 pm    Post subject: Reply with quote

why not?
grub-mkcofig -o /boot/grub/grub.cgf

are you using software raid?

https://wiki.gentoo.org/wiki/GRUB2
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Mar 13, 2019 6:04 pm    Post subject: Reply with quote

Quote:
grub-mkcofig -o /boot/grub/grub.cgf

Yes, this is what binary distros do. In Gentoo we can do better than that.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
josedb
Apprentice
Apprentice


Joined: 03 Nov 2006
Posts: 222

PostPosted: Wed Mar 13, 2019 6:09 pm    Post subject: Reply with quote

Jaglover wrote:
Quote:
grub-mkcofig -o /boot/grub/grub.cgf

Yes, this is what binary distros do. In Gentoo we can do better than that.


Binary distros don't usually require the user to perform such operations as it's automatically made when kernel is updated. You can use this software to speed up the configuration, and you are still able to edit the config files then.
you can write everything by hand if it is a whim and you want to waste time. your choise.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Mar 13, 2019 6:16 pm    Post subject: Reply with quote

Yes, you can generate a clumsy huge file with totally unnecessary content - if you are lucky then grub-mkcofig won't mess it up and it will work.
Or you can write a simple elegant conf file with a few lines in it.
Your computer, your choice. I'm running Gentoo, BTW. One of reasons doing so is not having cruft in my computer.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
josedb
Apprentice
Apprentice


Joined: 03 Nov 2006
Posts: 222

PostPosted: Wed Mar 13, 2019 6:30 pm    Post subject: Reply with quote

Jaglover wrote:
Yes, you can generate a clumsy huge file with totally unnecessary content - if you are lucky then grub-mkcofig won't mess it up and it will work.
Or you can write a simple elegant conf file with a few lines in it.
Your computer, your choice. I'm running Gentoo, BTW. One of reasons doing so is not having cruft in my computer.


https://i.imgur.com/bCmND0f.png
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Mar 13, 2019 6:36 pm    Post subject: Reply with quote

josedb wrote:
Jaglover wrote:
Yes, you can generate a clumsy huge file with totally unnecessary content - if you are lucky then grub-mkcofig won't mess it up and it will work.
Or you can write a simple elegant conf file with a few lines in it.
Your computer, your choice. I'm running Gentoo, BTW. One of reasons doing so is not having cruft in my computer.


https://i.imgur.com/bCmND0f.png


Never heard before a bootloader can read a png file. 8O

For sake of truth, I do not use Grub2 myself. I see no point installing tens of megabytes of software just to load kernel during boot. It can be accomplished in a much simpler and elegant way.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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