LinuxQuestions.org
Visit Jeremy's Blog.
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 01-11-2017, 06:36 AM   #1
frushiyama
Member
 
Registered: Oct 2010
Location: Brazil, SP - Cosmópolis
Distribution: Slackware
Posts: 164

Rep: Reputation: 28
Kernel huge or generic, which is running?


Is there a way to know which kernel is running without look at bootloader config files?
I am asking this just to confirm what grub2 does on the advanced options from the boot submenu.
 
Old 01-11-2017, 07:28 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 9,479

Rep: Reputation: 990Reputation: 990Reputation: 990Reputation: 990Reputation: 990Reputation: 990Reputation: 990Reputation: 990
It's logged in dmesg & /var/log/messages. I use lilo, not grub, but either of these work (as root)
Code:
cat /var/log/messages |grep Command
cat /var/log/messages |grep BOOT_IMAGE
You can also view the logs with less
 
1 members found this post helpful.
Old 01-11-2017, 07:29 AM   #3
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,665

Rep: Reputation: 489Reputation: 489Reputation: 489Reputation: 489Reputation: 489
Hi,

Usually it is known by using this command:
Code:
uname -a 
or this command
cat /proc/version
If the information given is not convincing enough and you know what modules which kernel is loading you can trace them all using this:
Code:
less /proc/config.gz
The kernel.huge usually is loading more than the generic.

Hope that helps. Good luck.

m.m.
 
1 members found this post helpful.
Old 01-11-2017, 08:20 AM   #4
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
cat /proc/cmdline
? EDIT: Answer: #10! Thanks! (I learned a bunch here!)
(Note to NoobSelf: Slack'=='Linux!=grubOS. poweroff that Mint [VBox that's eating halfXPnetbook] &Start some SlackS [which IantiGUI had already installed])

Last edited by Jjanel; 01-13-2017 at 02:37 AM.
 
3 members found this post helpful.
Old 01-11-2017, 08:47 AM   #5
Paulo2
Member
 
Registered: Aug 2012
Distribution: Slackware64 -current (started with 13.37(32))
Posts: 402

Rep: Reputation: 125Reputation: 125
14.2 generic uname -v
Code:
#1 SMP Sun Dec 11 16:03:41 CST 2016
and huge
Code:
#2 SMP Sun Dec 11 16:18:36 CST 2016
Is generic always built before huge?
 
1 members found this post helpful.
Old 01-11-2017, 09:18 AM   #6
GazL
Senior Member
 
Registered: May 2008
Posts: 4,773
Blog Entries: 14

Rep: Reputation: Disabled
I'm an advocate of using the LOCALVERSION string when building a kernel to clearly differentiate them, but the stock slackware kernels aren't built that way, so you're basically left looking for clues such as whether ext4 support is built in or not.

zgrep -q 'CONFIG_EXT4_FS=y' /proc/config.gz is likely as good a way as any.


I've no idea what grub does. I consider it to be a monstrosity and avoid it like the plague.
 
3 members found this post helpful.
Old 01-11-2017, 10:55 AM   #7
frushiyama
Member
 
Registered: Oct 2010
Location: Brazil, SP - Cosmópolis
Distribution: Slackware
Posts: 164

Original Poster
Rep: Reputation: 28
All approaches depends on LOCALVERSION, except the GazL suggestion that searchs one feature built-in only in the generic kernel.
The command from GazL didn't work here but i got the idea.
 
2 members found this post helpful.
Old 01-11-2017, 11:12 AM   #8
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 14.2 + Multilib
Posts: 1,426

Rep: Reputation: 832Reputation: 832Reputation: 832Reputation: 832Reputation: 832Reputation: 832Reputation: 832
Thanks GazL !

That's a very clever method you shared.

Not sure why I would ever need to script such info but I've saved the following into my scripts/ directory

Thanks again

-- kjh

Code:
zgrep -q 'CONFIG_EXT4_FS=y' /proc/config.gz && IsGeneric=0 || IsGeneric=1

echo "IsGeneric = $IsGeneric"
 
Old 01-12-2017, 07:01 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 9,479

Rep: Reputation: 990Reputation: 990Reputation: 990Reputation: 990Reputation: 990Reputation: 990Reputation: 990Reputation: 990
@GazL:
Quote:
I've no idea what grub does. I consider it to be a monstrosity and avoid it like the plague.
+1 on that!
 
Old 01-12-2017, 11:21 PM   #10
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.2
Posts: 3,071

Rep: Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453
Code:
0 ✓ cranium@cranium ~ $ cat /proc/cmdline 
BOOT_IMAGE=/vmlinuz-generic-4.4.38 root=UUID=f15cdaf7-c299-4cc0-8a16-533808d59454 ro
0 ✓ cranium@cranium ~ $
That appears to work for me (I'm running grub2 on this machine).

...Ah, one of my machines running grub1 gives a different answer:
Code:
cranium@gateway:~$ cat /proc/cmdline 
ro vga=791 4
cranium@gateway:~$
...I wonder what my machine that's running lilo says?
Code:
cranium@toshiba:~$ cat /proc/cmdline 
BOOT_IMAGE=4.4.38 ro swapaccount=1
cranium@toshiba:~$
Hmm. Only the machine running the horrible grub2 code provides useful output.
 
2 members found this post helpful.
Old 01-13-2017, 12:33 AM   #11
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 489

Rep: Reputation: 284Reputation: 284Reputation: 284
cat /proc/cmdline seems to have the most potential to produce something meaningful. For each grub2 and lilo, the first part of /proc/cmdline's output depends on how grub2/lilo was configured. For grub2, it is whatever the value of the linux field was e.g.
Code:
linux   /boot/vmlinuz-generic-4.4.38 root=/dev/sda7 rootfstype=ext4 raid=noautodetect intel_idle.max_cstate="1" nomodeset ro 4
in my grub.conf file produces:
Code:
chris@d6:~$ cat /proc/cmdline 
BOOT_IMAGE=/boot/vmlinuz-generic-4.4.38 root=/dev/sda7 rootfstype=ext4 raid=noautodetect intel_idle.max_cstate=1 nomodeset ro 4
.

For lilo, the /proc/cmdline output begins with whatever the label field contains e.g.
Code:
label Linux-generic
in my lilo.conf produces
Code:
root@sl64-142-vmbuilder:~# cat /proc/cmdline
BOOT_IMAGE=Linux-generic ro root=802 vt.default_utf8=0
Conclusion: put something meaningful in your grub2/lilo configuration file so that 'cat /proc/cmdline' can tell you what you want to know.
 
2 members found this post helpful.
Old 01-13-2017, 02:32 PM   #12
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,430

Rep: Reputation: 3208Reputation: 3208Reputation: 3208Reputation: 3208Reputation: 3208Reputation: 3208Reputation: 3208Reputation: 3208Reputation: 3208Reputation: 3208Reputation: 3208
Overall, the problem ends up being... the kernel doesn't have a "generic" or "huge" option. It doesn't understand what they are. Those are just two different configurations that Pat has provided for us. One has the majority of drivers compiled as modules (generic) and the other has the majority of modules compiled in the kernel (huge).

If you end up just using the symlink for your booting (by default, /boot/vmlinuz points to /boot/vmlinuz-huge-4.4.14 on a fresh 14.2 install, and /boot/vmlinuz is what is used in lilo.conf to call the kernel), your /proc/cmdline will provide no useful output since the entry is just called "Linux". The below is taken off a fresh install of 14.2 without modification to the boot system.

Code:
jbhansen@febtober:~$ cat /proc/cmdline 
auto BOOT_IMAGE=Linux ro root=802 vt.default_utf8=1
That provides no useful information. However, when you check /etc/lilo.conf and /boot, you'd realize it points to the huge kernel.

Really, if you're using the stock kernels, the best check is GazL's quick check to see if ext4 is compiled into the kernel. If it is, you know you're running a huge kernel, and if it's compiled as a module, you're running a generic kernel. You can even simplify kjhambrick's little script to a one-liner.

Code:
zgrep -q 'CONFIG_EXT4_FS=y' /proc/config.gz && echo "Huge kernel" || echo "Generic Kernel"
However, that becomes more difficult to determine if you're running a self-compiled kernel. Many people will include the default filesystem (ext4 in most cases) into the kernel to prevent needing to load it in an initrd. At that point, your kernel is neither "Huge" nor "Generic" as those are only official terms applying to official Slackware kernels. I guess your big thing would be to see how much of the kernel is compiled as modules.

I just did a random check, and surprisingly, between the huge and generic kernels, there's only a difference of about 100 modules between the generic and huge kernels. Both kernels contain over 3000 items compiled in as modules. But I guess those 101 items equate to about 3.1MB within the kernel (4.2MB for the 4.4.14 generic and 7.3MB for the huge).

Code:
jbhansen@febtober:~$ fgrep "=m" /boot/config-generic-4.4.14 | wc -l
3408
jbhansen@febtober:~$ fgrep "=m" /boot/config-huge-4.4.14 | wc -l
3307
 
7 members found this post helpful.
Old 01-13-2017, 03:18 PM   #13
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 14.2 + Multilib
Posts: 1,426

Rep: Reputation: 832Reputation: 832Reputation: 832Reputation: 832Reputation: 832Reputation: 832Reputation: 832
bassmadrigal --

Thank you for an excellent explanation !

-- kjh
 
Old 01-13-2017, 04:03 PM   #14
GazL
Senior Member
 
Registered: May 2008
Posts: 4,773
Blog Entries: 14

Rep: Reputation: Disabled
Bass' is correct. Looking for ext4 is only a quick and dirty clue. If you want more certainty, then you could do something like
Code:
#!/bin/sh

case "$(md5sum /proc/config.gz | cut -f1 -d ' ')" in
  aad7671490f498cdab5799b028fd6ab9)  echo "GazL's Custom x86_64 4.9.3-local kernel" ;;
  *)                                 echo "Unknown kernel" ;;
esac
Add an entry for the md5sum of each kernel it is likely to encounter. Obviously this takes a little extra work as you'll need to collate and maintain the list of md5sums to start with, but it should be a reasonably reliable way of identifying them once that's done.

Last edited by GazL; 01-13-2017 at 04:04 PM.
 
1 members found this post helpful.
Old 01-13-2017, 04:11 PM   #15
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.2
Posts: 3,071

Rep: Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453
Quote:
Originally Posted by chris.willing View Post
Conclusion: put something meaningful in your grub2/lilo configuration file so that 'cat /proc/cmdline' can tell you what you want to know.
Well done! Thanks for looking into that.
 
  


Reply

Tags
grub 2, kernel


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] 14.2/32-bit: huge-smp boots, generic-smp kernel panic rshepard Slackware 10 01-11-2017 09:29 AM
[SOLVED] Custom kernel doesn't work, but now even generic and huge kernels panic. ibrunton Slackware 3 01-27-2014 03:03 PM
Howto enable EDAC reporting in Slackware generic/huge kernel. granth Slackware 3 02-06-2012 03:20 AM
Generic vs Huge kernel in Slack 12 techyranger Slackware 4 01-23-2008 02:30 PM
slack 12, switch to generic kernel from huge kernel, using grub? jaguarrh Slackware 8 09-19-2007 07:29 AM

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

All times are GMT -5. The time now is 01:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration