7

I have recently compiled a new kernel for my linux server. It is almost identical with the previous kernel (I added cifs support). Because physical access to the server is limited, I configured grub to fallback to the old kernel if the new kernel failed to boot cleanly. I can now boot the server, but I don't know which kernel is running.

I tried doing "uname -a" and it gives me the kernel name followed by #2. Is the #2 relevant to my problem?

How can I find out which of the two possible kernels is running? Ideally I'd like to relate it to the order listed in my grub.conf

Dominic Cronin
  • 670
  • 4
  • 21
  • 1
    The `#2` would be the number of times a kernel has been built in that source tree. If you keep the source between recompiles, you can use this to identify the kernel, but be aware that all of these kernels have installed their modules into the same path. – Simon Richter Feb 28 '12 at 07:01

3 Answers3

4
$ ls /proc/fs

...should show cifs if you're on the new kernel.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • Great - thanks. That at least answers my direct question. I'll leave it open for a while, in case someone has the general answer. – Dominic Cronin Feb 27 '12 at 22:33
3

You can "tag" your kernel to identify it later on.
In menuconfig, go to "General Setup" -> "Local version - append to kernel release"
Any string you enter there will be displayed by uname as suffix to your kernel version.

Niko S P
  • 1,182
  • 8
  • 15
1

Another answer to this is cat /proc/cmdline

This shows the path to the kernel and any command line parameters that were used.

example.

cat /proc/cmdline

BOOT_IMAGE=/boot/vmlinuz-3.2.0-17-generic root=UUID=b33290c0-553a-4fd1-af00-b82017923b88 ro ipv6.disable=1 splash quiet vt.handoff=7

lostinip
  • 72
  • 1
  • 1
    that's not generally true, on gentoo i get this output: root=/dev/md1 video=vesafb:ywrap,mtrr,1024:768-16@85 panic=10 – Niko S P Feb 27 '12 at 22:39
  • 1
    Yep. You are right I messed this one up. Niko has a better answer. – lostinip Feb 27 '12 at 22:43
  • What I see with /proc/cmdline is more or less what is configured in grub.conf, so perhaps if an additional parameter were added in grub.conf, this might work. – Dominic Cronin Feb 28 '12 at 13:15