Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]Stage 1 vs Stage 3 system set difference and history
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Troopo
Guru
Guru


Joined: 14 Jun 2015
Posts: 310

PostPosted: Tue Jun 08, 2021 3:53 pm    Post subject: [SOLVED]Stage 1 vs Stage 3 system set difference and history Reply with quote

Hi,

As the title states, i'm currently migrating my old system to a new system and i started investigating the installed packages and sets, i'm trying to understand a few things related to the @system sets and the stage history.

Going with vanilla linux without systemd the @system set is a follows:

Base(profiles/base/packages):
Code:

app-arch/bzip2
app-arch/gzip
app-arch/tar
app-arch/xz-utils
app-shells/bash
net-misc/iputils
net-misc/rsync
net-misc/wget
sys-apps/baselayout
Sys-apps/coreutils
sys-apps/diffutils
sys-apps/file
sys-apps/findutils
sys-apps/gawk
sys-apps/grep
sys-apps/kbd
sys-apps/kmod
sys-apps/less
sys-apps/sed
sys-apps/shadow
sys-apps/which
sys-devel/binutils
sys-devel/gcc
sys-devel/gnuconfig
sys-devel/make
sys-devel/patch
sys-fs/e2fsprogs
sys-process/procps
sys-process/psmisc
virtual/dev-manager
virtual/editor
virtual/libc
virtual/man
virtual/os-headers
virtual/package-manager
virtual/pager
virtual/service-manager
virtual/ssh


Then some additional extension of this at linux default (profiles/default/linux/packages):
Code:

sys-apps/busybox
sys-apps/iproute2
sys-apps/man-pages
sys-apps/net-tools
sys-apps/util-linux


The Stage 1 build file (/gentoo/profiles/default/linux/packages.build) vs the above has the following additional packages:
Code:

sys-apps/makedev
sys-apps/portage
sys-devel/autoconf
sys-devel/automake
sys-devel/gettext
sys-devel/flex
sys-devel/libtool
sys-devel/bison
virtual/pkgconfig


Which i can understand since stage 1 has more toolchain related stuff, but it's also missing some packages which are also kinda basic:

Code:

net-misc/iputils
sys-apps/kbd
sys-apps/kmod
sys-fs/e2fsprogs
sys-process/procps
sys-process/psmisc
virtual/dev-manager
virtual/man
virtual/package-manager
virtual/pager
virtual/service-manager
virtual/ssh
sys-apps/busybox
sys-apps/iproute2
sys-apps/man-pages
sys-apps/util-linux


So assuming i picked the right files, this is just a stage 1 vs stage 3 difference right?

Also Side question the base package mentions bash:0, i thought the default slot is 0 why mention it here?

Regarding profiles, they just set some packages\use flags to make things work and avoid conflicts assuming one is going down a certain path, can i create my custom profile if i think the profiles are a little bloated for my uses? or is it not recommended?


Last edited by Troopo on Sat Jun 19, 2021 8:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Tue Jun 08, 2021 4:20 pm    Post subject: Reply with quote

Troopo,

stage1 is just your toolchain bits and their dependencies.

Look at the script /usr/portage/scripts/bootstrap.sh or wherever your ::gentoo repo is.
Its not possible to boot into a stage1 or do anything other that configure your system and run that script.
You do it in the chroot. The wayback machine still has stage1 install instructions

That link explains stage2 and stage3, so I'll leave you to read that then ask questions.

If you want to make your own profile, carry on. Do it in your overlay though.
You can make local adjustments in /etc/portage/profile, so its up to you how you achieve what you want.
Its also possible to mix and match, since profile element are hierarchical, which allows you to make your own profile(s) that inherit things from the ::gentoo repo provided profile.
Profiles are set by the devs and distributed with the repo, so your profiles would change if something they inherited changed.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Troopo
Guru
Guru


Joined: 14 Jun 2015
Posts: 310

PostPosted: Tue Jun 08, 2021 10:43 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Troopo,

stage1 is just your toolchain bits and their dependencies.

Look at the script /usr/portage/scripts/bootstrap.sh or wherever your ::gentoo repo is.
Its not possible to boot into a stage1 or do anything other that configure your system and run that script.
You do it in the chroot. The wayback machine still has stage1 install instructions

That link explains stage2 and stage3, so I'll leave you to read that then ask questions.

If you want to make your own profile, carry on. Do it in your overlay though.
You can make local adjustments in /etc/portage/profile, so its up to you how you achieve what you want.
Its also possible to mix and match, since profile element are hierarchical, which allows you to make your own profile(s) that inherit things from the ::gentoo repo provided profile.
Profiles are set by the devs and distributed with the repo, so your profiles would change if something they inherited changed.


Thank you NeddySeagoon :)

Only a couple of questions:

1. Why does Stage 1 bootstrap has to run several times? isn't one time enough?
2. What removes the missing toolchain packages from stage 2? or is it just built without them?
3. Regarding my slot question from before, the base package mentions bash:0, i thought the default slot is 0 why mention it here?
4. If i take the amount of packages in @selected + @system and compare that to @world it has 2 packages less than world. I actually have sys-devel/gcc and virtual/libc in both @selected and @system, how can i sort this out, deselecting only affects world
4a. how is it possible that @installed has 4 times more packages than @world? doesn't @world contain dependencies as well?
For example dev-libs/lzo is not listed anywhere but @installed and there are several packages that depend on it like app-emulation/qemu
5. probably an unrelated question but people always say "If you're re-emerging, always use --oneshot" can the world set have duplicates or what is the reasoning behind this?
Back to top
View user's profile Send private message
Troopo
Guru
Guru


Joined: 14 Jun 2015
Posts: 310

PostPosted: Sun Jun 13, 2021 10:17 pm    Post subject: Reply with quote

Bump
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Sun Jun 13, 2021 11:13 pm    Post subject: Reply with quote

Troopo,

Quote:
1. Why does Stage 1 bootstrap has to run several times? isn't one time enough?

Yes. Once is enough.

Quote:
2. What removes the missing toolchain packages from stage 2? or is it just built without them?

Stage2 is the @system set packages. That will build stage1 packages again.
However, bootstrap.sh applies its own USE flags, so the rebuild picks up your settings.

Quote:
4a ... doesn't @world contain dependencies as well?

World only contains packages you explicitly install. The dependencies are managed by portage and the ebuilds.
They may change with time.
World also implictily includes @system so packages like gcc should never be in world unless you have a reason to keep an old version.

Quote:
5. probably an unrelated question but people always say "If you're re-emerging, always use --oneshot" can the world set have duplicates or what is the reasoning behind this?

It is a related question. --oneshot prevents the package being recorded in the world file.
When you emerge a packages already in world, then --oneshot does not matter. When you are fixing problems, it matters a lot.
Portage and ebuilds manage dependencies.
Lets say you have a problem and
Code:
emerge foo/bar
whicd in a dependency of something else (no --oneshot).
Portage adds it world. In a few months time the package no longer depends on foo/bar and foo/bar is removed from portage.

This is a problem. Portage tries to keep foo/bar installed as its in world but it can't as its not in ::gentoo any more.
Portage will shout at you. The fix is to discover that foo/bar is an installed orphan and remove it, or to use --oneshot, so it doesn't happen.
In practice you will do both.

Duplication between sets does not matter. emerge will install things just once, unless you run multiple instances of emerge. Avoid that unless you know that the dependency trees are disjoint.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Troopo
Guru
Guru


Joined: 14 Jun 2015
Posts: 310

PostPosted: Mon Jun 14, 2021 10:38 pm    Post subject: Reply with quote

NeddySeagoon thanks again!

Can i ask why did you skip questions 3-4?

I think i solved 4 by running emaint which cleaned the duplicates,

Quote:

Quote:
1. Why does Stage 1 bootstrap has to run several times? isn't one time enough?

Yes. Once is enough.

So if i understand correctly:
Stage 1 is the toolchain built from bootstrap.sh and configuration
Stage 2 is stage 1
Stage 3 is stage 2 + system set
Stage 4 is stage 3 + kernel and bootloader

"Stage 2 tarballs contain the same packages as a stage 1 tarball with one caveat: stage 2 tarballs are compiled from a stage 1 tarball. This is to ensure the stage 1 tarball contains the tool chain necessary to reproduce itself. "
I still don't understand the purpose of stage 2 or how is it building from stage 1 if stage 1 should be binaries not sources or is it just running bootstrap again?


Quote:

Quote:
5. probably an unrelated question but people always say "If you're re-emerging, always use --oneshot" can the world set have duplicates or what is the reasoning behind this?

It is a related question. --oneshot prevents the package being recorded in the world file.
When you emerge a packages already in world, then --oneshot does not matter. When you are fixing problems, it matters a lot.
Portage and ebuilds manage dependencies.
Lets say you have a problem and
Code:
emerge foo/bar
whicd in a dependency of something else (no --oneshot).
Portage adds it world. In a few months time the package no longer depends on foo/bar and foo/bar is removed from portage.

This is a problem. Portage tries to keep foo/bar installed as its in world but it can't as its not in ::gentoo any more.
Portage will shout at you. The fix is to discover that foo/bar is an installed orphan and remove it, or to use --oneshot, so it doesn't happen.
In practice you will do both.

Duplication between sets does not matter. emerge will install things just once, unless you run multiple instances of emerge. Avoid that unless you know that the dependency trees are disjoint.

Oh ok i get it, but how can i know or see the change coming ahead of time? i also remember gentoo has a utility to search for orphan packages.
Back to top
View user's profile Send private message
Troopo
Guru
Guru


Joined: 14 Jun 2015
Posts: 310

PostPosted: Sat Jun 19, 2021 10:09 am    Post subject: Reply with quote

Bump
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Sat Jun 19, 2021 2:03 pm    Post subject: Reply with quote

Troopo,

I don't know all the answers :)

stage1 is the minimal set of binaries you need to chroot into something.
bootstrap.sh does not rebuild it all and it does the build with its own USE flags.
To see what it does and the USE flags it uses read the script.

bootstrap.sh allows you to change CHOST. A long time ago that was important. It still may be to users that are installing on an i586 system.

If you want to put your own stage1 approximation together, that old guide will point you in the right direction.
The method will work but the versions will have changed. You may need more packages now too.

If you are really really curious, try this historical stage1 That will get you a Gentoo from 2003 :)
It's of no practical use today. :)

For an up to date stage1,
Code:
emerge catalyst
and do what releng does today.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Troopo
Guru
Guru


Joined: 14 Jun 2015
Posts: 310

PostPosted: Sat Jun 19, 2021 3:06 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Troopo,

I don't know all the answers :)

stage1 is the minimal set of binaries you need to chroot into something.
bootstrap.sh does not rebuild it all and it does the build with its own USE flags.
To see what it does and the USE flags it uses read the script.

bootstrap.sh allows you to change CHOST. A long time ago that was important. It still may be to users that are installing on an i586 system.

If you want to put your own stage1 approximation together, that old guide will point you in the right direction.
The method will work but the versions will have changed. You may need more packages now too.

If you are really really curious, try this historical stage1 That will get you a Gentoo from 2003 :)
It's of no practical use today. :)

For an up to date stage1,
Code:
emerge catalyst
and do what releng does today.


Thanks!

It's ok not knowing everything, i accept i don't know answers but if you just skip things, i don't know why did you skip those things, mistakes happen...
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Sun Jun 20, 2021 5:14 pm    Post subject: Reply with quote

Troopo,

That's a good point. I will keep it in mind.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum