Bug 14300

Summary: MAKEDEV requires /usr to be mounted (for chown(1))
Product: Base System Reporter: cemerson+freebsd <cemerson+freebsd>
Component: miscAssignee: David E. O'Brien <obrien>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description cemerson+freebsd 1999-10-13 10:50:00 UTC
MAKEDEV fails to create devices, even with wrong ownerships, when /usr
is not mounted because chown(1) is not available.  This makes recovery
when the device node for /usr (or other filesystems) is missing harder.

Fix: 

(a) move chown(1) to /bin or /sbin
or
(b) cause MAKEDEV to at least create the nodes (with conservative
permissions) before bombing out.
How-To-Repeat: # umount /usr
# cd /dev
# ./MAKEDEV wd1s1a
wd1s1[a-h] will be removed, and not recreated as MAKEDEV bombs out when
chown(1) fails to run.  A manual mknod is required.
Comment 1 nick.hibma 1999-10-13 12:19:21 UTC
 > # ./MAKEDEV wd1s1a
 > wd1s1[a-h] will be removed, and not recreated as MAKEDEV bombs out when
 > chown(1) fails to run.  A manual mknod is required.
 > >Fix:
 > (a) move chown(1) to /bin or /sbin
 > or
 > (b) cause MAKEDEV to at least create the nodes (with conservative
 > permissions) before bombing out.

(b) sounds like a worthwhile idea, if (a) is not an option.

The diff below contains one line wrapping in line 4.

--- MAKEDEV.orig        Tue Oct 12 23:41:23 1999
+++ MAKEDEV     Wed Oct 13 13:17:35 1999
@@ -174,6 +174,14 @@
        echo $(($1 << 25 | ($2 / 32) << 21 | ($2 % 32) << 3 | $3 << 16 |
$4))
 }
 
+chown() {
+        if [ -x /usr/sbin/chown ]; then
+                /usr/sbin/chown "$@"
+        else
+                echo skipped /usr/sbin/chown "$@", not found.
+        fi
+}
+
 # Override mknod(2) to add extra handling to it.
 mknod() {
        rm -f "$1" || exit 1


-- 
ISIS/STA, T.P.270, Joint Research Centre, 21020 Ispra, Italy
Comment 2 Alexey Zelkin freebsd_committer freebsd_triage 1999-12-21 17:43:29 UTC
Responsible Changed
From-To: freebsd-bugs->obrien

David is working on this problem 
Comment 3 David E. O'Brien freebsd_committer freebsd_triage 2000-01-06 17:48:44 UTC
State Changed
From-To: open->closed

Fixed.  Thanks!