# dmesg stays between reboots



## tbyte (Oct 26, 2009)

This is diskless network booted machine. It crashed and rebooted and after the reboot it still has the dmesg messages from it's "previous run". And I'v see it on the other network booted diskless machines too. How is this happening, where are those messages kept when there is not HDD and NFS is only used to download the boot image but never mounted on the running system ?

```
[skip]
arp: xx.xx.xx.xx moved from 00:e0:4c:e0:0a:85 to 00:22:64:72:66:5e on man
arplookup 85.196.191.196 failed: could not allocate llinfo
arp: xx.xx.xx.xx moved from 00:22:64:72:66:5e to 00:e0:4c:e0:0a:85 on man
arplookup 10.10.0.81 failed: could not allocate llinfo
arp: 10.10.11.193 moved from 00:22:6b:59:60:06 to 00:80:1e:12:82:d5 on man


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address	= 0x1c
fault code		= supervisor read, page not present
instruction pointer	= 0x20:0xc0504e87
stack pointer	        = 0x28:0xe69c1a84
frame pointer	        = 0x28:0xe69c1aa8
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 23 (em0_rx_kthread_1)
trap number		= 12
panic: page fault
cpuid = 0
Uptime: 14d9h0m26s
Cannot dump. No dump device defined.
Automatic reboot in 15 seconds - press a key on the console to abort
em0: discard frame w/o packet header
Copyright (c) 1992-2009 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 7.1-STABLE #0: Mon Mar  2 16:12:22 EET 2009
    [email]root@WaRHeaD.otel.net[/email]:/usr/tmp/nanobsd/langw-i386/usr/src/sys/LANGW-DL-I386-MP
Timecounter "i8254" frequency 1193182 Hz quality 0
[skip]
```


----------



## SirDice (Oct 26, 2009)

What filesystem do you use for /var? It that's a memory filesystem the data will obviously be lost when the server is rebooted.


----------



## tbyte (Oct 26, 2009)

/var is a memory FS and the dmesg data is NOT lost for some reason 
And I don't think /var has anything to do with that at all, why do You mentioned it ?


----------



## SirDice (Oct 26, 2009)

tbyte said:
			
		

> /var is a memory FS and the dmesg data is NOT lost for some reason
> And I don't think /var has anything to do with that at all, why do You mentioned it ?



Because dmesg output gets stored there:


```
root@molly:~#ll /var/log/dmesg.*
-rw-------  1 root  wheel  7537 Oct 24 03:06 /var/log/dmesg.today
-rw-------  1 root  wheel  7475 Oct 23 03:05 /var/log/dmesg.yesterday
```

The messages themselves are stored in a message buffer read from the current running kernel using a sysctl. A reboot obviously erases that data.

See dmesg(8).


----------



## tbyte (Oct 26, 2009)

SirDice said:
			
		

> Because dmesg output gets stored there:
> 
> 
> ```
> ...



Who is talking about the log files which are created at boot time by something like dmesg > /var/run/dmesg.boot and so on ?

I'm talking about the dmesg output, SO I'm talking about the kernel buffers which for some reason looks like IS NOT being erased . And please don't point me to this type of (user space) the manuals. I'm pretty familiar with the kernel and have a few patches which are in the freebsd kernel and it's somewhat offending


----------



## DutchDaemon (Oct 26, 2009)

Maybe you should put that in your signature, so people will not attempt to help you.


----------



## SirDice (Oct 26, 2009)

tbyte said:
			
		

> I'm pretty familiar with the kernel and have a few patches which are in the freebsd kernel and it's somewhat offending


Well, in all fairness, I can't see or smell that now can I? All I see is a user with 35 posts.


----------



## DutchDaemon (Oct 26, 2009)

This may help:

http://docs.freebsd.org/cgi/getmsg....2008/freebsd-hackers/20080224.freebsd-hackers

I think Oliver has a src commit bit, so he should be respectable.


----------



## tbyte (Oct 26, 2009)

DutchDaemon said:
			
		

> Maybe you should put that in your signature, so people will not attempt to help you.



Sorry It was not my intention to offend anybody. But I don't like to be pointed to manuals that i have read 11+ years ago when I installed my first freebsd. I probably overreacted. I expected an answer from somebody that actually have idea why the kernel can retain a it's messages buffer after the machine has been rebooted. And that's not the only machine I have seen that is doing it. It's happening at least from freebsd 5.0


----------



## DutchDaemon (Oct 26, 2009)

You have that answer now. Remember though: this is first and foremost a FreeBSD *user/admin* community, not a *developer/hacker* community. Really low-level questions should probably be posted on the developer/hacker mailing lists, rather than on these forums. Though, in a roundabout way, you got a pointer here anyway


----------



## tbyte (Oct 26, 2009)

DutchDaemon said:
			
		

> This may help:
> 
> http://docs.freebsd.org/cgi/getmsg....2008/freebsd-hackers/20080224.freebsd-hackers
> 
> I think Oliver has a src commit bit, so he should be respectable.



Hum that explains it. I thought the kernel clears the memory before using it. On the first glance it looks a bit insecure. But I may be wrong.


----------

