From chris@Shenton.Org  Tue Feb  4 19:12:13 2003
Return-Path: <chris@Shenton.Org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2E5E537B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  4 Feb 2003 19:12:13 -0800 (PST)
Received: from Thanatos.Shenton.Org (23.ebbed1.client.atlantech.net [209.190.235.35])
	by mx1.FreeBSD.org (Postfix) with SMTP id 63ADF43F93
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  4 Feb 2003 19:12:01 -0800 (PST)
	(envelope-from chris@Shenton.Org)
Received: (qmail 35064 invoked by uid 1000); 5 Feb 2003 03:11:55 -0000
Message-Id: <20030205031155.35063.qmail@Thanatos.Shenton.Org>
Date: 5 Feb 2003 03:11:55 -0000
From: Chris Shenton <chris@Shenton.Org>
Reply-To: Chris Shenton <chris@Shenton.Org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: /etc/rc.diskless1 does not get valid mem disk size, mount fails
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         47934
>Category:       i386
>Synopsis:       /etc/rc.diskless1 does not get valid mem disk size, mount fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 04 19:20:09 PST 2003
>Closed-Date:    Sat Aug 23 04:07:14 PDT 2003
>Last-Modified:  Sat Aug 23 04:07:14 PDT 2003
>Originator:     Chris Shenton
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD thanatos.shenton.org 4.7-STABLE FreeBSD 4.7-STABLE #7: Thu Jan 23 16:19:52 EST 2003 chris@thanatos.shenton.org:/usr/obj/usr/src/sys/Thanatos i386


	
>Description:

I was setting up a diskless client, using dhcpd to get info then
booting pxeboot then a kernel created for DISKLESS per a combination
of instructions in the handbook and Luigi's notes in the
/usr/share/examples/clone_root script.

The client gets an /etc/rc.diskless which fails to mount volumes
such as /var, which it's supposed to create and mount as a "memory
disk".

It's supposed to default to 4MB but this fails, and it's supposed to
be overridden by a "md_size" file in the template partition, but that
failst the same way. I don't see anywhere in the script where it
$md_size_$1 is set before invoking create_md() but the logic is
comparing "$md_size_$1" = "x" and thus erroneously compares "var" with
"x" and thus doesn't get the default.

>How-To-Repeat:

execute $ROOT/etc/rc.diskless1 and see complaint:

    mount_mfs: /etc: bad file system size
 
>Fix:

I have a gross work-around that just jams a value into md_size before
doing the mount, but this isn't really a fix.

    create_md() {
	echo "RC.DISKLESS1 CREATE_MD='$1' size='$md_size_$1'"	
	if [ "x`eval echo \\$md_created_$1`" = "x" ]; then
	    if [ "x`eval echo \$md_size_$1`" = "x" ]; then
		md_size=8192
	    else
		md_size=`eval echo \\$md_size_$1`
	    fi
->	    # Force the size since we can't get it reliably!!
->	    md_size=8192
	    mount_md $md_size /$1
	    /bin/chmod 755 /$1
	    eval md_created_$1=created
	fi
    }



>Release-Note:
>Audit-Trail:

From: 1011011100 <732@lemonia.org>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: i386/47934: /etc/rc.diskless1 does not get valid mem disk size,
 mount fails
Date: Thu, 06 Feb 2003 10:24:12 +0000

 yep, i got this too. fix is trivial, we're just missing a backslash in 
 the eval:
 
 [lemon@yes ~]$ diff -u /etc/rc.diskless1 /tmp/rc.diskless1
 --- /etc/rc.diskless1   Wed Feb  5 22:54:36 2003
 +++ /tmp/rc.diskless1   Thu Feb  6 10:12:55 2003
 @@ -83,7 +83,7 @@
   #
   create_md() {
       if [ "x`eval echo \\$md_created_$1`" = "x" ]; then
 -       if [ "x`eval echo \$md_size_$1`" = "x" ]; then
 +       if [ "x`eval echo \\$md_size_$1`" = "x" ]; then
              md_size=8192
          else
              md_size=`eval echo \\$md_size_$1`
 

From: Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: chris@Shenton.Org
Subject: Re: i386/47934
Date: Sat, 23 Aug 2003 11:54:30 +0200

 > yep, i got this too. fix is trivial, we're just missing a backslash in
 > the eval:
 
 Seems proposed patch was applied and PR can be closed (PR conf/49119
 is already closed).
 
 http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/Attic/rc.diskless1.diff?r1=1.5.2.10&r2=1.5.2.11&f=h
 
 
 -- 
 Pawe Maachowski 
State-Changed-From-To: open->closed 
State-Changed-By: simon 
State-Changed-When: Sat Aug 23 04:04:46 PDT 2003 
State-Changed-Why:  
Close this PR since it indeed is a duplicate of conf/49119 which has 
been fixed. 

Thanks to Chris Shenton for the original submission, and thanks to 
Pawel Malachowski for letting us know that is PR can be closed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=47934 
>Unformatted:
