bin/102515: fsck_ufs crashes if no console at all (in libc)

Nick Hibma nick at van-laarhoven.org
Fri Aug 25 20:10:22 UTC 2006


>Number:         102515
>Category:       bin
>Synopsis:       fsck_ufs crashes if no console at all (in libc)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 25 20:10:20 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Nick Hibma
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
AnyWi Technologies
>Environment:
System: FreeBSD hind.van-laarhoven.org 6.1-STABLE FreeBSD 6.1-STABLE #19: Thu Aug 17 16:31:39 CEST 2006 toor at hind.van-laarhoven.org:/usr/src/sys/i386/compile/HIND i386

Headless Soekris (no graphics hardware), without serial console:

	hint.sio.0.flags="0x00"

and all getty ttys (ttyd0 and ttyv?) switched off.

>Description:

fsck_ffs (fsck_ufs) crashes in libc in this configuration on boot. This
failure stops the boot process, and wants to drop you into a shell. But because
there is no console the /etc/rc script immediately resumes the boot process, but
this time as fastboot instead of autoboot, skipping the disk checks; and the
crash, but the disk doesn't get checked that way (is mounted read-only, so that
is not that big an issue).

This leads to a duplicated execution of memory disk creation in rc.initdiskless
which is my real problem: It wastes 14mb of my 64Mb of memory!

Backtrace:
#0  0x08054841 in ?? ()
#1  0x28150c98 in __gdtoa_locks () from /lib/libc.so.6
#2  0xbfbfedc0 in ?? ()
#3  0xbfbfe358 in ?? ()
#4  0x280b1ea3 in freopen () from /lib/libc.so.6
#5  0x08055108 in ?? ()
...
#215 0x00000000 in ?? ()
#216 0x2805f405 in dlsym () from /libexec/ld-elf.so.1
#217 0x0804eada in ?? ()
...
#223 0x09a6322b in ?? ()
#224 0x2809d7ba in ?? () from /lib/libc.so.6
#225 0x2807d598 in ?? ()
#226 0x28099b28 in ?? () from /lib/libc.so.6
#227 0x00000000 in ?? ()
#228 0xbfbfea38 in ?? ()
#229 0x2805f5e3 in dlinfo () from /libexec/ld-elf.so.1
#230 0x08049252 in ?? ()
...
#233 0xbfbfecdc in ?? ()
---Type <return> to continue, or q <return> to quit---
#234 0x00000010 in ?? ()
#235 0x080561d0 in __divdi3 ()
#236 0x00000003 in ?? ()

>How-To-Repeat:

# fsck -f / < /dev/console
** /dev/ad0s1a
fsck: /dev/ad0s1a: Floating point exception: 8
# fsck -f /
** /dev/ad0s1a
<<produces normal result which I did not capture>>

on a machine without a console (see above for how to reproduce). Image to test
this with can be generated if needed, or access to machine can be given.
(Read-only image mounted in multi-user mode, don't know whether ).
>Fix:

Several options:

A)
	Change statements calling fsck in /etc/rc.d/fsck from
		fsck -F -p
	to
		fsck -F -p </dev/null

	(perhaps in bgfsck too? I've disabled background fsck)

B)
	Have rc.initdiskless create the mdmfs only during autoboot, not during
	fastboot.

C)
	Fix libc to be able to cope with undefined file descriptors (or whatever
	it is that is crashing libc).

IMHO B and C should be done. A) is just mentioned to help people work around the
problem.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list