From jthomason@netscaler.com  Fri Nov 14 17:07:58 2003
Return-Path: <jthomason@netscaler.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4E24F16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 14 Nov 2003 17:07:58 -0800 (PST)
Received: from backup.netscaler.com (backup.netscaler.com [64.56.204.108])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 9611D43FCB
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 14 Nov 2003 17:07:57 -0800 (PST)
	(envelope-from jthomason@netscaler.com)
Received: from mailsc.engineering.netscaler.com ([65.219.20.7])
	by backup.netscaler.com (8.11.1/8.9.3) with SMTP id hAF1SL037474
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 14 Nov 2003 17:28:21 -0800 (PST)
Message-Id: <BC074362778E4E4F9A15C4E5E0AA222E3B207D@mailsc.engineering.netscaler.com>
Date: Fri, 14 Nov 2003 17:06:21 -0800
From: "James Thomason" <jthomason@netscaler.com>
To: <FreeBSD-gnats-submit@freebsd.org>
Subject: Serial Line Noise Causes System Hang in Loader on Reboot

>Number:         59296
>Category:       kern
>Synopsis:       Serial Line Noise Causes System Hang in Loader on Reboot
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 14 17:10:11 PST 2003
>Closed-Date:    Thu Mar 22 06:57:18 GMT 2007
>Last-Modified:  Thu Mar 22 06:57:18 GMT 2007
>Originator:     James Thomason
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Netscaler, Inc
>Environment:

System: FreeBSD acara.netscaler.com 4.9-STABLE FreeBSD 4.9-STABLE #11:
Fri Nov 14 13:52:29 GMT 2003 root@:/usr/obj/usr
/src/sys/GENERIC i386


>Description:

FreeBSD boxes in datacenter environments are often connected to serial
console servers=20
for disaster recovery.  When the current loader(8) with autoboot enabled
gets '\r' or '\n' =20
from the terminal it proceeds immediately with system boot, while any
other character is
interpreted as an escape sequence for kernel configuration.  This causes
some systems to hang
on reboot waiting for user input, likely due to line noise on the serial
port.

>How-To-Repeat:

Reboot with line noise.=20

>Fix:

Make escape sequence a break, such as in the patch below, and therefore
less likely to occur
with noisy serial links.

--- boot.c.orig	Fri Nov 14 16:55:37 2003
+++ boot.c	Fri Nov 14 17:04:36 2003
@@ -187,14 +187,20 @@
     yes =3D 0;
=20
     /* XXX could try to work out what we might boot */
-    printf("%s\n", (prompt =3D=3D NULL) ? "Hit [Enter] to boot =
immediately,
or any other key for command prompt." : prompt);
+    printf("%s\n", (prompt =3D=3D NULL) ? "Press [CTRL-C] for command
prompt, or any other key to boot immediately." : prompt);
=20
     for (;;) {
 	if (ischar()) {
 	    c =3D getchar();
-	    if ((c =3D=3D '\r') || (c =3D=3D '\n'))
+	    if (c !=3D '\003')
+            {
 		yes =3D 1;
-	    break;
+		break;
+            }
+	    else
+	    {
+		break;
+	    }
 	}
 	ntime =3D time(NULL);
 	if (ntime >=3D when) {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Thu Mar 22 06:55:35 UTC 2007 
State-Changed-Why:  
The attached patch is not desirable imo, it had been a long time 
where these options were implemented and this became the defacto 
standard imo. We cannot prevent serial line noise, try to make 
sure the line is noise free (I dont have this issue with serial 
connections). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59296 
>Unformatted:
