LinuxQuestions.org
Review your favorite Linux distribution.
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 01-11-2017, 05:36 AM   #1
frushiyama
Member
 
Registered: Oct 2010
Location: Brazil, SP - Cosmópolis
Distribution: Slackware
Posts: 171

Rep: Reputation: 40
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, 06:28 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,427

Rep: Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339
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, 06:29 AM   #3
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
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, 07: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: 364Reputation: 364Reputation: 364Reputation: 364
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 01:37 AM.
 
4 members found this post helpful.
Old 01-11-2017, 07:47 AM   #5
Paulo2
Member
 
Registered: Aug 2012
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 935

Rep: Reputation: 527Reputation: 527Reputation: 527Reputation: 527Reputation: 527Reputation: 527
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, 08:18 AM   #6
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,917

Rep: Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034
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, 09:55 AM   #7
frushiyama
Member
 
Registered: Oct 2010
Location: Brazil, SP - Cosmópolis
Distribution: Slackware
Posts: 171

Original Poster
Rep: Reputation: 40
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, 10:12 AM   #8
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
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, 06:01 AM   #9
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,427

Rep: Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339Reputation: 2339
@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, 10:21 PM   #10
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
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-12-2017, 11:33 PM   #11
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 917

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
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, 01:32 PM   #12
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
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, 02:18 PM   #13
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
bassmadrigal --

Thank you for an excellent explanation !

-- kjh
 
Old 01-13-2017, 03:03 PM   #14
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,917

Rep: Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034Reputation: 5034
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 03:04 PM.
 
1 members found this post helpful.
Old 01-13-2017, 03:11 PM   #15
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
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



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

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

All times are GMT -5. The time now is 08:53 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