From nobody@FreeBSD.org  Sun Jul 29 21:37:22 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 0E8471065673
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Jul 2012 21:37:22 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id D28AF8FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Jul 2012 21:37:21 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q6TLbLAQ025892
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Jul 2012 21:37:21 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q6TLbLx3025891;
	Sun, 29 Jul 2012 21:37:21 GMT
	(envelope-from nobody)
Message-Id: <201207292137.q6TLbLx3025891@red.freebsd.org>
Date: Sun, 29 Jul 2012 21:37:21 GMT
From: Matthias Petermann <matthias@d2ux.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: bsdinstall into jail doesn't find FTP distribution folder when executed on a system running a patch release kernel
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         170264
>Category:       bin
>Synopsis:       bsdinstall(8) into jail doesn't find FTP distribution folder when executed on a system running a patch release kernel
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-sysinstall
>State:          feedback
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 29 21:40:08 UTC 2012
>Closed-Date:    
>Last-Modified:  Fri Apr 26 20:50:01 UTC 2013
>Originator:     Matthias Petermann
>Release:        FreeBSD 9.0-RELEASE-p3
>Organization:
>Environment:
FreeBSD compaq 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 02:52:29 UTC 2012     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
Scope: Using bsdinstall to create a new jail with distribution files from FTP

Symptom: After selecting the to-be-used mirror bsdinstall aborts with the message "An installation step has beeen aborted. Would you like to restart the installer or exit the installer?".

Investigation: Discussion in freebsd-questions (http://lists.freebsd.org/pipermail/freebsd-questions/2012-July/243878.html) and further analysis showed up the reason. Bsdinstall's mirrorselect script uses the output of "uname -r" to construct the BSDINSTALL_DISTSITE variable  which is used as URL for getting the distribution files later on.

As the system was updated to 9.0-RELEASE-p3 and the FTP mirrors don't have a folder for this special patch version (but only for 9.0-RELEASE) bsdinstall breaks.
>How-To-Repeat:
Execute

# bsdinstall jail /usr/jails/myjail 

on a system running 9.0-RELEASE-p3
>Fix:
A smart idea for a fix was illustrated by Darren Baginski in freebsd-questions (http://lists.freebsd.org/pipermail/freebsd-questions/2012-July/243884.html). He proposed to introduce an environment variable to allow modifications to the release name.

In addition to this it probably makes sense to let mirrorselect try to access the FTP site with the default (uname -r) settings as the very first step. If this fails, either the mentioned environment variable should be consulted, or  the FTP directory one level above should be queried to list the available release versions and let the user decide in a dialog which one to use.

I tried to find out how this could work out for the amd64 version and did not understand exactly the layout of the FTP directory. E.g. in ftp://ftp1.freebsd.org/pub/FreeBSD/releases/amd64/ there are:

drwxrwxr-x  14 89987  546  512 Feb 20  2011 8.2-RELEASE
drwxrwxr-x  14 89987  546  512 Apr 10 18:13 8.3-RELEASE
lrwxr-xr-x   1 89987  546   17 Jan  7  2012 9.0-RELEASE -> amd64/9.0-RELEASE
drwxrwxr-x   7 89987  546  512 Feb 19 02:05 ISO-IMAGES
-rw-rw-r--   1 89987  546  637 Nov 23  2005 README.TXT
drwxrwxr-x   5 89987  546  512 Jul 15 03:17 amd64         [*]

while listing the included amd64[*] subdirectory shows:

drwxrwxr-x  2 89987  546  512 Jan  7  2012 9.0-RELEASE
drwxrwxr-x  2 89987  546  512 Jul 15 03:22 9.1-BETA1
drwxrwxr-x  4 89987  546  512 Jul 15 03:18 ISO-IMAGES

bsdinstall itself uses ftp1.freebsd.org/pub/FreeBSD/releases/amd64/amd64/`uname -r`

What is the purpose to have this additional amd64[*] directory within the base amd64 directory?

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-sysinstall 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Aug 6 09:23:47 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=170264 
State-Changed-From-To: open->feedback 
State-Changed-By: nwhitehorn 
State-Changed-When: Tue Jan 22 15:01:36 UTC 2013 
State-Changed-Why:  
Waiting for followup response given existing functionality in 
BSDINSTALL_DISTSITE. 

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

From: Nathan Whitehorn <nathan.whitehorn@icecube.wisc.edu>
To: bug-followup@FreeBSD.org, matthias@d2ux.net
Cc:  
Subject: Re: bin/170264: bsdinstall(8) into jail doesn&#39;t find FTP distribution
 folder when executed on a system running a patch release kernel
Date: Tue, 22 Jan 2013 09:00:04 -0600

 You can accomplish this by setting the BSDINSTALL_DISTSITE environment
 variable (see bsdinstall(8)) or pressing the "Other" button in the
 mirror selection dialog, which specifies the full path to the distfiles
 and includes the architecture and release name. More variables can be
 added, but I'm not sure that they accomplish much.
 
 Is this sufficient, or do you need the additional sub-variables as well?
 -Nathan

From: Matthias Petermann <matthias@d2ux.net>
To: bug-followup@FreeBSD.org, matthias@d2ux.net
Cc:  
Subject: Re: bin/170264: bsdinstall(8) into jail doesn&#39;t find FTP distribution
 folder when executed on a system running a patch release kernel
Date: Fri, 26 Apr 2013 22:50:32 +0200

 Hi Nathan,
 
 sorry for the delayed response. I am fully ok with the proposed 
 solution. The options - using the *Other* Button or set the 
 *BSD_INSTALL_DISTSITE* Environment variable are enough with respect to 
 the very specific use case. I personally now use sysutils/ezjail from 
 the ports for large Jail deployments, which manages the installation for 
 me. Anyway, it could be benefitial to add bsdinstalls jail capabilities 
 to the handbook, including best known methods.
 
 Kind regards,
 Matthias
 
 p.s. you can close the PR - I am fine with the current state. Thanks!
>Unformatted:
