Subject: single user mode file comparisons
To: None <current-users@netbsd.org>
From: William Allen Simpson <wsimpson@greendragon.com>
List: current-users
Date: 06/08/2003 18:14:07
There seems to be some agreement that files needed during single user 
mode should be in /bin and /sbin, and that other files should be in 
the /usr equivalents.  

There doesn't seem to be agreement on which files should be /bin versus 
/sbin, and there isn't any guidance in POSIX. 

There is some guidance in the "Filesystem Hierarchy Standard", for 
"UNIX-like operating systems", although somewhat Linux oriented.
  http://www.pathname.com/fhs/pub/fhs-2.2.pdf

  /bin contains commands that may be used by both the system administrator 
  and by users, but which are required when no other filesystems are 
  mounted (e.g. in single user mode). It may also contain commands which 
  are used indirectly by scripts. 

  Utilities used for system administration (and other root-only commands) 
  are stored in /sbin, ....  /sbin contains binaries essential for 
  booting, restoring, recovering, and/or repairing the system in addition 
  to the binaries in /bin.  Programs executed after /usr is known to be 
  mounted (when there are no problems) are generally placed into 
  /usr/sbin.... 

This FHS document lists specific required and optional files for each. 
There aren't many differences from NetBSD, so I'll not belabor them now. 
Mostly, they specify /bin instead of /sbin.

I laboriously hand checked the files in OpenBSD 3.2 against NetBSD 1.6T 
to get an idea what might have changed since the projects branched. 

I also checked the files against those in the new /rescue.  After all, 
something necessary to "rescue" the system is probably needed in 
single user mode!

===

These files are in /bin (OBSD) versus /usr/bin (NBSD): 
  chgrp
  eject
  md5
  rmd160
  sha1

Of these, chgrp is in /rescue, and required for /bin by FHS.  Arguably, 
eject might be important during system maintenance? 

===

These files are in /sbin (OBSD) versus /usr/sbin (NBSD): 
  chown
  iopctl
  mountd
  nfsd
  quotacheck

Of these, chown is in /rescue, and required for /bin by FHS.  Arguably iopctl and quotacheck might be important during system maintenance? 

===

One file seems to have moved from /sbin (OBSD) to /usr/bin (NBSD):
  mkfifo

Now, that's a bit of a surprise!  In NetBSD, never to be used by a 
system script, never used in single user mode.  Of course, I've no idea 
why it's restricted to administration in OpenBSD? 

===

There are many files that are in /rescue, but not in /bin or /sbin:
  bunzip2
  bzcat
  bzip2
  ftp
  gunzip
  gzcat
  gzip
  kdump
  ktrace
  ktruss
  ldd	
  zcat

Is there any rationale for how these were chosen?  It's not obvious 
why a "rescue" program wouldn't be used in single user mode.
-- 
William Allen Simpson
    Key fingerprint =  17 40 5E 67 15 6F 31 26  DD 0D B9 9B 6A 15 2C 32