NetBSD Problem Report #1374
From gnats Fri Aug 18 06:15:18 1995
Received: from cis-ts4-slip4.cis.brown.edu (root@cis-ts4-slip4.cis.brown.edu [128.148.19.75]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id GAA11931 for <gnats-bugs@gnats.netbsd.org>; Fri, 18 Aug 1995 06:15:14 -0400
Message-Id: <199508181015.GAA16741@cis-ts4-slip4.cis.brown.edu>
Date: Fri, 18 Aug 1995 06:15:35 -0400
From: Mark_Weaver@brown.edu
Reply-To: Mark_Weaver@brown.edu
To: gnats-bugs@gnats.netbsd.org
Subject: If single-user login fails, fscks aren't done
X-Send-Pr-Version: 3.2
>Number: 1374
>Category: bin
>Synopsis: If single-user login fails, fscks aren't done
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lukem
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Aug 18 06:20:01 +0000 1995
>Closed-Date: Mon Jun 25 21:01:08 +0000 2001
>Last-Modified: Mon Jun 25 21:01:08 +0000 2001
>Originator: Mark Weaver
>Release: 19950811
>Organization:
Brown University Department of Computer Science
>Environment:
NetBSD cis-ts4-slip4.cis.brown.edu 1.0A NetBSD 1.0A (WEAVER) #0: Fri Aug 11 19:26:06 EDT 1995 mhw@cis-ts4-slip9.cis.brown.edu:/usr/src/sys/arch/i386/compile/WEAVER i386
>Description:
Currently, if the console entry in /etc/ttys is not "secure" and
single-user login fails, the fscks are not done. Obviously this is
sub-optimal behavior.
>How-To-Repeat:
Make console insecure in /etc/ttys.
Start to enter single-user mode on boot, but just hit return at the
password prompt.
It will skip the fscks.
>Fix:
diff -c src/sbin/init/init.c.mhw1 src/sbin/init/init.c
*** src/sbin/init/init.c.mhw1 Tue May 30 08:35:25 1995
--- src/sbin/init/init.c Fri Aug 18 06:00:41 1995
***************
*** 94,99 ****
--- 94,110 ----
#define STALL_TIMEOUT 30 /* wait N secs after warning */
#define DEATH_WATCH 10 /* wait N secs for procs to die */
+ /*
+ * Exit status returned from signal-user shell to indicate that
+ * single-user login was not successful.
+ *
+ * XXX If the shell happens to return NOLOGIN_STATUS (eg, if the
+ * last command run also did), init will think it should run fsck,
+ * which could be bad if any volumes were mounted read-write during
+ * single-user.
+ */
+ #define NOLOGIN_STATUS 127
+
void handle __P((sig_t, ...));
void delset __P((sigset_t *, ...));
***************
*** 593,600 ****
write(2, banner, sizeof banner - 1);
for (;;) {
clear = getpass("Password:");
! if (clear == 0 || *clear == '\0')
! _exit(0);
password = crypt(clear, pp->pw_passwd);
memset(clear, 0, _PASSWORD_LEN);
if (strcmp(password, pp->pw_passwd) == 0)
--- 604,617 ----
write(2, banner, sizeof banner - 1);
for (;;) {
clear = getpass("Password:");
! if (clear == 0 || *clear == '\0') {
! /*
! * Since single-user login was not successful,
! * we tell init to run fsck by returning a
! * special exit status.
! */
! _exit(NOLOGIN_STATUS);
! }
password = crypt(clear, pp->pw_passwd);
memset(clear, 0, _PASSWORD_LEN);
if (strcmp(password, pp->pw_passwd) == 0)
***************
*** 690,697 ****
return (state_func_t) single_user;
}
}
- runcom_mode = FASTBOOT;
#ifndef LETS_GET_SMALL
return (state_func_t) runcom;
#else /* LETS_GET_SMALL */
--- 707,715 ----
return (state_func_t) single_user;
}
}
+ else if (WEXITSTATUS(status) != NOLOGIN_STATUS)
+ runcom_mode = FASTBOOT;
#ifndef LETS_GET_SMALL
return (state_func_t) runcom;
#else /* LETS_GET_SMALL */
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->lukem
Responsible-Changed-By: fair
Responsible-Changed-When: Thu Mar 22 06:22:39 PST 2001
Responsible-Changed-Why:
Luke has been working over our /etc/rc scripts of late, and is therefore
the logical person to look over this ancient problem report.
State-Changed-From-To: open->feedback
State-Changed-By: lukem
State-Changed-When: Mon Jun 25 13:54:24 PDT 2001
State-Changed-Why:
I've recently changed fsck so that it skips partitions mounted read-write,
and the rc.d/fsck script to always run "fsck -p" (except when /fastboot
exists), so this problem shouldn't be an issue any more.
I considered your patch, except that it requires a bit more work because
it doesn't cater for setting "autoboot" in the case when you're going from
single user mode to multi user mode after 'shutdown now'.
Are you happy to close the PR now that the actual problem appears to be
solved, or would you still rather init(8) be modified to set "autoboot"
when going from single -> multi-user when the "root passwd on insecure
terminal" prompt is skipped with ^D ?
Luke
State-Changed-From-To: feedback->closed
State-Changed-By: lukem
State-Changed-When: Mon Jun 25 14:00:48 PDT 2001
State-Changed-Why:
Feedback to submitter bounced.
Problem solved in my opinion anyway.
>Unformatted:
(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.