From nobody@FreeBSD.org  Fri Feb  6 00:52:42 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 438BA16A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Feb 2004 00:52:42 -0800 (PST)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 43B8443D55
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Feb 2004 00:52:38 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i168qbdL022959
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 6 Feb 2004 00:52:37 -0800 (PST)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.10/8.12.10/Submit) id i168qbWT022957;
	Fri, 6 Feb 2004 00:52:37 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200402060852.i168qbWT022957@www.freebsd.org>
Date: Fri, 6 Feb 2004 00:52:37 -0800 (PST)
From: Amagai Yoshiji <amagai@nue.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: diskless op script failed
X-Send-Pr-Version: www-2.0

>Number:         62417
>Category:       conf
>Synopsis:       diskless op script failed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    luigi
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 06 01:00:34 PST 2004
>Closed-Date:    
>Last-Modified:  Sat May 28 20:30:12 GMT 2005
>Originator:     Amagai Yoshiji
>Release:        5.2 Release Patch level 2
>Organization:
New Unified Environment Research Project
>Environment:
FreeBSD ar.nue.org 5.2-RELEASE-p2 FreeBSD 5.2-RELEASE-p2 #0: Fri Feb  6 13:41:43 JST 2004     amagai@ar.nue.org:/usr/obj/usr/src/sys/AR  i386      
>Description:
A script /usr/share/example/diskless/clone_root is not follow 5.2R changes. The script not copy /lib and /libexec directories.
>How-To-Repeat:
sh /usr/share/example/diskless/clone_root all
>Fix:
ar# diff -c1 /usr/share/examples/diskless/clone_root  clone_root
*** /usr/share/examples/diskless/clone_root     Fri Feb  6 13:37:52 2004
--- clone_root  Fri Feb  6 17:30:00 2004
***************
*** 6,8 ****
  #
! # $FreeBSD: src/share/examples/diskless/clone_root,v 1.1 2001/04/16 06:37:03 luigi Exp $
  #
--- 6,8 ----
  #
! # $FreeBSD: src/share/examples/diskless/clone_root,v 1.1.2.4 2002/04/07 18:16:18 luigi Exp $
  #
***************
*** 48,51 ****
  # enable NFS server and set /etc/exports as
! #     ${DEST} -maproot=0 -alldirs <list of diskless clients>
! #     /usr -alldirs
  #
--- 48,51 ----
  # enable NFS server and set /etc/exports as
! #     ${DEST} -ro -maproot=0 -alldirs <list of diskless clients>
! #     /usr -ro -alldirs
  #
***************
*** 81,83 ****
  PWFILES="master.passwd passwd spwd.db pwd.db"
! TOCOPY="bin boot compat etc modules sbin stand sys"
  
--- 81,83 ----
  PWFILES="master.passwd passwd spwd.db pwd.db"
! TOCOPY="bin boot compat etc modules sbin stand sys lib libexec"
  
***************
*** 102,105 ****
--- 102,111 ----
        (cd / ; tar clf - conf ) | (cd ${DEST}; tar xvf - )
+       mkdir -p ${DEST}/conf/base      # original copy of /etc
+       (cd / ; tar clf - etc ) | (cd ${DEST}/conf/base && tar xvf - )
        mkdir -p ${DEST}/conf/etc       # used to mount things
        (cd /etc ; tar cvf - ${PWFILES} ) | (cd ${DEST}/etc ; tar xf - )
+       (cd ${DEST}/conf/base ; find etc | cpio --create -H newc | \
+               gzip > ${DEST}/conf/base/etc.cpio.gz ; rm -rf etc)
+       (cd ${DEST} ; find dev | cpio --create -H newc | \
+               gzip > ${DEST}/conf/dev.cpio.gz )
  }

and this is a change request./etc/rc.d/initdiskless.
The original code does not copy .file (ex /root/.bashrc etc)

ar# diff -c1 initdiskless.save initdiskless
*** initdiskless.save   Fri Feb  6 17:50:37 2004
--- initdiskless        Fri Feb  6 17:50:48 2004
***************
*** 217,219 ****
            create_md $subdir
!           cp -Rp $j/* /$subdir
        fi
--- 217,219 ----
            create_md $subdir
!           cp -Rp $j/ /$subdir
        fi

======================================
Thank you.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->luigi 
Responsible-Changed-By: ale 
Responsible-Changed-When: Thu Mar 11 08:54:46 PST 2004 
Responsible-Changed-Why:  
Assign to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62417 

From: Bob Bishop <rb@gid.co.uk>
To: freebsd-gnats-submit@FreeBSD.org, amagai@nue.org
Cc:  
Subject: Re: conf/62417: diskless op script failed
Date: Mon, 21 Feb 2005 18:03:14 +0000

 And another thing:
 
 tar l now gives the error "-l has different behaviors in different tar 
 programs.". So in clone_root, -l should be replaced by --one-file-system.
 
 And another thing:
 
 The references to MAKEDEV in clone_root should be retired.
 
 --
 Bob Bishop		    +44 (0)118 940 1243
 rb@gid.co.uk		fax +44 (0)118 940 1295
 

From: Boris Samorodov <bsam@ipt.ru>
To: bug-followup@FreeBSD.org, amagai@nue.org
Cc:  
Subject: RE: conf/62417: diskless op script failed
Date: Sun, 29 May 2005 00:29:42 +0400

 Hi,
 
 The next patch worked for me (FreeBSD-5.4-RELEASE-p1):
 
 ----- patch start -----
 --- clone_root.orig     Sat May 28 18:20:09 2005                               
 +++ clone_root  Sun May 29 00:12:28 2005                                       
 @@ -79,7 +79,7 @@                                                              
  SYSDIRS="dev proc root usr var"                                               
  DIRS="cdrom home mnt"                                                         
  PWFILES="master.passwd passwd spwd.db pwd.db"                                 
 -TOCOPY="bin boot compat etc modules sbin stand sys"                           
 +TOCOPY="bin boot compat etc lib libexec sbin stand"                           
                                                                                
  init_diskless_root() {                                                        
         echo "Cleaning old diskless root ($DEST)"                              
 @@ -89,7 +89,7 @@                                                              
         mkdir -p $DEST && echo "New diskless root created."                    
         echo "+++ Now copy original tree from / ..."                           
         ex=""                                                                  
 -       (cd / ; tar -clf - ${TOCOPY} ) | (cd $DEST; tar xvf - )                
 +       (cd / ; tar --one-file-system -cf - ${TOCOPY} ) | (cd $DEST; tar xvf - )
         #(cd / ; find -x dev | cpio -o -H newc ) | \                           
         #       (cd $DEST; cpio -i -H newc -d )                                
         echo "+++ Fixing permissions on some objects"                          
 @@ -99,7 +99,7 @@                                                              
  update_conf_and_pw() {                                                        
         echo "+++ Copying files in /conf and password files"                   
         (cd ${DEST} ; rm -rf conf )                                            
 -       (cd / ; tar clf - conf ) | (cd ${DEST}; tar xvf - )                    
 +       (cd / ; tar --one-file-system -cf - conf ) | (cd ${DEST}; tar xvf - )  
         mkdir -p ${DEST}/conf/etc       # used to mount things                 
         (cd /etc ; tar cvf - ${PWFILES} ) | (cd ${DEST}/etc ; tar xf - )       
  }                                                                             
 @@ -113,12 +113,9 @@                                                           
         done                                                                   
         echo "."                                                               
         ln -s /var/tmp ${DEST}/tmp                                             
 -       echo "+++ Now use MAKEDEV to create devices ${DEVICES}"   
 -       (cd $DEST/dev ; cp /dev/MAKEDEV . )                       
 -       (cd $DEST/dev ; /dev/MAKEDEV ${DEVICES} )                 
         (cd $DEST/dev ; ln -s /dev/sysmouse mouse )
 -       echo "+++ Copying kernel from /sys/compile/DISKLESS"
 -       cp /sys/compile/DISKLESS/kernel $DEST/kernel
 +       echo "+++ Copying kernel from /usr/obj/usr/src/sys/DISKLESS"
 +       cp /usr/obj/usr/src/sys/DISKLESS/kernel $DEST/boot/kernel/kernel
         echo "."
  }
 ----- patch stop -----
 
 
 WBR
 -- 
 bsam
>Unformatted:
