Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Nov 2011 13:39:19 +0100
From:      Ed Schouten <ed@80386.nl>
To:        arch@FreeBSD.org
Subject:   The strangeness called `sbin'
Message-ID:  <20111110123919.GF2164@hoeg.nl>

next in thread | raw e-mail | index | archive | help

--m972NQjnE83KvVa/
Content-Type: multipart/mixed; boundary="GV0iVqYguTV4Q9ER"
Content-Disposition: inline


--GV0iVqYguTV4Q9ER
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi all,

I suspect this email could be one of the last emails I'm sending before
one of you hire an assassin to get rid of me, but here it goes.

A couple of days ago someone on IRC pointed me to the following
discussion that is taking place at Fedora right now:

	http://thread.gmane.org/gmane.linux.redhat.fedora.devel/155511/focus%3D155=
792

Even though I tend to disagree with Lennart's opinions here and there,
especially on point (h), where he explains there's no advantage of
decomposing the system into a separate / and /usr, I do agree with the
fact that `sbin' is a pretty weird thing.

Nowadays the rule of thumb behind `sbin' is that it contains
applications that are normally only needed by system administrators, but
there are many tools in FreeBSD that contradict this rule:

- md5(1) should be placed in /bin or /usr/bin, while it is stored in
  /sbin. It even has a man page in category 1. Very odd.
- last(1) and w(1) are placed in /usr/bin, while lastlogin(8) and ac(8)
  are placed in /usr/sbin.
- Tools like sysctl(8) and ifconfig(8) are usable by non-root users.
- ...

Now that we're (hopefully) heading into an era where permissions in the
operating systems become more fine-grained, the distinction between bin
and sbin will become even more vague.

Similar to the entire bin <-> sbin thing, I think /usr/games is also a
bit nonsensical, because the games -- including the fortune(6) database
-- only account for about 3.4 MB and FreeBSD 9 will ship with a clang(1)
binary that is a factor 8 or so larger. If people really want to get rid
of the games, they'd be better off running `make delete-old
WITHOUT_GAMES=3D' in /usr/src after the installation.

My proposal is as follows:

- Move everything in /sbin to /bin and turn it into a symbolic link
  pointing to /bin.
- Move everything in /usr/sbin to /usr/bin and turn it into a symbolic
  link pointing to /usr/bin.
- Move everything in /usr/games to /usr/bin and turn it into a symbolic
  link pointing to /usr/bin.

Just as a test, I wrote a patch that does exactly this. I've attached it
to this email. It would be dangerous to perform such a migration without
any form of approval from the user, the user must perform the migration
manually, using the commands supplied in /usr/src/UPDATING. I have added
an `installcheck' target that prevents a user from running `make
installworld' without performing the migration first.

Do note that this patch makes no attempt to get rid of any other
references to `sbin' in the source tree. In fact, we've got all the time
in the world to get this sorted out, as long as we leave the symlinks in
place.  In fact, I guess we'll never get rid of them anyway, because
almost all pieces of software hardcode strings like
`/usr/sbin/sendmail'.

Well, I think that's all I have to say. I guess I should hide in my
underground lair for now.

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--GV0iVqYguTV4Q9ER
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="nuke-sbin.diff"
Content-Transfer-Encoding: quoted-printable

Index: games/Makefile.inc
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- games/Makefile.inc	(revision 227417)
+++ games/Makefile.inc	(working copy)
@@ -1,7 +1,7 @@
 #	@(#)Makefile.inc	8.1 (Berkeley) 5/31/93
 # $FreeBSD$
=20
-BINDIR?=3D	/usr/games
+BINDIR?=3D	/usr/bin
 FILESDIR?=3D	${SHAREDIR}/games
 WARNS?=3D		6
 DISTRIBUTION?=3D	games
Index: usr.sbin/Makefile.inc
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- usr.sbin/Makefile.inc	(revision 227417)
+++ usr.sbin/Makefile.inc	(working copy)
@@ -1,6 +1,6 @@
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/6/93
 # $FreeBSD$
=20
-BINDIR?=3D	/usr/sbin
+BINDIR?=3D	/usr/bin
=20
 WARNS?=3D		6
Index: sbin/Makefile.inc
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sbin/Makefile.inc	(revision 227417)
+++ sbin/Makefile.inc	(working copy)
@@ -3,7 +3,7 @@
=20
 .include <bsd.own.mk>
=20
-BINDIR?=3D	/sbin
+BINDIR?=3D	/bin
 WARNS?=3D	6
=20
 .if ${MK_DYNAMICROOT} =3D=3D "no"
Index: Makefile.inc1
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Makefile.inc1	(revision 227417)
+++ Makefile.inc1	(working copy)
@@ -613,6 +613,18 @@
 .endfor
=20
 #
+# /sbin is now merged into /bin. The same holds for /usr/sbin and /usr/gam=
es.
+#
+installcheck: installcheck_sbin_merge
+installcheck_sbin_merge:
+.for dir in ${DESTDIR}/sbin ${DESTDIR}/usr/sbin ${DESTDIR}/usr/games
+	@if test -d ${dir} -a ! -L ${dir}; then \
+		echo "ERROR: Directory ${dir} is still present, see /usr/src/UPDATING en=
try 20111110."; \
+		false; \
+	fi
+.endfor
+
+#
 # Required install tools to be saved in a scratch dir for safety.
 #
 .if ${MK_INFO} !=3D "no"
Index: UPDATING
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- UPDATING	(revision 227417)
+++ UPDATING	(working copy)
@@ -22,6 +22,24 @@
 	machines to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
=20
+20111110:
+	The /sbin, /usr/sbin and /usr/games directories have been merged
+	into /bin and /usr/bin. For compatibility, the old directories
+	have been replaced by symbolic links pointing to `bin'. To
+	prevent people from possibly breaking their system
+	automatically, you must perform the merge manually before
+	`make installworld'. This can be done as follows:
+
+		chflags noschg /sbin/* /usr/sbin/* /usr/games/*
+		mv /sbin/* /bin
+		mv /usr/sbin/* /usr/games/* /usr/bin
+		rmdir /sbin /usr/sbin /usr/games
+
+	After running these commands, you can safely run `make
+	installworld' to continue your upgrade. Do not reboot your
+	system in the mean time, as FreeBSD's boot procedure depends on
+	the existence of /sbin and /usr/sbin.
+
 20111108:
 	The option VFS_ALLOW_NONMPSAFE option has been added in order to
 	explicitely support non-MPSAFE filesystems.
Index: etc/mtree/BSD.usr.dist
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- etc/mtree/BSD.usr.dist	(revision 227417)
+++ etc/mtree/BSD.usr.dist	(working copy)
@@ -7,8 +7,7 @@
 .
     bin
     ..
-    games
-    ..
+    games           type=3Dlink link=3Dbin
     include
     ..
     lib
@@ -55,8 +54,7 @@
     ..
     obj             nochange
     ..
-    sbin
-    ..
+    sbin            type=3Dlink link=3Dbin
     share
         calendar
             de_DE.ISO8859-1
Index: etc/mtree/BSD.root.dist
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- etc/mtree/BSD.root.dist	(revision 227417)
+++ etc/mtree/BSD.root.dist	(working copy)
@@ -85,8 +85,7 @@
     ..
     root
     ..
-    sbin
-    ..
+    sbin            type=3Dlink link=3Dbin
     tmp             mode=3D01777
     ..
     usr

--GV0iVqYguTV4Q9ER--

--m972NQjnE83KvVa/
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iQIcBAEBAgAGBQJOu8X3AAoJEG5e2P40kaK73K0QAJAB7rljynToo/KLgysV8aeu
srVD+SVNjXnazEEAwdhUjkiIvycSdWgD4cejA80SIYJO7VA3BWnSiZTOBZ86AkB7
4aWFUp57bVCdATQLeSH5ev735FulbH9PJskLm2iq+vYmLekorvIgfcjxV5Flp+ME
gOz3VkAiIbFkkaSbiH4B/d8hyFScMTdYCxzcLTtJ2zHQuN4q0pS4JTEZViYf1xXT
4d/ra/hlYxNOS0QH2vm5OCYj3O5SBJv0FUco6G8NI4WJODKxO758AAYlL0BTxyYN
Hai8+s6bYDFRlpj3EWN48UqPfkRobW/nx2/JEyhsmjUcQbyi05dLbxhjsZfuYVga
MUSzyLkdgjyXFmcqGixqvE7NiPSIzfVP6lmpYz0/HZdbddXMtgMhIt75GBRW/WMO
vn0qTaIpcyA7uSLDnDGf0tqePDWvCZAd9Ats9LyiBfMZRo6Za1qITdJRvMTv7bXP
OBeKNe8piR/bDDrbf97dwsVpOzLr9GfBJm7hjpC9oavyTwnyGbnSpQzw95g2qFLX
Tals3XjGmcCkDNZ3DDOf6CTe581CH607we0nkEX85yNhh8UDvNcir83FS62BENyj
tDPQ8aLcQYOT/oMSUNNV6Cg1BEmFyzOeIWTLmZEqbAF/f1QeNQtjxN7zav0lDbws
QjTV2BX7YcU6mCVa3On1
=5jtM
-----END PGP SIGNATURE-----

--m972NQjnE83KvVa/--



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