View previous topic :: View next topic |
Author |
Message |
while true Guru


Joined: 07 Apr 2010 Posts: 517 Location: Ljubljana, Slovenia
|
Posted: Sat Nov 02, 2019 10:57 am Post subject: noob updating kernel [solved] |
|
|
Hello Gentoo people,
since i learned to upgrade kernel, it is quite a chour/task to set new kernel up.
for me it takes time since i tend to measure twice and than start up the chain saw.
upgrading kernel is nice, but there is update like every week...
so i skipped updating kernel for a while,
my last saved config is: kernel-config-5.2.8-gentoo
my umane -a says: Linux keeshta 5.2.11-gentoo #1 SMP Sun Sep 1 01:17:33 CEST 2019 x86_64 AMD FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux
and
Code: | # eselect kernel list
Available kernel symlink targets:
[1] linux-5.2.14-gentoo *
[2] linux-5.3.4-gentoo
[3] linux-5.3.5-gentoo
[4] linux-5.3.7-gentoo
[5] linux-5.3.8-gentoo |
i follow written steps to upgrade, first is:
Code: | # cp /usr/src/linux/.config ~/kernel-config-`uname -r`
cp: cannot stat '/usr/src/linux/.config': No such file or directory |
so i am stuck here.
my next steps would be:
eselect kernel list
eselect kernel set 5
cd /usr/src/linux
cp /boot/config-5.2.11-gentoo /usr/src/linux/.config
make syncconfig
make -j9 && make modules_install
make install
grub-mkconfig -o /boot/grub/grub.cfg
reboot
thank you _________________ Kind regards, Goran Mitic
alive
while true
kick ass
Last edited by while true on Sun Nov 03, 2019 4:19 pm; edited 1 time in total |
|
Back to top |
|
 |
fturco Veteran

Joined: 08 Dec 2010 Posts: 1184 Location: Italy
|
Posted: Sat Nov 02, 2019 11:31 am Post subject: |
|
|
I'm not sure I understood correctly, but if you have a working kernel configuration in ~/kernel-config-5.2.8-gentoo, you can copy it to /usr/src/linux/.config and then run make olddefconfig. Of course first make sure you updated the symlink to the desired kernel version. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 47176 Location: 56N 3W
|
Posted: Sat Nov 02, 2019 12:15 pm Post subject: |
|
|
while true,
Unless you have very new hardware, you don't need every kernel update.
e.g. moving from 5.2.8 to 5.2.9 is a bugfix. If you have kernel issues, do it, if not its fine to leave.
Do update from 5.2.x to 5.3.y or after a few versions, the questions that make oldconfig asks appear never ending. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
Jaglover Watchman


Joined: 29 May 2005 Posts: 7799 Location: Saint Amant, Acadiana
|
Posted: Sat Nov 02, 2019 12:47 pm Post subject: |
|
|
fturco wrote: | I'm not sure I understood correctly, but if you have a working kernel configuration in ~/kernel-config-5.2.8-gentoo, you can copy it to /usr/src/linux/.config and then run make olddefconfig. Of course first make sure you updated the symlink to the desired kernel version. |
Let this be a warning for you - do not believe everything they write in the internet. Basically the above tells you - take your carefully crafted config and bulldoze it. _________________ My Gentoo installation notes.
Please learn how to denote units correctly! |
|
Back to top |
|
 |
fturco Veteran

Joined: 08 Dec 2010 Posts: 1184 Location: Italy
|
Posted: Sat Nov 02, 2019 1:13 pm Post subject: |
|
|
Jaglover: can you explain me what's wrong with make olddefconfig, please? |
|
Back to top |
|
 |
kajzer l33t


Joined: 27 Nov 2014 Posts: 897
|
Posted: Sat Nov 02, 2019 1:17 pm Post subject: |
|
|
Should be oldconfig , not olddefconfig. |
|
Back to top |
|
 |
fturco Veteran

Joined: 08 Dec 2010 Posts: 1184 Location: Italy
|
Posted: Sat Nov 02, 2019 1:26 pm Post subject: |
|
|
From make help:
- oldconfig: Update current config utilising a provided .config as base
- olddefconfig: Same as oldconfig but sets new symbols to their default value without prompting
As far as I know, in both cases old kernel options are not going to be changed in any way. That's the most important thing in my opinion.
But personally I don't like to make an explicit choice for every new kernel option, for every new kernel version. So that's why I choose olddefconfig. I don't see anything wrong with that. |
|
Back to top |
|
 |
fturco Veteran

Joined: 08 Dec 2010 Posts: 1184 Location: Italy
|
Posted: Sat Nov 02, 2019 1:41 pm Post subject: |
|
|
Jaglover wrote: | fturco wrote: | I'm not sure I understood correctly, but if you have a working kernel configuration in ~/kernel-config-5.2.8-gentoo, you can copy it to /usr/src/linux/.config and then run make olddefconfig. Of course first make sure you updated the symlink to the desired kernel version. |
Let this be a warning for you - do not believe everything they write in the internet. |
I agree, but please notice you are on the Internet as well from my point of view (and from OP's point of view).  |
|
Back to top |
|
 |
Jaglover Watchman


Joined: 29 May 2005 Posts: 7799 Location: Saint Amant, Acadiana
|
Posted: Sat Nov 02, 2019 2:06 pm Post subject: |
|
|
You are running Gentoo. I assume you know why you chose it. Most people do it because Gentoo gives you choices. Choices only you can make, choices which suit your needs.
Modern Linux kernel is no different. You have to make choices. By running 'make olddefconfig' you apply someone else's choices. Every time I run 'make oldconfig' and there has been a mayor version upgrade I have to correct many options, default choices made by kernel developers are not best for my use case.
There seems to be a belief [among lazy or noobs] kernel configuration can be automated. If you get a little deeper into this you will understand it cannot be automated. Maybe in the future, when everyone has a chip installed in their brain and there is a device which communicates with it and interacts with kernel configuration process.
Being lazy and doing 'make olddefconfig' is OK if you do it knowingly to your own computer. Telling to someone else to do it without warning it will lead to suboptimal configuration is not OK. _________________ My Gentoo installation notes.
Please learn how to denote units correctly! |
|
Back to top |
|
 |
fturco Veteran

Joined: 08 Dec 2010 Posts: 1184 Location: Italy
|
Posted: Sat Nov 02, 2019 2:39 pm Post subject: |
|
|
I think it really depends on who you are saying that to. A beginner who has not much experience building kernels may be perfectly fine with olddefconfig, even if he's running Gentoo. After all, his computer won't explode when booting a slightly bigger kernel! After he becomes more experienced, he may indeed find oldconfig more appropriate and enjoy working on minimizing kernel size. |
|
Back to top |
|
 |
while true Guru


Joined: 07 Apr 2010 Posts: 517 Location: Ljubljana, Slovenia
|
Posted: Sat Nov 02, 2019 3:24 pm Post subject: |
|
|
i just took dogs for a walk...
cia fturco,
ok, so i need to get over that first step,
that is why i am here,
where do i copy it from? from here?
keeshta /usr/src # ls linux-5.2.11-gentoo/.config (tab tab)
.config .config.old
i also have
ls /boot/config*
config-5.2.11-gentoo
can i skip this first step since i have 5.2.11.config in 2 places and try to continue to upgrade my kernel?
and bonus question, in /usr/src/ i have like over 40 linus* folders, can i simply delete them and leave last two?
what do you have in that jag Jaglover? so i am noob, but i see other distros, well i use two others (love my RPi's), do not have this freedom of choice to build kernel, well they do, probably compile kernel like we do, but kernel upgrade usualy is taken care of during usual update. we take more steps, i do not mind, but i am stuck and appritiate helping hand.
Jaglover, why did my usual kernel upgrade stopped at first step?
# cp /usr/src/linux/.config ~/kernel-config-`uname -r`
cp: cannot stat '/usr/src/linux/.config': No such file or directory
and, Jaglover, can i do without it, and try to procceede with next steps?
now that would teach the noob a thing or two!
Thank you all, Neddy that means you too  _________________ Kind regards, Goran Mitic
alive
while true
kick ass |
|
Back to top |
|
 |
fturco Veteran

Joined: 08 Dec 2010 Posts: 1184 Location: Italy
|
Posted: Sat Nov 02, 2019 4:31 pm Post subject: |
|
|
I would first check if your /boot/config-5.2.11-gentoo is identical to /usr/src/linux-5.2.11-gentoo/.config with:
Code: | diff /boot/config-5.2.11-gentoo /usr/src/linux-5.2.11-gentoo/.config |
If the previous command returns no output (technically exit status zero), then the files are identical, and you can copy either one.
Then you need to be sure /usr/src/linux is a symlink pointing to the right kernel source directory:
Code: | ls -l /usr/src/linux |
If you want another kernel version you need to manually fix the symlink with the following command:
Code: | ln -sf /usr/src/linux-<version>-gentoo /usr/src/linux |
Of course replace <version> with a proper kernel version (for example 5.3.8 ).
At this point you can copy your old kernel configuration file to /usr/src/linux. Pick one of the following commands:
Code: | cp /boot/config-5.2.11-gentoo /usr/src/linux/.config
cp /usr/src/linux-5.2.11-gentoo/.config /usr/src/linux/.config |
Now you are ready to update the kernel configuration. If your are lazy like me:
Code: | cd /usr/src/linux
make olddefconfig |
If you want maximum control, issue the following command instead:
Then you build the new kernel:
If you have a dual-core CPU you can speed up the process by running:
Of course for a quad-core CPU you should use "make -j4", etc.
Now you can install the kernel image in the /boot directory (please mount it first if it's on a separate partition):
Then you can install the modules in the /lib/modules directory:
Code: | make modules_install |
If you have an initramfs image you now need to regenerate it.
Finally, remember to update your bootloader's configuration and reboot your computer.
After the reboot into the new kernel, check the date and time with:
That's the build date and time of the running kernel. If it's not what you expect, you are not running the kernel you think you are.
If everything works as expected, you may now delete old kernels from both the /boot and the /lib/modules directories. But please make sure you don't accidentally delete your current kernel! Also, remember to regenerate your bootloader's configuration, too.
Bonus: if you enabled both CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC kernel options, you can get your current kernel configuration from /proc/config.gz. You can uncompress it with:
Code: | gzip -cd /proc/config.gz > /path/to/config |
Edit #1: add "uname -a" command after suggestion by NeddySeagoon
Last edited by fturco on Sat Nov 02, 2019 6:27 pm; edited 1 time in total |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 47176 Location: 56N 3W
|
Posted: Sat Nov 02, 2019 6:07 pm Post subject: |
|
|
fturco,
I would add one step before deleting anything.
After the reboot into the new kernel, check the date and time in the output of
That's the build date and time of the running kernel. If its not what you expect, you are not running the kernel you think you are. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
fturco Veteran

Joined: 08 Dec 2010 Posts: 1184 Location: Italy
|
Posted: Sat Nov 02, 2019 6:28 pm Post subject: |
|
|
Thanks NeddySeagoon, I added your tip to my previous post. |
|
Back to top |
|
 |
charles17 Advocate

Joined: 02 Mar 2008 Posts: 3613
|
Posted: Sun Nov 03, 2019 7:43 am Post subject: |
|
|
fturco wrote: | Now you can install the kernel image in the /boot directory (please mount it first if it's on a separate partition):
|
Users of EFI stub kernels might prefer debianutils[-installkernel] and do not have make install. Moving the kernel image directly to the right place in the EFI tree is described in this wiki article. |
|
Back to top |
|
 |
while true Guru


Joined: 07 Apr 2010 Posts: 517 Location: Ljubljana, Slovenia
|
Posted: Sun Nov 03, 2019 4:18 pm Post subject: |
|
|
fturco
Code: | uname -a
Linux keeshta 5.3.8-gentoo #1 SMP Sun Nov 3 15:58:40 CET 2019 x86_64 AMD FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux |
thank you so much fturco, if you stroll down Ljubljana i owe you a capuchino _________________ Kind regards, Goran Mitic
alive
while true
kick ass |
|
Back to top |
|
 |
|