LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-15-2014, 01:24 AM   #1
qweasd
Member
 
Registered: May 2010
Posts: 621

Rep: Reputation: Disabled
Is it feasible to upgrade kernel-headers?


Please forgive me if I am not asking these questions right, my understanding of the inner workings of Linux is very poor.

I would like to upgrade the kernel, and I've heard before that I should leave the kernel-headers package in place. In my understanding kernel-headers are the headers that glibc is compiled with. Isn't there a slight chance that some struct is different size in the new kernel, and bad things happen?

To put it another way, would it not be safer to upgrade the headers along with the kernel? Would that require also rebuilding glibc? And would rebuilding glibc be sufficient for plugging that hole, however small it may be?

To put it a third way... Suppose Patrick V. needed to upgrade the kernel in stable: a patch wouldn't do it. What would he do?
 
Old 11-15-2014, 01:50 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
Perhaps this will help. http://alien.slackbook.org/dokuwiki/...eaders_package
 
Old 11-15-2014, 12:29 PM   #3
qweasd
Member
 
Registered: May 2010
Posts: 621

Original Poster
Rep: Reputation: Disabled
I am familiar with this extremely helpful writeup, allend, but I still feel like I am missing something from this picture. Look here, for example:

http://www.slackware.com/security/vi...ecurity.597338
ftp://ftp.slackware.com/pub/slackwar...ches/packages/
ftp://ftp.slackware.com/pub/slackwar...ux-2.6.37.6-3/

There PV upgraded every kernel-related package, yet he kept everything at the same exact version, which is what he always does (are there exceptions?). So while me and many other slackers are perfectly happy mismatching kernels and headers, PV seems to think it's a bad idea. So the question is, is there a better, safer way to upgrade the kernel? Would it involve rebuilding glibc with new headers? Or any other parts of the gcc toolchain? Or does the whole Slackware have to be bootstrapped again?
 
Old 11-15-2014, 01:32 PM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,058

Rep: Reputation: Disabled
Quote:
Originally Posted by qweasd View Post
So while me and many other slackers are perfectly happy mismatching kernels and headers, PV seems to think it's a bad idea.
I think that's a misunderstanding. As pointed out by Alien BOB (cf. the link provided by Allend) Slackware contains two sets of kernels headers in two different places, that do not need to be the same. Would Pat think that's a bad idea, he would propose an upgrade of the kernel headers in /usr/include/linux every time he propose an upgrade of the kernel so that they stay identical (not only that, but all stuff that depends on these kernel headers as pointed out by Eric). As he doesn't you can be assured that's not necessary.
 
Old 11-15-2014, 01:37 PM   #5
qweasd
Member
 
Registered: May 2010
Posts: 621

Original Poster
Rep: Reputation: Disabled
But did PV actually ever upgrade a kernel, as opposed to patching it?
 
Old 11-15-2014, 08:10 PM   #6
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
The kernel-headers actually are irrelevant to the actual Linux kernel.

The kernel-headers are actually tied more to glibc and gcc, and really many people refer to them as the "glibc kernel headers" more correctly. If you have kernel headers for kernel 3.4.20 and your glibc was built around 3.4.20, but you run kernel 3.16.1, you're glibc kernel headers are not for the kernel, they are for the compiler, and you do not need to rebuild the headers or glibc. In fact, unless you update glibc, you really never need to upgrade the kernel headers.
 
Old 11-15-2014, 09:27 PM   #7
qweasd
Member
 
Registered: May 2010
Posts: 621

Original Poster
Rep: Reputation: Disabled
Quote:
they are for the compiler
Let's say I have stock headers and an upgraded kernel, with version mismatch. If I build a program with glibc now, it will be calling into a new kernel, but using structs from the stock headers. I hope I am getting this right... This seems like a relatively tiny risk, but what would have to be done to avoid it entirely?
 
Old 11-15-2014, 10:06 PM   #8
mlslk31
Member
 
Registered: Mar 2013
Location: Florida, USA
Distribution: Slackware, FreeBSD
Posts: 210

Rep: Reputation: 76
Quote:
Originally Posted by qweasd View Post
Let's say I have stock headers and an upgraded kernel, with version mismatch. If I build a program with glibc now, it will be calling into a new kernel, but using structs from the stock headers. I hope I am getting this right... This seems like a relatively tiny risk, but what would have to be done to avoid it entirely?
You could install new kernel, new kernel headers, then audit those kernel headers (look for stale files). After that, rebuild glibc against those headers. Usually, I'll throw gcc into the mix as well. Rebuild whatever else depends on Linux-specific headers.

You're trusting both glibc and the kernel to offer backwards compatibility. As Linus once stated, "We do not break userspace!" Maybe things don't always work out that way: Maybe a hardware- or network-related tool will have to be rebuilt every now and then. For the most part, it's worked in recent years, save for that whole drm/Mesa/Xorg thing that requires the planets to be aligned before everything works perfectly.
 
Old 11-16-2014, 02:18 PM   #9
qweasd
Member
 
Registered: May 2010
Posts: 621

Original Poster
Rep: Reputation: Disabled
Thanks mlslk31! And also, the glibc wiki says:
Quote:
What version of the Linux kernel headers should be used?

The headers from the most recent Linux kernel should be used. The headers used while compiling the GNU C library and the kernel binary used when using the library do not need to match. The GNU C library runs without problems on kernels that are older than the kernel headers used. The other way round (compiling the GNU C library with old kernel headers and running on a recent kernel) does not necessarily work as expected. For example you can't use new kernel features if you used old kernel headers to compile the GNU C library.

Even if you are using an older kernel on your machine, we recommend you compile GNU libc with the most current kernel headers. That way you won't have to recompile libc if you ever upgrade to a newer kernel.
I think I have my answer, but I would be extremely thankful for any other comment, especially in relation to Slackware.
 
Old 11-16-2014, 03:16 PM   #10
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Do NOT upgrade the headers when compiling a new kernel.
You can upgrade the headers when compiling a new glibc.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[kernel-headers-3.2.45-x86-3] OR [kernel-headers-3.2.45_smp-x86-3]? Sefid par Slackware 3 07-24-2013 09:59 AM
[SOLVED] After upgrading to kernel 3.8 module-assistant can't find kernel headers (Debian Sid) Hungry ghost Debian 9 05-16-2013 07:59 PM
Trying to install ethernet adapter driver, not finding kernel-devel or kernel-headers oneFishtwoFish Red Hat 5 08-31-2010 06:24 PM
Zypper wants to dl the wrong kernel headers... YaST doesnt have current headers zorb SUSE / openSUSE 2 11-28-2009 11:12 AM
Automatic removal of kernel headers package when kernel packages are removed bgoodr Debian 3 12-30-2008 08:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration