linux - Why will dmesg have message from user space?

07
2014-04
  • dspjm

    you can use dmesg -u to see log from userspace. In my case, I have log from systemd and lvm. Why is this happening, why userspace program can print to kernel buffer ring?

  • Answers
  • David Schwartz

    A root process can write to /dev/kmsg. This is used for logging that occurs very early, before regular logging systems are ready to do any logging.

  • MariusMatutiae

    Some userspace processes can write to the dmesg because they execute actions which used to belong to kernel-space processes, but which have been moved to user-space to allow easier control by users.

    A classic example is udev, which, according to Wikipedia:

    it handles ... all user space actions when adding/removing devices, including firmware load.

    Another well-know example is FUSE, which is:

    Filesystem in Userspace (FUSE) is an operating system mechanism for Unix-like computer operating systems that lets non-privileged users create their own file systems without editing kernel code.

    Together with LVM, init, and so on, these tools perform kernel operations in user space; for this reason, and possibly also for continuity with the instruments they replaced (devfs, hotplug, ...), their output clearly belongs in the kernel ring buffer.


  • Related Question

    kernel - Linux: Tool to monitor every process, execute-command, shortly, monitor what's happening at the moment
  • Bevor

    Possible Duplicate:
    How can I log all process launches in Linux

    Hello,
    due to a freeze problem of my Ubuntu 10.10 (it is not isolatable) I though about logging every executable of the kernel somehow in any file to see what happens last when a freeze occures the next time to not lose valuable information.
    I found acct but this is obviously not what I'm looking for. Actually it logs just user commands and those things. I need something which logs in a much "deeper" level. The best would be some kind of script which records every interrupt. Does anybody know some tool like that?


  • Related Answers
  • apolinsky

    You might try a 'ps' -aux that will list all processes running on the system at a point in time. You could put it into a shell script to iteratively run over time, probably with a sleep in between iterations. A 'top' runs continuously and lists the largest users of system resources. It also has flags that can tailor its output (man top or man ps)

    Alan

  • Daniel Beck

    Gilles' comment was the solution:

    Maybe you can get a kernel core dump. See also CrashdumpRecipe and other Ubuntu kernel debugging topics.