Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 211654 - stage1's tmp/stage1root isn't prepared for chroot
Summary: stage1's tmp/stage1root isn't prepared for chroot
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: Catalyst (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Catalyst Developers
URL:
Whiteboard:
Keywords:
: 220999 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-27 16:54 UTC by Kristoffer
Modified: 2008-06-19 16:05 UTC (History)
1 user (show)

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


Attachments
The relevant output from catalyst before it aborts. (error.txt,1.60 KB, text/plain)
2008-02-27 16:55 UTC, Kristoffer
Details
fixes preclean in stage1 (chroot-functions.patch,572 bytes, patch)
2008-02-28 23:37 UTC, Kristoffer
Details | Diff
makes catalyst call run_default_funcs at the right places (run_default_funcs-properly.patch,4.91 KB, patch)
2008-02-29 13:02 UTC, Kristoffer
Details | Diff
makes setup_myfeatures check if ccache/distcc/icecream is already installed before emerging them (setup_myfeatures-fix.patch,1.46 KB, patch)
2008-03-01 02:05 UTC, Kristoffer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kristoffer 2008-02-27 16:54:18 UTC
This is with catalyst-2.0.6_pre9

When I try to generate stage1, catalyst have some errors (I will submit the ouput). It seems that "storedir"/tmp/*/stage1-*/tmp/stage1root has two issues:
1) "storedir"/tmp/*/stage1-*/tmp/stage1root/usr/bin/which is missing (altough it's present in the "storedir"/tmp/*/stage1-*/usr/bin) so /usr/lib/catalyst/targets/support/chroot-functions.sh:216:update_env_settings() fail. Thus the warning about that env-update is missing, which it isn't.
2) "storedir"/tmp/*/stage1-*/tmp/stage1root/usr/portage is empty, so emerge fails and complains about the missing make.profile link. I have confirmed this by putting catalyst to sleep (ctrl+z) just before, and binding the portage directory manually, and then it could continue.

Reproducible: Always

Steps to Reproduce:
1. generate stage1 from scratch, using gentoo 2007.0 stage3 as starting point
Comment 1 Kristoffer 2008-02-27 16:55:20 UTC
Created attachment 144752 [details]
The relevant output from catalyst before it aborts.
Comment 2 Chris Gianelloni (RETIRED) gentoo-dev 2008-02-27 17:11:15 UTC
Well, this was already fixed in SVN and also in the 2.0.6_pre10 version which I am just about to release.  In the future, please check to make sure that the issue still exists in SVN before filing a bug report.  We're in the middle of a release, so catalyst is going to change rather quickly and break several times.  If you need a stable catalyst version which is known to work, use the version marked as stable.
Comment 3 Kristoffer 2008-02-28 21:57:21 UTC
Ok, I'm sorry about not checking the changelog. But I believe only problem 1 has been fixed. At least nothing in the changelog seems to have to do with problem 2. I even tried with 2.0.6_pre10 and it still occured; the portage dir remains empty in the new chroot (I think it should be bount to the snapshot_cach)e so emerge fails later on.
Comment 4 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-28 22:04:43 UTC
Well, it works fine for everyone else. If you can track down the problem and point out exactly what is wrong (and perhaps even whip up a patch), we'll be more than happy to take a look.
Comment 5 Kristoffer 2008-02-28 23:37:57 UTC
Created attachment 144915 [details, diff]
fixes preclean in stage1

It seems what's causing this is the call of run_default_funcs in targets/support/chroot-functions:402. This was added in 2.0.6_pre9, and that was when this problem started to appear.

It seems when that file is sourced during action sequence preclean, run_default_funcs is called which results in an emerge of ccache. This doesn't seem to work well (emerge fails since /usr/portage is empty), and seems unnecessary. ccache shouldn't be needed from now on for stage1, plus ccache was already merged earlier during this stage (stage1).

Simply removing the call of run_default_funcs fixes this, see the attached patch.
Comment 6 Kristoffer 2008-02-29 01:18:28 UTC
It turns out that run_default_funcs is not run anywhere else (the comment above the instance I removed said it was run "everywhere" so I was fooled!). As such, distcc and ccache are never emerged and won't work.

So, it need to be run _somwhere_ but not when chroot-functions is sourced. I leave figuring out when to call it to you guys, I really have no clue.
Comment 7 Kristoffer 2008-02-29 13:02:57 UTC
Created attachment 144940 [details, diff]
makes catalyst call run_default_funcs at the right places

The attached patch makes catalyst call run_default_funcs at roughly the same places as update_env_settings/setup_myfeatures (which run_deafult_funcs calls in turn) was called in earlier revisions, which was right after targets/support/chroot-functions.sh is sourced in all targets/*/*-chroot.sh scripts.

I'm a bit unsure whether run_default_funcs should be present in targets/support/kmerge.sh, and if so where it should be. But I added it after targets/support/chroot-functions.sh is sourced there as well.
Comment 8 Kristoffer 2008-02-29 15:06:20 UTC
Arrr! My ccache go cleared so obviously something isn't all right with my patch. Any suggestions, comments?
Comment 9 Andrew Gaffney (RETIRED) gentoo-dev 2008-02-29 15:12:08 UTC
Well, we don't use ccache when building releases. This is why we're not seeing this issue ourselves. The easy way to "fix" this is to just disable ccache in your catalyst.conf. Since it's not preventing us from building the release, we're not in any hurry to fix this, especially if we have to fix it ourselves.
Comment 10 Chris Gianelloni (RETIRED) gentoo-dev 2008-02-29 23:03:43 UTC
So what exactly was the reasoning for moving the call from being a single line in a single file to a line in a ton of files (and you missed all of the preclean places where we actually want/need this to run)?

I understand what you think is the problem, but have no idea why you chose this as a solution to it.  It's definitely a step backwards in terms of functionality.  What would likely be best would be to modify setup_myfeatures to be smarter about not trying to install distcc/ccache/icecream if they already exist.  This has the added benefit of not destroying these packages if someone had merged them with different USE, since we force a specific USE for them.
Comment 11 Kristoffer 2008-03-01 02:05:08 UTC
Created attachment 144984 [details, diff]
makes setup_myfeatures check if ccache/distcc/icecream is already installed before emerging them

(In reply to comment #10)
> So what exactly was the reasoning for moving the call from being a single line
> in a single file to a line in a ton of files (and you missed all of the
> preclean places where we actually want/need this to run)?

Well, the patch was mainly for myself I guess, just to get catalyst to produce a working system (which it did). Obviously I wasn't smart enough to just disable ccache at the time, which would have done the trick. Posting it here at least showed you what I thought was the problem very explicitly.

> I understand what you think is the problem, but have no idea why you chose this
> as a solution to it.  It's definitely a step backwards in terms of
> functionality.  What would likely be best would be to modify setup_myfeatures
> to be smarter about not trying to install distcc/ccache/icecream if they
> already exist.  This has the added benefit of not destroying these packages if
> someone had merged them with different USE, since we force a specific USE for
> them.

Yes, the patch and its whole approach sucked. I'm certainly no expert on the inner workings of catalyst so me writing patches for it is definitely questionable.

Any way, attached is a patch (for 2.0.6_pre10) which does what you suggested. I tried generating a stage1 with it, and it worked flawlessly, even with ccache enabled (and now it wasn't emptied erroneously).
Comment 12 Chris Gianelloni (RETIRED) gentoo-dev 2008-03-27 04:57:54 UTC
That patch would certainly work and does exactly what I asked.  After looking at it, I see only one real problem, and that is that we're checking /var/db/pkg, directly.  This isn't a problem right now because we only support a single package manager, portage.  However, we're making efforts to try to start moving things into a more package manager agnostic fashion.  We'll likely still only support portage for some time, but someone else could easily patch in support for other package managers once the framework has been abstracted.

Anyway, I'm adding in --noreplace onto each line, instead.  I spoke with Zac Medico and he's modifying portage to have --noreplace override --newuse (as it should have anyway).  What this means is that this isn't really "FIXED" per se, but it is fixed on the catalyst side.  Once a new version of portage is out with this change made, it'll all just work.

<CIA-50> zmedico * r9513 portage/main/trunk/pym/_emerge/__init__.py: Make --noreplace take precedence over --newuse, as suggested by wolf31o2.

*grin*
Comment 13 Chris Gianelloni (RETIRED) gentoo-dev 2008-03-27 05:04:16 UTC
By the way, the portage patch in question is at http://dev.gentoo.org/~zmedico/tmp/noreplace.patch so you can test it out and see if it works with catalyst 2.0.6_pre16 (which has the catalyst side fixed)...
Comment 14 Eric Thibodeau 2008-05-09 00:03:38 UTC
*** Bug 220999 has been marked as a duplicate of this bug. ***
Comment 15 Eric Thibodeau 2008-05-09 00:18:06 UTC
I suspect that I hit the same problem but described it more telegraphically in Bug #220999.

Note that I am using Catalyst, version 2.0.6_pre17 (forgot to mention it in bug #220999)
Comment 16 Chris Gianelloni (RETIRED) gentoo-dev 2008-05-09 01:52:20 UTC
Yeah, I think I broke it again after _pre16... Can you test out the -9999 ebuild, which pulls from catalyst SVN trunk?  If it's fixed, I can roll up a new pre-release version with the fix.
Comment 17 Chris Gianelloni (RETIRED) gentoo-dev 2008-06-19 16:05:36 UTC
This is in catalyst 2.0.6, which is in the tree and stable.  If there's still a problem with this, please REOPEN this bug.

Thanks!