Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 544624 - bootstrap-prefix.sh emerge --root option needed + shebang issue...
Summary: bootstrap-prefix.sh emerge --root option needed + shebang issue...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-27 04:17 UTC by Paul Preney
Modified: 2015-05-19 13:10 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Modified bootstrap-prefix.sh version downloaded (bootstrap-prefix.sh,64.97 KB, application/x-sh)
2015-04-04 07:41 UTC, Paul Preney
Details
Unmodified bootstrap-prefix.sh screen capture (gzipped) CentOS 6.4 run (bootstrap-prefix-run-on-CentOS6.4.txt.gz,50.15 KB, application/gzip)
2015-04-04 07:45 UTC, Paul Preney
Details
Modified bootstrap-prefix.sh screen capture (gzipped) CentOS 6.4 run (bootstrap-prefix-modified-run-on-CentOS6.4.txt.gz,97.00 KB, application/gzip)
2015-04-04 07:46 UTC, Paul Preney
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Preney 2015-03-27 04:17:47 UTC
bootstrap-prefix.sh fails when trying to emerge ncurses-5.9-r3 (which is the first emerge of stage2). 

bootstrap-prefix.sh was downloaded 2015-03-25 from http://rsync.prefix.bitzolder.nl/scripts/ obtained from this page: http://wiki.gentoo.org/wiki/Project:Prefix/Bootstrap .

The problem appears not to be related to ncurses --it appears that emerge is checking if / is read-write and failing since it is not read-write. The message output is as follows:

    >>>  '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/temp/build.log'
    
     * Messages for package sys-libs/ncurses-5.9-r3:
    
     * One or more files installed to this package are set to be installed to
     * read-only filesystems. Please mount the following filesystems as read-
     * write and retry.
     * 
     *      /
     * 
     * Package 'sys-libs/ncurses-5.9-r3' NOT merged due to read-only file
     * systems. If necessary, refer to your elog messages for the whole
     * content of the above message.
    
    Odd!  Running
      /bin/bash ./bootstrap-prefix.sh "/orc_lfs/scratch/preney/gentoo" stage2
    failed! :(  Details might be found in the build log:
      /orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/temp/build.log
      (no build logs found?!?)
    I have no clue, really.  Please find friendly folks in #gentoo-prefix on
    irc.gentoo.org, gentoo-alt@lists.gentoo.org mailing list, or file a bug
    at bugs.gentoo.org under Gentoo/Alt, Prefix Support. I am defeated.
    I am of no use here any more.


I don't know why it says "no build logs found?!?" --the build.log file was present and is attached to this bug report.

The operating system this is being run under is Linux (CentOS release 6.4) running kernel 2.6.32. Obviously / cannot be read-write since Gentoo Prefix is being installed under a normal user account. 


The problem appears to be related to the emerge call inside the do_emerge_pkgs() function in bootstrap-prefix.sh. The message can be made to go away by also passing the --root option to emerge in do_emerge_pkgs() as follows:

    SAVED_ROOT=$ROOT
    unset ROOT
    PORTAGE_CONFIGROOT="${EPREFIX}" \
    PORTAGE_SYNC_STALE=0 \
    FEATURES="-news ${FEATURES}" \
    PYTHONPATH="${SAVED_ROOT}"/tmp/usr/lib/portage/pym \
    USE="-berkdb -fortran -gdbm -git -nls -pcre -ssl -python bootstrap internal-glib ${USE}" \
    emerge -v --oneshot --root=${SAVED_ROOT} --root-deps ${opts} "${pkg}" #|| return 1
    if [ $? -eq 0 ]; then 
      export ROOT=$SAVED_ROOT
    else
      export ROOT=$SAVED_ROOT
      return 1
    fi

i.e., $ROOT is stored in SAVED_ROOT, --root=${SAVED_ROOT} is used in emerge call, and ROOT's value is restored.


With this fixed, the previous errors disappears but it now fails with this shebang message:

    * Installing basic terminfo files in /etc...
    >>> Completed installing ncurses-5.9-r3 into /orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/image/
    
     * QA Notice: the following files use invalid (possible non-prefixed) shebangs:
     *   orc_lfs/scratch/preney/gentoo/tmp/usr/bin/ncurses5-config:/orc_lfs/scratch/preney/gentoo/tmp/bin/bash (explicit EPREFIX but target not found)
     *   orc_lfs/scratch/preney/gentoo/tmp/usr/bin/ncursesw5-config:/orc_lfs/scratch/preney/gentoo/tmp/bin/bash (explicit EPREFIX but target not found)
     * ERROR: sys-libs/ncurses-5.9-r3::gentoo_prefix failed:
     *   Aborting due to QA concerns: invalid shebangs found
     * 
     * Call stack:
     *   misc-functions.sh, line 1191:  Called install_qa_check
     *   misc-functions.sh, line  187:  Called source 'install_symlink_html_docs'
     *            05prefix, line  115:  Called install_qa_check_prefix
     *            05prefix, line  111:  Called die
     * The specific snippet of code:
     *              die "Aborting due to QA concerns: invalid shebangs found"
     * 
     * If you need support, post the output of `emerge --info '=sys-libs/ncurses-5.9-r3::gentoo_prefix'`,
     * the complete build log and the output of `emerge -pqv '=sys-libs/ncurses-5.9-r3::gentoo_prefix'`.
     * The complete build log is located at '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/temp/build.log'.
     * The ebuild environment file is located at '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/temp/environment'.
     * Working directory: '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/image'
     * S: '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/work/ncurses-5.9'
    !!! post install failed; exiting.

    >>> Failed to emerge sys-libs/ncurses-5.9-r3 for /orc_lfs/scratch/preney/gentoo/tmp/orc_lfs/scratch/preney/gentoo/tmp/, Log file:

    >>>  '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/temp/build.log'
    
     * Messages for package sys-libs/ncurses-5.9-r3 merged to /orc_lfs/scratch/preney/gentoo/tmp/:
    
     * ERROR: sys-libs/ncurses-5.9-r3::gentoo_prefix failed:
     *   Aborting due to QA concerns: invalid shebangs found
     *
     * Call stack:
     *   misc-functions.sh, line 1191:  Called install_qa_check
     *   misc-functions.sh, line  187:  Called source 'install_symlink_html_docs'
     *            05prefix, line  115:  Called install_qa_check_prefix
     *            05prefix, line  111:  Called die
     * The specific snippet of code:
     *              die "Aborting due to QA concerns: invalid shebangs found"
     *
 * If you need support, post the output of `emerge --info '=sys-libs/ncurses-5.9-r3::gentoo_prefix'`,
 * the complete build log and the output of `emerge -pqv '=sys-libs/ncurses-5.9-r3::gentoo_prefix'`.
 * The complete build log is located at '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/temp/build.log'.
 * The ebuild environment file is located at '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/temp/environment'.
 * Working directory: '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/image'
 * S: '/orc_lfs/scratch/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/work/ncurses-5.9'



Any help resolving this so I can install Gentoo Prefix would be appreciated!


Thank you!
Comment 1 Paul Preney 2015-04-04 07:41:26 UTC
Created attachment 400510 [details]
Modified bootstrap-prefix.sh version downloaded
Comment 2 Paul Preney 2015-04-04 07:45:46 UTC
Created attachment 400514 [details]
Unmodified bootstrap-prefix.sh screen capture (gzipped) CentOS 6.4 run
Comment 3 Paul Preney 2015-04-04 07:46:55 UTC
Created attachment 400516 [details]
Modified bootstrap-prefix.sh screen capture (gzipped) CentOS 6.4 run
Comment 4 Paul Preney 2015-04-04 07:51:34 UTC
I have provided the following attachments:

1) The modified bootstrap-prefix.sh script, i.e., see the do_emerge_pkgs() function for SAVED_ROOT and the use of --root.

2) A full screen log of the build of the original unmodified bootstrap-prefix.sh script running interactively. (This is script is the most recent version as of the time of this bug submission.)

3) A full screen log of the build of the modified bootstrap-prefix.sh script running interactively.

These nicely show the outputs previously described along with all outputs that preceded such. :-)
Comment 5 Fabian Groffen gentoo-dev 2015-04-04 17:24:17 UTC
This feels like a portage bug.  It shouldn't really check / in Prefix land.
Comment 6 Fabian Groffen gentoo-dev 2015-04-05 08:08:34 UTC
How does your mountinfo look like for this system?
Comment 7 Fabian Groffen gentoo-dev 2015-04-05 08:11:22 UTC
You'll probably get further by disabling the ro check:

in pym/portage/util/writeable_check.py, at the bottom change "Linux" into something like "XXXdisabledXXX-Linux".
Comment 8 Zac Medico gentoo-dev 2015-04-05 18:03:37 UTC
(In reply to Fabian Groffen from comment #5)
> This feels like a portage bug.  It shouldn't really check / in Prefix land.

Yeah, at least it looks like it should be checking EROOT instead of ROOT.
Comment 9 Paul Preney 2015-04-05 19:06:39 UTC
(In reply to Fabian Groffen from comment #7)
> You'll probably get further by disabling the ro check:
> 
> in pym/portage/util/writeable_check.py, at the bottom change "Linux" into
> something like "XXXdisabledXXX-Linux".

Given that bootstrap-prefix.sh is automated (including the download, extraction, and building of all codes), how do I manually adjust this and have the script run as it should? (It becomes much harder to debug things if I do something incorrectly.)

WRT mounts, the builds I've been doing have all been using lustre. I just tried the current unmodified script on an NFS mount with the same results:

>>> Failed to install sys-libs/ncurses-5.9-r3, Log file:

>>>  '/home/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/temp/build.log'

 * Messages for package sys-libs/ncurses-5.9-r3:

 * One or more files installed to this package are set to be installed to
 * read-only filesystems. Please mount the following filesystems as read-
 * write and retry.
 *
 *      /
 *
 * Package 'sys-libs/ncurses-5.9-r3' NOT merged due to read-only file
 * systems. If necessary, refer to your elog messages for the whole
 * content of the above message.

Odd!  Running
  /bin/bash ./bootstrap-prefix.sh "/home/preney/gentoo" stage2
failed! :(  Details might be found in the build log:
  /home/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/temp/build.log
  (no build logs found?!?)
I have no clue, really.  Please find friendly folks in #gentoo-prefix on
irc.gentoo.org, gentoo-alt@lists.gentoo.org mailing list, or file a bug
at bugs.gentoo.org under Gentoo/Alt, Prefix Support. I am defeated.
I am of no use here any more.
Comment 10 Zac Medico gentoo-dev 2015-04-06 04:31:09 UTC
(In reply to Zac Medico from comment #8)
> (In reply to Fabian Groffen from comment #5)
> > This feels like a portage bug.  It shouldn't really check / in Prefix land.
> 
> Yeah, at least it looks like it should be checking EROOT instead of ROOT.

There's a patch in the following branch:

https://github.com/zmedico/portage/tree/bug_544624

I've posted it for review here:

https://archives.gentoo.org/gentoo-portage-dev/message/404c2ea6e94a93458d987af2613b6bee
Comment 11 Zac Medico gentoo-dev 2015-04-06 05:09:12 UTC
(In reply to Zac Medico from comment #10)
> (In reply to Zac Medico from comment #8)
> > (In reply to Fabian Groffen from comment #5)
> > > This feels like a portage bug.  It shouldn't really check / in Prefix land.
> > 
> > Yeah, at least it looks like it should be checking EROOT instead of ROOT.
> 
> There's a patch in the following branch:
> 
> https://github.com/zmedico/portage/tree/bug_544624
> 
> I've posted it for review here:
> 
> https://archives.gentoo.org/gentoo-portage-dev/message/
> 404c2ea6e94a93458d987af2613b6bee

It's in the master branch now:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=e968291aed91a955c30844ec6d3a99d09c340ddb
Comment 12 Paul Preney 2015-04-06 14:08:11 UTC
(In reply to Zac Medico from comment #11)
> 
> It's in the master branch now:
> 
> https://gitweb.gentoo.org/proj/portage.git/commit/
> ?id=e968291aed91a955c30844ec6d3a99d09c340ddb

Is there a way for me to run bootstrap-prefix.sh that will pull the master branch version in to see if this wholly/partially fixes the problem?
Comment 13 Zac Medico gentoo-dev 2015-04-06 23:11:43 UTC
(In reply to Paul Preney from comment #12)
> Is there a way for me to run bootstrap-prefix.sh that will pull the master
> branch version in to see if this wholly/partially fixes the problem?

You'll probably want to stick with whatever version of prefix portage you were using, and apply this patch to it:

https://gitweb.gentoo.org/proj/portage.git/patch/?id=e968291aed91a955c30844ec6d3a99d09c340ddb
Comment 14 Paul Preney 2015-04-07 01:42:03 UTC
(In reply to Zac Medico from comment #13)
> 
> You'll probably want to stick with whatever version of prefix portage you
> were using, and apply this patch to it:
> 
> https://gitweb.gentoo.org/proj/portage.git/patch/
> ?id=e968291aed91a955c30844ec6d3a99d09c340ddb

1) The version of bootstrap-prefix.sh I am using is the pristine version. (See the attachments and first ~4 comments.) FYI, the pristine version still fails with the same can't write to root error message.


2) I tried my modified version of bootstrap-prefix.sh. (Same edits as in (4) below so I could manually patch vartree.py before it is used.) FYI, the modified version still fails with the same error as detailed in my first comments on this bug ticket.


i.e., nothing has changed with these suggestions wrt running the pristine or modified boostrap-prefix.sh.


3a) A request: Many thanks for your suggestion(s) but kindly provide some detail on where/how to go about applying the patch. While Gentoo is a from-source distro, Gentoo Prefix has a completely automated build script and very little information about manual steps or the script on the project's Wiki.

I figured out where in bootstrap-prefix.sh I could run "bash" so I could manually patch vartree.py and know the diff you gave was not for the identical file that I patched: the line numbers are off some ~20 lines.

3b) FYI bootstrap-prefix.sh is being run with no special environment variables set for it, etc.


4) Finally the line that I invoked "bash" on so I could manually patch vartree.py was in the bootstrap_portage() function (in both the pristine and modified bootstrap-prefix.sh), e.g.,:

--- t/bootstrap-prefix.sh       2015-03-26 23:56:27.000000000 -0400
+++ bootstrap-prefix.sh 2015-04-06 20:56:24.000000000 -0400
@@ -461,6 +461,8 @@
        [[ -x ${ROOT}/bin/sh ]] || ln -s ../tmp/bin/sh "${ROOT}"/bin/sh || return 1
        export PORTAGE_BASH="${ROOT}"/tmp/bin/bash

+  bash
+
        einfo "Compiling ${A%-*}"
        econf \
                --with-offset-prefix="${ROOT}"/tmp \

which allowed me to edit vartree.py and notice the ~20 or so line number difference:

--- vartree.py-actual   2015-04-06 20:40:33.827559639 -0400
+++ vartree.py.modified 2015-04-06 20:54:45.074062226 -0400
@@ -3736,7 +3736,7 @@
                line_ending_re = re.compile('[\n\r]')
                srcroot_len = len(srcroot)
                ed_len = len(self.settings["ED"])
-
+               eprefix_len = len(self.settings["EPREFIX"])
                while True:

                        unicode_error = False
@@ -3779,6 +3779,12 @@
                                relative_path = parent[srcroot_len:]
                                dirlist.append(os.path.join(destroot, relative_path))

+                               if len(relative_path) >= eprefix_len:
+                                       # Files are never installed outside of the prefix,
+                                       # therefore we skip the readonly filesystem check for
+                                       # parent directories of the prefix (see bug 544624).
+                                       dirlist.append(os.path.join(destroot, relative_path))
+
                                for fname in files:
                                        try:
                                                fname = _unicode_decode(fname,
Comment 15 Guilherme Amadio gentoo-dev 2015-04-07 14:24:44 UTC
Hi Paul,

(In reply to Paul Preney from comment #14)
> (In reply to Zac Medico from comment #13)
> > 
> > You'll probably want to stick with whatever version of prefix portage you
> > were using, and apply this patch to it:
> > 
> > https://gitweb.gentoo.org/proj/portage.git/patch/
> > ?id=e968291aed91a955c30844ec6d3a99d09c340ddb
> 
> 1) The version of bootstrap-prefix.sh I am using is the pristine version.
> (See the attachments and first ~4 comments.) FYI, the pristine version still
> fails with the same can't write to root error message.
 
Please keep in mind that the bootstrap process installs a temporary portage and a permanent one sometime afterwards, so you may have to patch each of them individually. You don't have to modify the bootstrap script for that, though. When it fails, just apply the patch to the portage either in $EPREFIX/tmp/ or in $EPREFIX as needed, and re-run the script. It should continue from wherever it stopped. You can always fix a problem and continue by just running the script again.
 
> 3a) A request: Many thanks for your suggestion(s) but kindly provide some
> detail on where/how to go about applying the patch. While Gentoo is a
> from-source distro, Gentoo Prefix has a completely automated build script
> and very little information about manual steps or the script on the
> project's Wiki.
> 
> I figured out where in bootstrap-prefix.sh I could run "bash" so I could
> manually patch vartree.py and know the diff you gave was not for the
> identical file that I patched: the line numbers are off some ~20 lines.

I agree with you that Gentoo Prefix is not quite well documented right now. The install script is hacky, but it is itself the only documentation on how to bootstrap. We do not that much manpower to create detailed documentation. If you can't find out how to do something and need help, the best to do is to go to #gentoo-prefix on freenode, or file a bug here. We'll do our best to help. I hope that my explanation above helps you get through with this problem.
Comment 16 Paul Preney 2015-04-10 18:32:06 UTC
(In reply to Guilherme Amadio from comment #15)
>  
> Please keep in mind that the bootstrap process installs a temporary portage
> and a permanent one sometime afterwards, so you may have to patch each of
> them individually. You don't have to modify the bootstrap script for that,
> though. When it fails, just apply the patch to the portage either in
> $EPREFIX/tmp/ or in $EPREFIX as needed, and re-run the script. It should
> continue from wherever it stopped. You can always fix a problem and continue
> by just running the script again.

With the unmodified and the modified boostrap-prefix.sh scripts I get the same results. There is only one vartree.py file in tmp/usr/lib/portage/pym/portage/dbapi (i.e., from stage1). The installation of ncurses (which is the first emerged package) is right at the start of stage2. The issue is not with ncurses per se though because if I put another package before it to be emerged that fails (with the same errors as well).

So nothing has improved --everything is the same even with the vartree.py modifications (including the deletions of the vartree.py{c,o} files). :-(

Concerning to me though is the fact that my vartree.py file is not the same (e.g., the line numbers given earlier) as what you might be using. I am using bootstrap-prefix.sh with no special options or environment variables. Do you have special settings set in yours that I may need to add?

Thanks,

Paul
Comment 17 Paul Preney 2015-04-12 15:43:24 UTC
Q1) Apparently one can get invalid shebang messages with Gentoo Prefix and I would like to know what is needed (e.g., some pointers / techniques / tricks) to go about investigating and solving them. From my point-of-view this would be a way of moving ahead and around the "/ [root directory]" is read-only error. If you're able to provide any information on how I can begin to try and resolve such messages that would be wonderful! :-)

Q2) Up to this point, I've only used no special script features. Do you think it would it be worthwhile to exploit $LATEST_TREE_YES and possibly other variables in the bootstrap-prefix.sh script?


Paul
Comment 18 Paul Preney 2015-04-12 16:47:17 UTC
Concerning Q2 (i.e., LATEST_TREE_YES) in the previous post: I tried it and got the same issues.

Concerning Q1 I get this output with my modified bootstrap-prefix.sh script when ncurses is being emerge (and fails when trying to install):

[snip]
installing std
installing stdcrt
installing vt100
installing vt300
make[1]: Leaving directory `/home/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/work/ncurses-5.9-abi_x86_64.amd64-widec/misc'
 * Installing basic terminfo files in /etc...
>>> Completed installing ncurses-5.9-r3 into /home/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/image/

 * QA Notice: the following files use invalid (possible non-prefixed) shebangs:
 *   home/preney/gentoo/tmp/usr/bin/ncurses5-config:/home/preney/gentoo/tmp/bin/bash (explicit EPREFIX but target not found)
 *   home/preney/gentoo/tmp/usr/bin/ncursesw5-config:/home/preney/gentoo/tmp/bin/bash (explicit EPREFIX but target not found)

In particular it appears the error has to do with bash. Bash is installed here:

$ ls -ld /home/preney/gentoo/tmp/bin/bash
lrwxrwxrwx 1 preney preney 9 Apr 12 12:19 /home/preney/gentoo/tmp/bin/bash -> /bin/bash
$

If I look at:

$ less /home/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/image/home/preney/gentoo/tmp/usr/bin/ncurses5-config

I see this at the top of the file:

#!/home/preney/gentoo/tmp/bin/bash

which appears to be good. So this has me asking why is the target not found and how can this be fixed (even if only a hack initially)?
Comment 19 Guilherme Amadio gentoo-dev 2015-04-13 15:39:41 UTC
(In reply to Paul Preney from comment #18)

> Concerning Q1 I get this output with my modified bootstrap-prefix.sh script
> when ncurses is being emerge (and fails when trying to install):
> 
> [snip]
> installing std
> installing stdcrt
> installing vt100
> installing vt300
> make[1]: Leaving directory
> `/home/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/work/
> ncurses-5.9-abi_x86_64.amd64-widec/misc'
>  * Installing basic terminfo files in /etc...
> >>> Completed installing ncurses-5.9-r3 into /home/preney/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-5.9-r3/image/
> 
>  * QA Notice: the following files use invalid (possible non-prefixed)
> shebangs:
>  *  
> home/preney/gentoo/tmp/usr/bin/ncurses5-config:/home/preney/gentoo/tmp/bin/
> bash (explicit EPREFIX but target not found)
>  *  
> home/preney/gentoo/tmp/usr/bin/ncursesw5-config:/home/preney/gentoo/tmp/bin/
> bash (explicit EPREFIX but target not found)

I think it's strange that there is no / in front of home in your error message.
Are you setting EPREFIX with a relative path? That could be the problem. You need an absolute path in EPREFIX for it to work. Also, the errors you are getting are probably specific to your setup (I cannot reproduce them), so I'm not sure how I could help other than looking at specific information about each problem.

Could you please post a diff (uncompressed) of the script you are using against the official one, and the command line you are using to run it?
Comment 20 Paul Preney 2015-04-13 15:59:24 UTC
(In reply to Guilherme Amadio from comment #19)
> 
> I think it's strange that there is no / in front of home in your error
> message.
> Are you setting EPREFIX with a relative path? That could be the problem. You

No, I simply am running the script as ./bootstrap-prefix.sh and answering the prompts. See the screen captures (text, no ANSI graphics, which I gzipped for space reasons only) attached to this bug report.


> need an absolute path in EPREFIX for it to work. Also, the errors you are
> getting are probably specific to your setup (I cannot reproduce them), so

Yesterday I also tried installing Gentoo Prefix from within a VirtualBox CentOS v5.11 (fresh basic install) virtual machine. After the install, I did a "yum install gcc", and then ran bootstrap-prefix.sh. The installation ran without issue until stage3's "emerge -e system" which failed on the util-linux package. I was unable to determine why. (At least this gets past stage2.)

But the actual system I want to get this to work on is CentOS 5.4 and so far "/" and "invalid shebang" problems (with the pristine and the modified bootstrap-prefix.sh scripts respectively) only happen there. (Again see the attached-to-this-bug-report text screen log captures which are gzipped for space reasons --they are full log captures of everything.)

In all cases, it is portage that stops the process. In all cases it looks like a check that portage is doing (e.g., one looks for / being read-write, the other looks for "incorrect" shebangs at the top of scripts --but they are not incorrect, etc.).


> Could you please post a diff (uncompressed) of the script you are using
> against the official one, and the command line you are using to run it?

That was in my first post in this thread (but not as a diff). Search for "SAVED_ROOT" and you will see such. 

NOTE: When I submitted this bug report, I also attached the pristine and modified bootstrap-prefix.sh scripts --so you can compute the diff that way too. 

For completeness the diff is here:

--- bootstrap-prefix.sh-pristine        2015-02-08 03:50:56.000000000 -0500
+++ bootstrap-prefix.sh-preney-modified-A       2015-04-12 13:27:58.000000000 -0400
@@ -1001,12 +1001,20 @@
                # because the tools aren't available to read the news item yet anyway.
                #
                # Avoid circular deps caused by the default profiles (and IUSE defaults).
+    SAVED_ROOT=$ROOT
+    unset ROOT
                PORTAGE_CONFIGROOT="${EPREFIX}" \
                PORTAGE_SYNC_STALE=0 \
                FEATURES="-news ${FEATURES}" \
-               PYTHONPATH="${ROOT}"/tmp/usr/lib/portage/pym \
+               PYTHONPATH="${SAVED_ROOT}"/tmp/usr/lib/portage/pym \
                USE="-berkdb -fortran -gdbm -git -nls -pcre -ssl -python bootstrap internal-glib ${USE}" \
-               emerge -v --oneshot --root-deps ${opts} "${pkg}" || return 1
+               emerge -v --oneshot --root=${SAVED_ROOT} --root-deps ${opts} "${pkg}" #|| return 1
+    if [ $? -eq 0 ]; then
+      export ROOT=$SAVED_ROOT
+    else
+      export ROOT=$SAVED_ROOT
+      return 1
+    fi
        done
 }
Comment 21 Guilherme Amadio gentoo-dev 2015-04-13 17:02:03 UTC
(In reply to Paul Preney from comment #20)

> For completeness the diff is here:

Thank you for posting the diff.

> --- bootstrap-prefix.sh-pristine        2015-02-08 03:50:56.000000000 -0500
> +++ bootstrap-prefix.sh-preney-modified-A       2015-04-12
> 13:27:58.000000000 -0400
> @@ -1001,12 +1001,20 @@
>                 # because the tools aren't available to read the news item
> yet anyway.
>                 #
>                 # Avoid circular deps caused by the default profiles (and
> IUSE defaults).
> +    SAVED_ROOT=$ROOT
> +    unset ROOT
>                 PORTAGE_CONFIGROOT="${EPREFIX}" \
>                 PORTAGE_SYNC_STALE=0 \
>                 FEATURES="-news ${FEATURES}" \
> -               PYTHONPATH="${ROOT}"/tmp/usr/lib/portage/pym \
> +               PYTHONPATH="${SAVED_ROOT}"/tmp/usr/lib/portage/pym \
>                 USE="-berkdb -fortran -gdbm -git -nls -pcre -ssl -python
> bootstrap internal-glib ${USE}" \

> -               emerge -v --oneshot --root-deps ${opts} "${pkg}" || return 1
> +               emerge -v --oneshot --root=${SAVED_ROOT} --root-deps ${opts}

> "${pkg}" #|| return 1
> +    if [ $? -eq 0 ]; then
> +      export ROOT=$SAVED_ROOT
> +    else
> +      export ROOT=$SAVED_ROOT
> +      return 1
> +    fi
>         done
>  }

The change I separated by blank lines above is likely the cause of your second error. Portage checks if the scripts in shebang lines exist. Since your change made portage install bash in the wrong ROOT path (by passing the --root=$SAVED_ROOT option to emerge), it is not there when you try to install ncurses. It is probably in the EPREFIX/tmp, when it should be in EPREFIX, without the tmp.

NFS could be the problem, but it's likely that if you apply the patch by Zac on the portage you have in stage 1 and only use the official script, you should be able to get the bootstrap process to work.
Comment 22 Paul Preney 2015-04-13 17:11:18 UTC
(In reply to Guilherme Amadio from comment #21)
> 
> > -               emerge -v --oneshot --root-deps ${opts} "${pkg}" || return 1
> > +               emerge -v --oneshot --root=${SAVED_ROOT} --root-deps ${opts}
> 
> The change I separated by blank lines above is likely the cause of your
> second error. Portage checks if the scripts in shebang lines exist. Since
> your change made portage install bash in the wrong ROOT path (by passing the
> --root=$SAVED_ROOT option to emerge), it is not there when you try to
> install ncurses. It is probably in the EPREFIX/tmp, when it should be in
> EPREFIX, without the tmp.

But that is the fix for the script to get past the "/" is not both readable and writable error.

 
> NFS could be the problem, but it's likely that if you apply the patch by Zac
> on the portage you have in stage 1 and only use the official script, you
> should be able to get the bootstrap process to work.

And when I tried Zac's fix I could see NO difference in output with both the unmodified and modified bootstrap-prefix.sh scripts --see Comment 16, i.e., the errors are the same without Zac's fix. I also noted there was only one vartree.py script to modify --I did a full find search-- not two as Zac stated. Probably the second vartree.py file to modify only comes after portage is rebuilt in stage2? But it never gets that far: it dies at the start of stage2 when it runs emerge for the FIRST time and it dies right at the start of the install phase (e.g., see the screen logs attached to this bug report).
Comment 23 Guilherme Amadio gentoo-dev 2015-04-13 18:35:08 UTC
(In reply to Paul Preney from comment #22)
> (In reply to Guilherme Amadio from comment #21)
> > 
> > > -               emerge -v --oneshot --root-deps ${opts} "${pkg}" || return 1
> > > +               emerge -v --oneshot --root=${SAVED_ROOT} --root-deps ${opts}
> > 
> > The change I separated by blank lines above is likely the cause of your
> > second error. Portage checks if the scripts in shebang lines exist. Since
> > your change made portage install bash in the wrong ROOT path (by passing the
> > --root=$SAVED_ROOT option to emerge), it is not there when you try to
> > install ncurses. It is probably in the EPREFIX/tmp, when it should be in
> > EPREFIX, without the tmp.
> 
> But that is the fix for the script to get past the "/" is not both readable
> and writable error.

You may get past that part, but your modified script is installing things in the wrong place, so it is not actually fixing the problem.
  
> > NFS could be the problem, but it's likely that if you apply the patch by Zac
> > on the portage you have in stage 1 and only use the official script, you
> > should be able to get the bootstrap process to work.
> 
> And when I tried Zac's fix I could see NO difference in output with both the
> unmodified and modified bootstrap-prefix.sh scripts --see Comment 16, i.e.,
> the errors are the same without Zac's fix. I also noted there was only one
> vartree.py script to modify --I did a full find search-- not two as Zac
> stated. Probably the second vartree.py file to modify only comes after
> portage is rebuilt in stage2? But it never gets that far: it dies at the
> start of stage2 when it runs emerge for the FIRST time and it dies right at
> the start of the install phase (e.g., see the screen logs attached to this
> bug report).

You are right here, you may have only one file to fix (although I do have two, one for python2.7, and another for python3.4). Also, you may have to fix the second install of portage, as you say, after stage2.

The change you made to the script did not fix the problem, though. What you can do is go to the file where the ckech for read-write on '/' is being made and manyally disable the check. That would probably fix your particular problem.
Comment 24 Paul Preney 2015-04-16 11:38:30 UTC
(In reply to Guilherme Amadio from comment #23)
> 
> The change you made to the script did not fix the problem, though. What you
> can do is go to the file where the ckech for read-write on '/' is being made
> and manyally disable the check. That would probably fix your particular
> problem.

Thanks for this suggestion! The PRISTINE bootstrap-prefix.sh script with the read-only code commented out could be run until dev-lang/perl-5.20.1-r2 failed (i.e., a lot further)!

I got it to work with the following edit to vartree.py (i.e., commenting out the read-only check completely):

$ diff -ub ~/toprocess/vartree.py vartree.py
--- /home/preney/toprocess/vartree.py   2015-04-06 19:55:15.005175007 -0400
+++ vartree.py  2015-04-15 19:57:31.600317878 -0400
@@ -3902,25 +3901,25 @@
                ro_checker = get_ro_checker()
                rofilesystems = ro_checker(dirlist)
 
-               if rofilesystems:
-                       msg = _("One or more files installed to this package are "
-                               "set to be installed to read-only filesystems. "
-                               "Please mount the following filesystems as read-write "
-                               "and retry.")
-                       msg = textwrap.wrap(msg, 70)
-                       msg.append("")
-                       for f in rofilesystems:
-                               msg.append("\t%s" % f)
-                       msg.append("")
-                       self._elog("eerror", "preinst", msg)
-
-                       msg = _("Package '%s' NOT merged due to read-only file systems.") % \
-                               self.settings.mycpv
-                       msg += _(" If necessary, refer to your elog "
-                               "messages for the whole content of the above message.")
-                       msg = textwrap.wrap(msg, 70)
-                       eerror(msg)
-                       return 1
+               #if rofilesystems:
+               #       msg = _("One or more files installed to this package are "
+               #               "set to be installed to read-only filesystems. "
+               #               "Please mount the following filesystems as read-write "
+               #               "and retry.")
+               #       msg = textwrap.wrap(msg, 70)
+               #       msg.append("")
+               #       for f in rofilesystems:
+               #               msg.append("\t%s" % f)
+               #       msg.append("")
+               #       self._elog("eerror", "preinst", msg)
+    #
+               #       msg = _("Package '%s' NOT merged due to read-only file systems.") % \
+               #               self.settings.mycpv
+               #       msg += _(" If necessary, refer to your elog "
+               #               "messages for the whole content of the above message.")
+               #       msg = textwrap.wrap(msg, 70)
+               #       eerror(msg)
+               #       return 1

                # check for package collisions
                blockers = self._blockers
$


The perl build fails with this output:


>>> Failed to emerge dev-lang/perl-5.20.1-r2, Log file:

>>>  '/home/preney/gentoo/tmp/var/tmp/portage/dev-lang/perl-5.20.1-r2/temp/build.log'

 * Messages for package dev-lang/perl-5.20.1-r2:

 * ERROR: dev-lang/perl-5.20.1-r2::gentoo_prefix failed (compile phase):
 *   emake failed

[snip]

Hmmmm, I was already afraid of this to happen.  Running
  /home/preney/gentoo/bin/bash ./bootstrap-prefix.sh-pristine "/home/preney/gentoo" stage3
somewhere failed :(  Details might be found in the build log:
  /home/preney/gentoo/tmp/var/tmp/portage/dev-lang/perl-5.20.1-r2/temp/build.log
  (no build logs found?!?)


With the end of the build.log file (i.e., the one that bootstrap-prefix.sh says cannot be found!) being:


>>> Source unpacked in /home/preney/gentoo/tmp/var/tmp/portage/dev-lang/perl-5.20.1-r2/work
>>> Preparing source in /home/preney/gentoo/tmp/var/tmp/portage/dev-lang/perl-5.20.1-r2/work/perl-5.20.1 ...
 * Applying patches from perl-5.20.1-1 ...
 *   gentoo/hints_hpux.diff ...                                                          [ ok ]
 *   gentoo/aix_soname.diff ...                                                          [ ok ]
 *   gentoo/EUMM-RUNPATH.diff ...                                                        [ ok ]
 *   gentoo/config_over.diff ...                                                         [ ok ]
 *   gentoo/opensolaris_headers.diff ...                                                 [ ok ]
 *   gentoo/patchlevel.diff ...                                                          [ ok ]
 *   gentoo/cpanplus_definstalldirs.diff ...                                             [ ok ]
 *   gentoo/cleanup-paths.diff ...
...skipping...
Processing CaseFolding.txt
Processing DCoreProperties.txt
Processing Scripts.txt
Processing DNormalizationProps.txt
Processing HangulSyllableType.txt
Processing auxiliary/WordBreakProperty.txt
Processing auxiliary/GraphemeBreakProperty.txt
Processing auxiliary/GCBTest.txt
Processing auxiliary/SentenceBreakProperty.txt
Processing NamedSequences.txt
Processing NameAliases.txt
Processing ScriptExtensions.txt
Processing BidiBrackets.txt
Finishing processing Unicode properties
Compiling Perl properties
Creating Perl synonyms
Writing tables
Making pod file
Making test script
Updating 'mktables.lst'
 * ERROR: dev-lang/perl-5.20.1-r2::gentoo_prefix failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=dev-lang/perl-5.20.1-r2::gentoo_prefix'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/perl-5.20.1-r2::gentoo_prefix'`.
 * The complete build log is located at '/home/preney/gentoo/tmp/var/tmp/portage/dev-lang/perl-5.20.1-r2/temp/build.log'.
 * The ebuild environment file is located at '/home/preney/gentoo/tmp/var/tmp/portage/dev-lang/perl-5.20.1-r2/temp/environment'.
 * Working directory: '/home/preney/gentoo/tmp/var/tmp/portage/dev-lang/perl-5.20.1-r2/work/perl-5.20.1'
 * S: '/home/preney/gentoo/tmp/var/tmp/portage/dev-lang/perl-5.20.1-r2/work/perl-5.20.1'


which is failing to build shortly after uncompressing the source --but there doesn't seem to be any error information output.


Any thoughts / ideas you may have on resolving this would be appreciated. Many thanks for all of your help so far!
Comment 25 Paul Preney 2015-05-19 12:43:13 UTC
I never got this to work, however, I did get Gentoo Prefix to work in a virtual machine with CentOS 6.6 without issue so it appears that the issues might well be related to the filesystems (lustre and nfs) which all of the disk space is mounted on.

With the virtual machine install of Gentoo Prefix, I was able to determine that using Gentoo Prefix for what I was investigating would not be appropriate: its repository was distinct from the main repository and had less in it. With what I am dealing with, I reasoned I would be better off maintaining packages by hand (using custom scripts). I am now also investigating using the Nix package manager instead of emerge. (In Gentoo terms, with Nix everything is effectively slotted per its build configuration, version, and dependencies --with the questions being how well does it work and how hard is it to do the equivalent of an ebuild.)

Many thanks for all of your help!