Bug 88293

Summary: /etc/rc.initdiskless broken
Product: Base System Reporter: Joerg Pulz <Joerg.Pulz>
Component: confAssignee: Brooks Davis <brooks>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Joerg Pulz 2005-10-31 20:30:17 UTC
              Setting up a FreeBSD diskless client with read-only root filesystem
              is not working if one is using /conf/base/etc.cpio.gz as /etc base.

              The first problem is the use of the pax(1) command to extract the
              etc.cpio.gz file into the mfs for /etc. pax(1) is bailing out with
              > pax: Invalid combination of options: -f -p -r -x
              If the "-x cpio" option is removed pax(1) is working correctly and
              is determining the archive type automatically.

              The next problem is related to pax(1) too but only happens with a
              read-only /tmp via NFS. pax(1) tries to create a temporary file to
              store directory times in /tmp. If /tmp comes read-only (together
              with / via NFS) pax(1) is bailing out again. Unfortunately, it is
              not possible to create an mfs based /tmp without hacking
              rc.initdiskless as mounting filesystems from /etc/fstab or creating
              an mfs based /tmp via /etc/rc.d/tmp is done later.

              The same applies to FreeBSD-5.4 and /etc/rc.d/initdiskless.

Fix: 

The first problem can be fixed by removing "-x cpio" from the pax(1)
              invocation line in rc.initdiskless.
              The second problem can be fixed by forcing the execution of
              "/etc/rc.d/tmp start" in /etc/rc before rc.initdiskless is started.
How-To-Repeat:               Follow the instructions for diskless(8) to setup the whole thing.
              Generate an appropriate /conf/base/etc.cpio.gz from your
              distribution /etc dir.
              PXEboot the client and wait for rc.initdiskless to kick in.
Comment 1 brooks 2005-10-31 21:12:34 UTC
I've committed the removal of -x cpio, mostly to record the problem.
Please try the following patch.  Since we're already using /rescue, we
might as well use tar which is way more capable than pax.

--- /etc/rc.initdiskless	Wed Oct 26 16:09:35 2005
+++ rc.initdiskless	Mon Oct 31 13:07:53 2005
@@ -309,7 +309,7 @@
 	if [ -f $j ]; then
 	    create_md $subdir
 	    echo "Loading /$subdir from cpio archive $j"
-	    (cd / ; /rescue/pax -x cpio -r -z -p e -f $j)
+	    (cd / ; /rescue/tar -xpf $j)
 	fi
     done
     for j in /conf/$i/*.remove ; do

-- Brooks
Comment 2 Joerg Pulz 2005-10-31 21:54:08 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Mon, 31 Oct 2005, Brooks Davis wrote:

> I've committed the removal of -x cpio, mostly to record the problem.
> Please try the following patch.  Since we're already using /rescue, we
> might as well use tar which is way more capable than pax.
>
> --- /etc/rc.initdiskless	Wed Oct 26 16:09:35 2005
> +++ rc.initdiskless	Mon Oct 31 13:07:53 2005
> @@ -309,7 +309,7 @@
> 	if [ -f $j ]; then
> 	    create_md $subdir
> 	    echo "Loading /$subdir from cpio archive $j"
> -	    (cd / ; /rescue/pax -x cpio -r -z -p e -f $j)
> +	    (cd / ; /rescue/tar -xpf $j)
> 	fi
>     done
>     for j in /conf/$i/*.remove ; do

Hi Brooks,

i tried your suggested patch and it is working fine. This solves both 
problems i described in the PR.

Thanks a lot.
Joerg


- -- 
The beginning is the most important part of the work.
 				-Plato
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFDZpKCSPOsGF+KA+MRAifdAJ45XhUwlGIK2xI+4Ks7++NLWw7zYwCgtC/m
Ec+BykXGl7WvY/Q1Y4MGkZw=
=jNPv
-----END PGP SIGNATURE-----
Comment 3 Brooks Davis freebsd_committer freebsd_triage 2005-10-31 22:00:51 UTC
State Changed
From-To: open->patched

Switched to tar in HEAD. 


Comment 4 Brooks Davis freebsd_committer freebsd_triage 2005-10-31 22:00:51 UTC
Responsible Changed
From-To: freebsd-bugs->brooks

Switched to tar in HEAD.
Comment 5 Brooks Davis freebsd_committer freebsd_triage 2006-01-11 06:22:49 UTC
State Changed
From-To: patched->closed

Merged to RELENG_5 today and RELENG_6 prior to 6.0 release.