NetBSD Problem Report #10481

Received: (qmail 7615 invoked from network); 29 Jun 2000 23:10:43 -0000
Message-Id: <200006292310.RAA02055@biology.nmsu.edu>
Date: Thu, 29 Jun 2000 17:10:42 -0600 (MDT)
From: Brook Milligan <brook@biology.nmsu.edu>
Reply-To: brook@biology.nmsu.edu
To: gnats-bugs@gnats.netbsd.org
Subject: prevent rebooting on halt when no keyboard is in the kernel
X-Send-Pr-Version: 3.95

>Number:         10481
>Category:       kern
>Synopsis:       halt(8) causes a reboot when no keyboard device is configured in the kernel
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ross
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 29 23:11:00 +0000 2000
>Closed-Date:    Fri Apr 04 05:53:27 +0000 2003
>Last-Modified:  Fri Apr 04 05:53:27 +0000 2003
>Originator:     Brook Milligan
>Release:        NetBSD/i386 1.4.2
>Organization:
Brook G. Milligan                      Internet:  brook@nmsu.edu
Department of Biology
New Mexico State University            Telephone:  (505) 646-7980
Las Cruces, New Mexico  88003  U.S.A.  FAX:        (505) 646-5665
>Environment:

System: NetBSD biology.nmsu.edu 1.4 NetBSD 1.4 (BIOLOGY) #0: Tue Nov 23 11:51:18 MST 1999 root@biology.nmsu.edu:/usr/src/sys/arch/i386/compile/BIOLOGY i386


>Description:
	the halt command will lead to rebooting when the kernel has no
	keyboard devices configured.  This occurs because under those
	conditions executation falls through the cngetc() call in the
	following code fragment (from arch/i386/i386/machdep.c):

	if (howto & RB_HALT) {
		printf("\n");
		printf("The operating system has halted.\n");
		printf("Please press any key to reboot.\n\n");
		cnpollc(1);	/* for proper keyboard command handling */
		cngetc();
		cnpollc(0);
	}

>How-To-Repeat:
	System configuration:  server-type system with no keyboard attached
	Kernel config:  no keyboard devices configured

	issue halt command and watch the machine reboot

>Fix:
	Apply the following patch to arch/i386/i386/machdep.c:

--- machdep.c.orig      Fri Feb  4 16:09:35 2000
+++ machdep.c   Thu May 25 12:44:36 2000
@@ -1375,10 +1375,15 @@
        if (howto & RB_HALT) {
                printf("\n");
                printf("The operating system has halted.\n");
+#if (NPC > 0) && (NPCCONSKBD > 0)
                printf("Please press any key to reboot.\n\n");
                cnpollc(1);     /* for proper keyboard command handling */
                cngetc();
                cnpollc(0);
+#else
+               for(;;) ;
+               /* NOT REACHED */
+#endif
        }

        printf("rebooting...\n");
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: ross 
State-Changed-When: Thu Feb 13 13:34:18 PST 2003 
State-Changed-Why:  
bug fixed (tho the hit-any-key message is always output) 
i didn't use the original patch, since there are several types of keyboards 
these days 


Responsible-Changed-From-To: kern-bug-people->ross 
Responsible-Changed-By: ross 
Responsible-Changed-When: Thu Feb 13 13:34:18 PST 2003 
Responsible-Changed-Why:  
fix commited 
State-Changed-From-To: feedback->closed 
State-Changed-By: perry 
State-Changed-When: Thu Apr 3 21:51:56 PST 2003 
State-Changed-Why:  
Ross fixed the problem six weeks ago and there has been no further 
discussion. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.