Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2012 19:25:13 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Doug Barton <dougb@freebsd.org>, Jilles Tjoelker <jilles@stack.nl>, freebsd-arch@freebsd.org
Subject:   Re: [patch] halt/reboot/shutdown cleanup
Message-ID:  <20120517183044.U970@besplex.bde.org>
In-Reply-To: <E610146B-7AC8-4795-A364-B1D8EE77EB9C@bsdimp.com>
References:  <20120513220646.GA12826@stack.nl> <CA766F13-E02E-4815-9AEE-984BC14F2CB9@bsdimp.com> <4FB0CF88.5010309@FreeBSD.org> <3D895644-0BA5-44F7-AC8F-07323729C1AA@bsdimp.com> <4FB40506.3000300@FreeBSD.org> <E610146B-7AC8-4795-A364-B1D8EE77EB9C@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 16 May 2012, Warner Losh wrote:

> On May 16, 2012, at 1:50 PM, Doug Barton wrote:

>> The problem is that people see the names "halt" and "reboot" and assume
>> that "simpler is better" and use them. The fact that the proper way to
>> reboot a FreeBSD system is 'shutdown -r' is ... just silly.
>
> Right, but this is the historical way things have been done, and there are many existing users who have products that depend on the difference.  So the argument for change needs to be stronger.

Right, they can't be renamed without breaking things.

Please use the unix newline character.

> I think a more proper argument could be made that the times have changed and that while it would be desirable to retain the old interface, it is more desirable to file off the rough edges from the crufty old interfaces to improve the user experience for the hordes that are coming from the Linux world.

Their bevaviour with the same options also can't be changed without
breaking things.

> Of course, if all reboot is going to do is call shutdown -r now, then maybe it makes sense to just install a shell script called reboot and rename the current reboot to fastreboot.

Quick, let's rename cp to COPY and del to DELETE.

> However, I think that we can get most of what is needed here by tightening up the shutdown -r path, and reinventing[*] fasthalt and fastreboot from SunOS 4.x days.  Then reboot/halt could easily be a simple shell script that invokes shutdown.  This would allow the embedded folks to replace it with fast*, while allowing the enterprise customers a more uniform experience with their linux and solaris systems.  And the tightening up would likely cause the developer community to not notice as much the difference, because the artificial delays have been removed.  Or to add to their .profile/.cshrc files something along the lines of alias reboot fastreboot.

Do you mean reinventing them from FreeBSD?  fastboot and fasthalt are
still standard in FreeBSD, but they have been reduced to hard links to
reboot.  They don't even change the action of reboot(8).  No one knows
about them of course (not even to the extent of noticing that they are
in reboot's man page), so reboot is used directly.

In FreeBSD-1 and 4.4BSD-Lite, they were shell scripts that copied
/dev/null to /fastboot and then invoked reboot and halt, respectively.
halt(8) has also been reduced to a hard link to reboot, but now it
changes the action of reboot.  It is misimplemented by making its
action depend on the program name but not providing an equivalent
option.

> [*] I say reinventing here because IIRC fastboot also suppressed the full fsck of filesystems when the system is coming back up.  with zfs, ufs + suj, the clean flag short-curcuit, etc that functionality is no longer all that useful._______________________________________________

In FreeBSD, the whole point of fastboot was to suppress fsck.  It was
otherwise equivalent to reboot (but never to shutdown).  Now it is
identical with reboot except for its name.  Its reason for existence
is no longer documented.  In 4.4BSD-Lite2, it was:

% FASTBOOT(8)             FreeBSD System Manager's Manual            FASTBOOT(8)
% 
% NAME
%      fastboot, fasthalt -- reboot/halt the system without checking the disks
% 
% SYNOPSIS
%      fastboot [boot-options]
%      fasthalt [halt-options]
% 
% DESCRIPTION
%      Fastboot and fasthalt are shell scripts which reboot and halt the system
%      without checking the file systems.  This is done by creating a file
%      /fastboot, then invoking the reboot program.  The system startup script,
%      /etc/rc, looks for this file and, if present, skips the normal invocation
%      of fsck(8).
% 
% SEE ALSO
%      halt(8), reboot(8), rc(8)

Hmm, shutdown isn't even mentioned.

% 
% HISTORY
%      The fastboot command appeared in 4.2BSD.

Much (?) older than SunOS.

% 
% 4.2 Berkeley Distribution        June 5, 1993        4.2 Berkeley Distribution

The old shutdown(8) references fastboot but not fasthalt.  shutdown -f
gave fasthalt (no longer supported) and shutdown -r gave reboot(8) (at the
specified type) (it now gives a more direct reboot at the specified time).

I now remember why fasthalt and fastboot went away.  dg added dirty
flag handling, so that a full fsck is not needed in the usual case of
a clean reboot, at least for ffs.  For a non-clean reboot, you shouldn't
tell fsck not to run even if you could, and most non-clearn reboots
are for panics which couldn't run fastboot anyway.

Bruce



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