Bug 45947

Summary: init does not invoke getty
Product: Base System Reporter: Sergey Amelyuschenko <adminu5>
Component: alphaAssignee: freebsd-alpha (Nobody) <alpha>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.7-STABLE   
Hardware: Any   
OS: Any   

Description Sergey Amelyuschenko 2002-12-03 01:30:01 UTC
  About one month ago after usual 
  buildworld/buildkernel/installkernel/installworld/mergemaster procedure I
  have noticed strange thing - getty proccess was gone. Basically, /sbin/init
  is running, /etc/ttys is the same as last version in cvs repository:
  http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/etc.alpha/ttys?rev=1.10
  but getty is not invoked by init anymore!
  Of course there are no local consoles and the only way to log in to the 
  system is through ssh.
  I thought this was a temporary glitch, but this problem was not fixed by
  rebuilding the system 2 weeks later. Then I tried to rebuild yesterday
  (12/02/02) - problem is still here :-(

Fix: 

Not known.
How-To-Repeat:   cvsup to stable and rebuild an alpha system.
Comment 1 Andrew Gallatin 2002-12-03 22:03:08 UTC
Sergey Amelyuschenko writes:
 > >Description:
 >   About one month ago after usual 
 >   buildworld/buildkernel/installkernel/installworld/mergemaster procedure I
 >   have noticed strange thing - getty proccess was gone. Basically, /sbin/init
 >   is running, /etc/ttys is the same as last version in cvs repository:
 >   http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/etc.alpha/ttys?rev=1.10
 >   but getty is not invoked by init anymore!
 >   Of course there are no local consoles and the only way to log in to the 
 >   system is through ssh.
 >   I thought this was a temporary glitch, but this problem was not fixed by
 >   rebuilding the system 2 weeks later. Then I tried to rebuild yesterday
 >   (12/02/02) - problem is still here :-(
 > 		      
 > >How-To-Repeat:
 >   cvsup to stable and rebuild an alpha system.

I updated my alpha to todays -stable to check on your problem and, I'm
sorry, but I do not see it:

FreeBSD/alpha (monet) (ttyd0)

login: gallatin
Password:
<...>
% tty
/dev/ttyd0

Monet is an xp1000 with a serial console.  Are you using serial or
graphics console?

Can you please provide us with a dmesg and your kernel config file?

Thanks,

Drew

I brought my DS10 with serial console to the latest -stable. I cannot 
reproduce the problem either. getty's are alive and well, I left it
sitting there for a day without issues.
Comment 2 Sergey Amelyuschenko 2002-12-06 09:04:27 UTC
Hi Drew!

> What happens if you do this (as root) after editing /etc/ttys
> to enable a new getty: (eg, edit ttys, disable ttyv6, save, kill -HUP 1,
> edit ttys, enable ttyv6, then run the following):
>
> # ktrace -di -p 1 ; kill -HUP 1 ; sleep 0.5 ; ktrace -C
> # kdump | less
>
> Do you see it reading /etc/ttys? Should look like this (trace taken on
> an x86, but it should be identical on an alpha)
>
>      1 init     PSIG  SIGHUP caught handler=0x8049708 mask=0x9e7c9054
> code=0xffffffff
>      1 init     RET   wait4 -1 errno 4 Interrupted system call
>      1 init     CALL  sigreturn(0xbfbffb6c)
>      1 init     RET   sigreturn JUSTRETURN
>
>      1 init     CALL  open(0x808318b,0,0x1b6)
>      1 init     NAMI  "/etc/ttys"
>      1 init     RET   open 0
> <...>
> should see a fork and a getty trying to start..
>
> It would be interesting to see if it does not find the file, or
> if it can't open the tty, or if it just ignores HUP, or what.
> That could help narrow down the problem quite a bit.

  It is much worse - it does not even try to open /etc/ttys :-(
I run this sequence "ktrace -di -p 1 ; kill -HUP 1 ; sleep 0.5 ; ktrace -C"
after editing /etc/ttys on both alpha and i386. Here is the result:

alpha# kdump | grep init
     1 init     PSIG  SIGHUP caught handler=0x120002780 mask=0x9e7c9054
code=0xffffffff
     1 init     RET   wait4 -1 errno 4 Interrupted system call
     1 init     CALL  sigreturn(0x11ffb8c8)
     1 init     RET   sigreturn JUSTRETURN
     1 init     CALL  wait4(0xffffffffffffffff,0x11ffbc70,0x2,0)


i386# kdump | grep init
     1 init     PSIG  SIGHUP caught handler=0x8049728 mask=0x9e7c9054
code=0xffffffff
     1 init     RET   wait4 -1 errno 4 Interrupted system call
     1 init     CALL  sigreturn(0xbfbffb70)
     1 init     RET   sigreturn JUSTRETURN
     1 init     CALL  open(0x8083d8b,0,0x1b6)
     1 init     NAMI  "/etc/ttys"
     1 init     RET   open 0
     1 init     CALL  fstat(0,0xbfbffbf0)
     1 init     RET   fstat 0
     1 init     CALL  read(0,0x80b2000,0x4000)
     1 init     GIO   fd 0 read 7470 bytes
        # type The initial terminal type for this port.  For hardwired
        # status Must be on or off.  If on, init will run the getty program on
        # If console is marked "insecure", then init will ask for the root pas\
     1 init     RET   read 7470/0x1d2e
     1 init     CALL  open(0x80b10f0,0x4,0)
     1 init     NAMI  "/dev/ttyv6"
     1 init     RET   open 2
     1 init     CALL  close(0x2)
     1 init     RET   close 0
     1 init     CALL  gettimeofday(0xbfbff048,0)
     1 init     RET   gettimeofday 0
     1 init     CALL  sendto(0x1,0xbfbff4e0,0x48,0,0,0)
     1 init     GIO   fd 1 wrote 72 bytes

Just for the sake of other bugbusters there are some facts:

Oddly enough, I was able to get console prompt by logging in through ssh and
running
/usr/libexec/getty Pc /dev/ttyv0 &
i.e. it works when invoked by hand, but does not get invoked automatically by
/sbin/init.
I rebiult my system on 11/15/02 and 12/02/02 -stable, but that didn't change
anything.
I track -stable on my alpha starting from 4.2-RELEASE and never seen anything
like that.

This is dmesg:

Rebooting...
Copyright (c) 1992-2002 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 4.7-STABLE #7: Tue Dec  3 15:49:15 IRKT 2002
    <email is stripped>ST6600
AlphaServer DS20 500 MHz, 500MHz
8192 byte page size, 1 processor.
CPU: EV6 (21264) major=8 minor=4 extensions=0x303<BWX,FIX,MVI,PRECISE>
OSF PAL rev: 0x2004500020157
real memory  = 2144681984 (2094416K bytes)
avail memory = 2084904960 (2036040K bytes)
Preloaded elf kernel "kernel" at 0xfffffc0000644000.
md0: Malloc disk
pcib0: <21271 PCI host bus adapter> on tsunami0
pci0: <PCI bus> on pcib0
isab0: <Cypress 82C693 PCI-ISA bridge> at device 5.0 on pci0
isa0: <ISA bus> on isab0
pci0: <Cypress 82C693 ATA controller> at 5.1 irq 238
pci0: <Cypress 82C693 ATA controller> at 5.2 irq 239
pci0: <Cypress 82C693 ATA controller> at 5.3 irq 234
pcib2: <DEC 21152 PCI-PCI bridge> at device 7.0 on pci0
pci2: <PCI bus> on pcib2
sym0: <875> port 0x10000-0x100ff mem 0x2060000-0x2060fff,0x2062000-0x20620ff irq
 31 at device 0.0 on pci2
sym0: Symbios NVRAM, ID 7, Fast-20, SE, parity checking
sym0: open drain IRQ line driver, using on-chip SRAM
sym0: using LOAD/STORE-based firmware.
sym0: interrupting at TSUNAMI irq 31
sym1: <875> port 0x10100-0x101ff mem 0x2061000-0x2061fff,0x2062100-0x20621ff irq
 30 at device 1.0 on pci2
sym1: Symbios NVRAM, ID 7, Fast-20, SE, parity checking
sym1: open drain IRQ line driver, using on-chip SRAM
sym1: using LOAD/STORE-based firmware.
sym1: interrupting at TSUNAMI irq 30
pci2: <unknown card> (vendor=0x1011, dev=0x0009) at 2.0 irq 29
pci0: <VGA-compatible display device> at 8.0 irq 27
isp0: <Qlogic ISP 1020/1040 PCI SCSI Adapter> port 0x1000-0x10ff mem 0x2151000-0
x2151fff irq 23 at device 9.0 on pci0
isp0: interrupting at TSUNAMI irq 23
pcib1: <21271 PCI host bus adapter> on tsunami0
pci1: <PCI bus> on pcib1
xl0: <3Com 3c905B-TX Fast Etherlink XL> port 0x80010000-0x8001007f mem 0x8106000
0-0x8106007f irq 47 at device 7.0 on pci1
xl0: interrupting at TSUNAMI irq 47
xl0: Ethernet address: 00:50:04:ea:7a:64
miibus0: <MII bus> on xl0
ukphy0: <Generic IEEE 802.3u media interface> on miibus0
ukphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
gx0: <Intel Gigabit Ethernet (82543GC-T)> mem 0x81040000-0x8104ffff,0x81020000-0
x8103ffff irq 43 at device 8.0 on pci1
gx0: interrupting at TSUNAMI irq 43
gx0: Ethernet address: 00:02:a5:40:d7:56
e1000phy0: <Marvell Semiconductor 88E1000* gigabit PHY> on miibus1
e1000phy0:  1000baseTX-FDX, 100baseTX-FDX, 100baseTX, 10baseTX-FDX, 10baseTX, au
to
fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
fdc0: interrupting at ISA irq 6
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
atkbd0: interrupting at ISA irq 1
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: interrupting at ISA irq 12
psm0: model IntelliMouse Explorer, device ID 4
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> on isa0
sc0: VGA <16 virtual consoles, flags=0x200>
mcclock0: <MC146818A real time clock> at port 0x70-0x71 on isa0
sio0 at port 0x3f8-0x3ff irq 4 on isa0
sio0: type 16550A
sio0: interrupting at ISA irq 4
sio1: reserved for low-level i/o
ppc0: <Parallel port> at port 0x3bc-0x3bf irq 7 on isa0
ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode
lpt0: <Printer> on ppbus0
lpt0: Polled port
ppi0: <Parallel I/O> on ppbus0
ppc0: interrupting at ISA irq 7
Timecounter "alpha"  frequency 499881513 Hz
DUMMYNET initialized (011031)
IP packet filtering initialized, divert enabled, rule-based forwarding enabled,
default to accept, logging limited to 100 packets/entry by default
Waiting 10 seconds for SCSI devices to settle
(noperiph:sym0:0:-1:-1): SCSI BUS reset delivered.
(noperiph:sym1:0:-1:-1): SCSI BUS reset delivered.
da1 at isp0 bus 0 target 0 lun 0
da1: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da1: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da1: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da2 at isp0 bus 0 target 1 lun 0
da2: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da2: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da2: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da0 at sym0 bus 0 target 0 lun 0
da0: <COMPAQ BB00911CA0 3B05> Fixed Direct Access SCSI-2 device
da0: 40.000MB/s transfers (20.000MHz, offset 15, 16bit), Tagged Queueing Enabled
da0: 8678MB (17773524 512 byte sectors: 255H 63S/T 1106C)
da3 at isp0 bus 0 target 2 lun 0
da3: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da3: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da3: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da4 at isp0 bus 0 target 3 lun 0
da4: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da4: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da4: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da5 at isp0 bus 0 target 4 lun 0
da5: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da5: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da5: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da6 at isp0 bus 0 target 5 lun 0
da6: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da6: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da6: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da7 at isp0 bus 0 target 6 lun 0
da7: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da7: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da7: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da8 at isp0 bus 0 target 7 lun 0
da8: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da8: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da8: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da9 at isp0 bus 0 target 9 lun 0
da9: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da9: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da9: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da10 at isp0 bus 0 target 10 lun 0
da10: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da10: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da10: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da11 at isp0 bus 0 target 11 lun 0
da11: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da11: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da11: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da12 at isp0 bus 0 target 12 lun 0
da12: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da12: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da12: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da13 at isp0 bus 0 target 13 lun 0
da13: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da13: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da13: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da14 at isp0 bus 0 target 14 lun 0
da14: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da14: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da14: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
da15 at isp0 bus 0 target 15 lun 0
da15: <DEC HSZ22    (C) DEC d11x> Fixed Direct Access SCSI-2 device
da15: 40.000MB/s transfers (20.000MHz, offset 8, 16bit), Tagged Queueing Enabled
da15: 34720MB (71106560 512 byte sectors: 255H 63S/T 4426C)
cd0 at sym0 bus 0 target 5 lun 0
cd0: <DEC RRD47   (C) DEC 1206> Removable CD-ROM SCSI-2 device
cd0: 10.000MB/s transfers (10.000MHz, offset 16)
cd0: Attempt to query device size failed: NOT READY, Medium not present
Mounting root from ufs:/dev/da1a

kernel config:

machine         alpha
cpu             EV5
ident           ALPHA

maxusers        512
options         DEC_ST6600              # XP1000, DP264, DS20, DS10, family
options         INET                    #InterNETworking
options         FFS                     #Berkeley Fast Filesystem
options         FFS_ROOT                #FFS usable as root device [keep this!]
options         SOFTUPDATES             #Enable FFS soft updates support
options         UFS_DIRHASH             #Improve performance on big directories
options         MFS                     #Memory Filesystem
options         MD_ROOT                 #MD is a potential root device
options         NFS                     #Network Filesystem
options         NFS_ROOT                #NFS usable as root device
options         MSDOSFS                 #MSDOS Filesystem
options         CD9660                  #ISO 9660 Filesystem
options         CD9660_ROOT             #CD-ROM usable as root device
options         PROCFS                  #Process filesystem
options         COMPAT_43               #Compatible with BSD 4.3 [KEEP THIS!]
options         SCSI_DELAY=10000        #Delay (in ms) before probing SCSI
options         UCONSOLE                #Allow users to grab the console
options         KTRACE                  #ktrace(1) syscall trace support
options         SYSVSHM                 #SYSV-style shared memory
options         SYSVMSG                 #SYSV-style message queues
options         SYSVSEM                 #SYSV-style semaphores
options         P1003_1B                #Posix P1003_1B real-time extentions
options         _KPOSIX_PRIORITY_SCHEDULING
options         ICMP_BANDLIM            #Rate limit bad replies
device          isa
device          pci
device          fdc0    at isa? port IO_FD1 irq 6 drq 2
device          fd0     at fdc0 drive 0
device          isp             # Qlogic family
device          sym             # NCR/Symbios Logic (newer chipsets)
device          scbus           # SCSI bus (required)
device          da              # Direct Access (disks)
device          sa              # Sequential Access (tape etc)
device          cd              # CD
device          pass            # Passthrough device (direct SCSI access)
device          atkbdc0 at isa? port IO_KBD
device          atkbd0  at atkbdc? irq 1
device          psm0    at atkbdc? irq 12
device          vga0    at isa?
pseudo-device   splash
device          sc0     at isa?
device          mcclock0 at isa? port 0x70
device          sio0    at isa? port IO_COM1 irq 4
device          sio1    at isa? port IO_COM2 irq 3 flags 0x50
device          ppc0    at isa? irq 7
device          ppbus           # Parallel port bus (required)
device          lpt             # Printer
device          ppi             # Parallel port interface device
device          miibus          # MII bus support
device          gx              # Intel Gigabit Ethernet Card
device          xl              # 3Com 3c90x (``Boomerang'', ``Cyclone'')
pseudo-device   loop            # Network loopback
pseudo-device   ether           # Ethernet support
pseudo-device   tun             # Packet tunnel.
pseudo-device   pty             # Pseudo-ttys (telnet etc)
pseudo-device   md              # Memory "disks"
pseudo-device   bpf     6       #Berkeley packet filter
options         IPFIREWALL                      # Firewall
options         IPFIREWALL_VERBOSE              # Print information about
dropped packets
options         IPFIREWALL_FORWARD              # Enable transparent proxy
support
options         IPFIREWALL_VERBOSE_LIMIT=100    # Limit verbosity
options         IPFIREWALL_DEFAULT_TO_ACCEPT    # Allow everything by default
options         IPDIVERT        # divert sockets (NAT support)
options         DUMMYNET        # bandwidth and latency ipfw support
options         HZ=1000         # ipfw delay granularity time will be 1 ms
options         ACCEPT_FILTER_HTTP # Apache will work faster with these setting
options         ACCEPT_FILTER_DATA
options         NMBCLUSTERS=10000  # Increase number of network buffers
pseudo-device   vn      4       # Enable support for mounting .iso

Sergey
Comment 3 Sergey Amelyuschenko 2002-12-10 09:11:49 UTC
Hi Drew!

> Hmm..
> 
> 2 ideas:
> 
> 1) Perhaps it still thinks that its running a startup script and has not
> made it fully multi-user.  Have you installed or upgraded any ports
> recently?  something in /usr/local/etc/rc.d/foo.sh started so that it
> does not go into the background might block init.
> 
> 
> 2) init has gone totally insane.  I'd stick some printfs
> in transition_handler(), and in multi_user(), and in clean_ttys().
> So as to try to see what's happening when the signal is delivered.
Wow! You are incredible! Your first idea was right!
I had /usr/local/etc/rc.d/mysql-server.sh script hanging around from old version of mysql. This script did not go into the background during boot. Now I have upgraded mysql-server.sh and everything works as expected!
Anyway, this experience raises the question of reliability of boot process. That is, by fooling around with /usr/local/etc/rc.d it is possible to prevent init from going multiuser. Is it possible to implement some anti-foot-shooting technique? I mean if script was not started in some timeframe just kill it and go on to the next one?
Thanks again for your help!

Sergey
Comment 4 Andrew Gallatin freebsd_committer freebsd_triage 2002-12-10 13:48:00 UTC
State Changed
From-To: open->closed

It turns out that init is fine.  The problem was that a locally 
installed script in /usr/local/etc/rc.d  was not running into the forground, 
therby prevening init from going fully multi-user.