Subject: bin/7656: run kvm_mkdb at boot to fix dmesg error
To: None <gnats-bugs@gnats.netbsd.org>
From: Darren Reed <darrenr@merlin.reed.wattle.id.au>
List: netbsd-bugs
Date: 05/27/1999 12:55:29
>Number:         7656
>Category:       bin
>Synopsis:       use sysctl machdep.booted_kernel, where available with kvm_mkdb
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu May 27 12:50:07 1999
>Last-Modified:
>Originator:     Darren Reed
>Organization:
>Release:        NetBSD-1.4
>Environment:
	
System: NetBSD merlin.reed.wattle.id.au 1.4 NetBSD 1.4 (MERLIN) #3: Sun May 23 19:58:14 EST 1999 darrenr@merlin.reed.wattle.id.au:/usr/src/sys/arch/arm32/compile/MERLIN arm32


>Description:
	When booting NetBSD with a new kernel, dmesg and other programs
which use the kvm db fail.  To resolve this problem, I propose using
sysctl (where applicable) to help kvm_mkdb to rebuilt the database
correctly.
>How-To-Repeat:
	Put a new kernel in /, reboot with it and run dmesg.
>Fix:
	The patch below runs kvm_mkdb against the correct kernel if it
can get the name from sysctl.

*** rc.dist	Fri May 28 05:23:24 1999
--- rc	Fri May 28 05:23:14 1999
***************
*** 143,148 ****
--- 143,152 ----
  
  # get the system dmesg output, hopefully containing the boot messages
  # $dmesg_flags is imported from /etc/rc.conf
+ sysctl machdep | grep -q booted_kernel
+ if [ $? -eq 0 ] ; then
+ 	kvm_mkdb `sysctl -n machdep.booted_kernel`
+ fi
  if checkyesno dmesg; then
  	dmesg $dmesg_flags > /var/run/dmesg.boot
  fi
>Audit-Trail:
>Unformatted: