View previous topic :: View next topic |
Author |
Message |
A.S. Pushkin Guru
Joined: 09 Nov 2002 Posts: 418 Location: dx/dt, dy/dt, dz/dt, t
|
Posted: Mon Mar 11, 2019 4:16 pm Post subject: Proper way to update grub.cfg when removing obsolete kernels |
|
|
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 |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9679 Location: almost Mile High in the USA
|
Posted: Mon Mar 11, 2019 4:24 pm Post subject: |
|
|
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 |
|
|
The Main Man Veteran
Joined: 27 Nov 2014 Posts: 1166 Location: /run/user/1000
|
Posted: Mon Mar 11, 2019 4:35 pm Post subject: |
|
|
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 |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
Syl20 l33t
Joined: 04 Aug 2005 Posts: 619 Location: France
|
Posted: Mon Mar 11, 2019 4:54 pm Post subject: Re: Proper way to update grub.cfg when removing obsolete ker |
|
|
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 |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
josedb Apprentice
Joined: 03 Nov 2006 Posts: 222
|
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
josedb Apprentice
Joined: 03 Nov 2006 Posts: 222
|
Posted: Wed Mar 13, 2019 6:09 pm Post subject: |
|
|
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 |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
Posted: Wed Mar 13, 2019 6:16 pm Post subject: |
|
|
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 |
|
|
josedb Apprentice
Joined: 03 Nov 2006 Posts: 222
|
Posted: Wed Mar 13, 2019 6:30 pm Post subject: |
|
|
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 |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
Posted: Wed Mar 13, 2019 6:36 pm Post subject: |
|
|
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.
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 |
|
|
|