Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Nov 2000 13:42:10 -0800 (PST)
From:      Doug Ambrisko <ambrisko@whistle.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/23098: If installing on a serial console, enable getty on ttyd0.
Message-ID:  <200011252142.NAA40712@whistle.com>

next in thread | raw e-mail | index | archive | help

>Number:         23098
>Category:       bin
>Synopsis:       If installing on a serial console, enable getty on ttyd0.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 25 13:50:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Doug Ambrisko
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
Whistle
>Environment:


>Description:

If you do an install via the serial port, Sysinstall correctly updates 
loader.conf so the kernel messages come up on the console.  However,
it should also enable a getty on the serial port as well so you can
login to that port.  This patch does that by changing "off" to "on " 
for ttyd0.  Note I do not disable getty on ttyvX.  It's probably fairly
easy for the admin to just login as root on the serial port and
disable getty on ttyvX if by chance no display or keyboard device is 
available to address that issue.

This should make life a little easier for serial installations.

>How-To-Repeat:

>Fix:


Index: install.c
===================================================================
RCS file: /cvs/freebsd/src/release/sysinstall/install.c,v
retrieving revision 1.268.2.15
diff -c -r1.268.2.15 install.c
*** install.c	2000/10/31 21:33:23	1.268.2.15
--- install.c	2000/11/25 21:31:10
***************
*** 744,749 ****
--- 744,752 ----
      int i;
      FILE *fp;
      int kstat = 1;
+     FILE  *orig, *new;
+     char buf[1024];
+     char *pos;
  
      /* All of this is done only as init, just to be safe */
      if (RunningAsInit) {
***************
*** 780,787 ****
  			   "boot from the hard disk, I'm afraid!");
  		return DITEM_FAILURE;
  	    }
  	}
! 	
  	/* BOGON #1: Resurrect /dev after bin distribution screws it up */
  	dialog_clear_norefresh();
  	msgNotify("Remaking all devices.. Please wait!");
--- 783,815 ----
  			   "boot from the hard disk, I'm afraid!");
  		return DITEM_FAILURE;
  	    }
+ 
+ 	    /* Fixup /etc/ttys to start a getty on the serial port.
+ 	       This way after a serial installation you can login via
+ 	       the serial port */
+ 	       
+ 	    if (!OnVTY){
+ 	         if (((orig=fopen("/etc/ttys","r")) != NULL) &&
+ 		     ((new=fopen("/etc/ttys.tmp","w")) != NULL)) {
+ 		     while (fgets(buf,sizeof(buf),orig)){
+ 		         if (strstr(buf,"ttyd0")){
+ 		             if ((pos=strstr(buf,"off"))){
+ 			         *pos++='o';
+ 			         *pos++='n';
+ 			         *pos++=' ';
+ 			     }
+ 			 }
+ 			 fputs(buf,new);
+ 		     }
+ 		     fclose(orig);
+ 		     fclose(new);
+ 		     
+ 		     rename("/etc/ttys.tmp","/etc/ttys");
+ 		     unlink("/etc/ttys.tmp");
+ 		 }
+ 	    }
  	}
! 
  	/* BOGON #1: Resurrect /dev after bin distribution screws it up */
  	dialog_clear_norefresh();
  	msgNotify("Remaking all devices.. Please wait!");

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011252142.NAA40712>