4

I put some debugging messages in the kernel code. have checked /var/log/messages, dmesg and there is no such dump there. syslogd is running on the machine

i also changed /proc/sys/kernel/printk to 8 4 1 7

any idea what can be the problem?

David
  • 4,634
  • 7
  • 35
  • 42

2 Answers2

3

I faced the same problem until yesterday, when i found something interesting. Lately linux kernel has been adopting pr_** instead of printk (3.5 version and later).

I have tried running a basic module program with printk on 3.3 version of the kernel & the same on 3.7 and above.

Former works fine. Later just doesn't show up the printk's on dmesg or /var/log/messages. However replacing the printk with pr_info macro,did the job. (other variants are also there pr_err, pr_notice etc found in include/linux/kernel.h earlier now moved to include/linux/printk.h)

Although, pr_** macro's are quite old, thanks to campaign by Joe Perches, who has initiated the above mentioned change, we better learn the kernel ways ! (Reference: pr_info())

Monkey_play
  • 73
  • 1
  • 8
0

The easiest explanation is your printk() is not being called.

Keep it simple and stick to checking dmesg(1) output while you're debugging this problem -- all the syslog(3) /var/log/messages and the console based output are separate from the issue of the messages not even showing up in the kernel's message buffer.

sarnold
  • 102,305
  • 22
  • 181
  • 238
  • i placed prink() inside a core scheduler routine sched_fork(),normal_prio() et al.. none of them showed up in dmesg. can you suggest a routine which is always called in all the cases .just wanted to check my recompiled kernel is picked up when i have booted the machine – David Nov 11 '11 at 07:53
  • Wow, that's an expensive way to see into the scheduler. Look into `Documentation/scheduler/sched-stats.txt` for information on cheaper ways to learn what the scheduler is doing. :) If you want to see a changed kernel booted and working, I suggest modifying something more like `init/main.c`'s `start_kernel()` function. It kicks awake all the different subsystems at boot. – sarnold Nov 11 '11 at 08:02
  • thanks for the comment.. Looks like my way was way expensive Documentation/scheduler is much nicer way to learn it. somehow i am skeptical that my recompiled kernel which i installed through dpkg -i is not active. how to verify this? i have succefully rebooted the machine and followed everything step by step mentioned in http://blog.avirtualhome.com/2010/11/06/how-to-compile-a-ubuntu-10-10-maverick-kernel/ – David Nov 11 '11 at 08:09
  • Check the build date of `uname -a` in your running kernel -- it'll give you a better idea if you're on a kernel you built today or if you're on a distribution-provided kernel. While those instructions you found look great for following the Ubuntu kernel development, it feels a little "heavy" -- if you don't mind using the upstream kernel.org kernel instead, look into [kernel-package](http://packages.debian.org/sid/kernel-package) (also available in some of the Ubuntu repositories) -- it's far easier to work with. – sarnold Nov 11 '11 at 09:12
  • thanks for the help. Can you suggest me any lightweight easy to build kernel. i want to do some work on scheduler modification. I am newbie to kernel development. – David Nov 12 '11 at 06:19
  • Modern Linux is definitely harder to modify than it used to be. The 2.2 Linux kernel was a lot easier to modify and play with; if you boot it into KVM or something similar, its significantly older hardware support won't be much of an issue. A fellow stacker was asking questions about the toy os [OS/161](http://www.eecs.harvard.edu/~syrah/os161/) the other day -- it looks cool, but might leave too much to you to implement. I haven't really looked at any of the BSD kernels since OpenBSD 3.3 or FreeBSD 4.0, but both those were very straight-forward build and modification environments. – sarnold Nov 12 '11 at 07:14
  • **BUT**, I think if you look into the `kernel-package` package, you'll find building and installing new Linux kernels isn't as much work as your `avirtualhome.com` instructions would indicate. – sarnold Nov 12 '11 at 07:15