Bug 21904

Summary: [MFC] [PATCH] Fix for diskless startup bug in /etc/rc
Product: Base System Reporter: anton <anton>
Component: miscAssignee: Doug Barton <dougb>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description anton 2000-10-11 06:10:01 UTC
	/etc/rc checks $1 against "autoboot" after it runs /etc/rc.diskless1.
	But as the latter uses "set" command, it clears the command line, and
	so /etc/rc fails to check for autoboot mode, so it doesn't run fsck,
	and so fails to mount local filesystems (/tmp in my case).

How-To-Repeat: 
	Ensure you have /etc/rc.diskless* on the file server, boot
	FreeBSD 4.1-STABLE remotely from this server, and specify some
	locally mounted filesystems in /etc/fstab (ensure you have "1" in
	the 6th column for these filesystems. Then do a "dirty" reboot
	of the remote-booting machine (with reset button), and watch the
	booting process: instead of running fsck it prints "Skipping disk
	checks...", and then fails to mount local filesystems because they
	are still not clean.
Comment 1 DougB 2000-10-11 06:31:04 UTC
anton@urc.ac.ru wrote:

> 
> --- rc.old      Fri Sep  8 12:16:20 2000
> +++ rc  Wed Oct 11 10:34:09 2000
> @@ -20,6 +20,7 @@
>  trap : 2
>  trap : 3       # shouldn't be needed
> 
> +bootmode=$1
>  HOME=/
>  PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
>  export HOME PATH
> @@ -57,7 +58,7 @@
> 
>  swapon -a
> 
> -case $1 in
> +case ${bootmode} in
>  autoboot)
>         echo Automatic boot in progress...
>         fsck -p

	The patch seems reasonable. For style reasons I'd add a newline after
the assignment line, otherwise it seems fine. Good detective work.

Doug
Comment 2 dirk freebsd_committer freebsd_triage 2000-11-09 11:49:34 UTC
Responsible Changed
From-To: freebsd-bugs->dougb

Doug seems to be interested in this and became a committer meanwhile. 8-)
Comment 3 Doug Barton freebsd_committer freebsd_triage 2000-11-21 04:26:01 UTC
State Changed
From-To: open->analyzed


I've committed this to -current, will MFC after a 
respectable time period for feedback.
Comment 4 Doug Barton freebsd_committer freebsd_triage 2000-12-16 07:04:02 UTC
State Changed
From-To: analyzed->closed


The patch has been committed to -current and RELENG_4. In my opinion it's 
not appropriate for RELENG_3, but I have no objections if another 
committer wants to take it on.