Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 559860 - stage3 (or another package) should provide an official script to prepare chroots
Summary: stage3 (or another package) should provide an official script to prepare chroots
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Release Media
Classification: Unclassified
Component: Stages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-07 11:15 UTC by Pacho Ramos
Modified: 2023-05-18 08:33 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2015-09-07 11:15:08 UTC
Currently you can find a lot of different instructions in wiki, forums, IRC comments... about what commands people need to run to mount all the stuff (/dev, /dev/pts, /sys...) needed to make a chroot to run Gentoo inside it.

From my point of view, either stage3 or another package (baselayout?) should provide an *official* script that we could run or read as reference to mount all properly before trying to chroot into it, otherwise people will still get confused with the dirs they need to mount and the options they need to use.

Thanks a lot
Comment 1 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2017-02-06 21:45:25 UTC
I disagree with this being done through stages / catalyst.
I'm fine with this being added to a @system package and thus getting in the stages through that.
I'm reassigning this to the base-system team.
Comment 2 Alexis Ballier gentoo-dev 2017-02-06 21:59:43 UTC
Not sure what you mean here.

If that's just about running gentoo inside gentoo, I think we should probably recommend lxc instead of chroot, which should provide better isolation (or at least control over it) and already has scripts:
https://wiki.gentoo.org/wiki/LXC#Automatic_setup:_LXC_standard_Gentoo_template_script
IIRC this works on other distros too.




If that's about having an alias for mounting stuff when doing a first install, that's more releng stuff and this doesn't belong to @system nor stage3 but rather to the install medias. This would require handbook updates and also imply that the handbook relies on booting from an official gentoo media, which I don't think is currently the case, and hence I'm not really convinced of its usefulness.
Comment 3 SpanKY gentoo-dev 2017-02-14 06:39:56 UTC
at this point, most of the container tech is in the kernel, so lxc is not needed at all.  you can get the same level of isolation with the `unshare` command.

while i would like a shell script that we could ship with images, i know it'd grow out of control quickly to try and support things sanely.  i have a ~200 line script already that i use everywhere, but it does exactly what i expect.  i suspect everyone will want to do their own thing instead.

what if it was a standalone package people had to emerge ?  either independent of gentoolkit, or part of it ?
Comment 4 Joshua Kinard gentoo-dev 2017-02-14 07:42:48 UTC
(In reply to SpanKY from comment #3)
> at this point, most of the container tech is in the kernel, so lxc is not
> needed at all.  you can get the same level of isolation with the `unshare`
> command.
> 
> while i would like a shell script that we could ship with images, i know
> it'd grow out of control quickly to try and support things sanely.  i have a
> ~200 line script already that i use everywhere, but it does exactly what i
> expect.  i suspect everyone will want to do their own thing instead.
> 
> what if it was a standalone package people had to emerge ?  either
> independent of gentoolkit, or part of it ?

How about a catalyst target?  Start from a stage3 or stage4 or whatever, and end up with a chroot-in-a-tarball?  Unpack and chroot in.
Comment 5 SpanKY gentoo-dev 2017-02-14 18:18:34 UTC
(In reply to Joshua Kinard from comment #4)

this isn't about creating a tarball, it's about entering a chroot

i.e. you don't just run `sudo chroot /some/path`.  you have to do a lot more stuff to have a sane environment like unsharing namespaces and mounting paths.
Comment 6 SpanKY gentoo-dev 2017-02-16 07:04:11 UTC
this is mostly done (at least enough for a 0.1 release).  i'll start with a new repo/project and see how it goes.
Comment 7 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2017-02-16 10:44:23 UTC
(In reply to SpanKY from comment #6)
> this is mostly done (at least enough for a 0.1 release).  i'll start with a
> new repo/project and see how it goes.

I suggest we add it to the install-cd / admin-cd targets.
Comment 8 Andrii Pravorskyi 2018-06-08 20:06:24 UTC
(In reply to SpanKY from comment #6)
> this is mostly done (at least enough for a 0.1 release).  i'll start with a
> new repo/project and see how it goes.

Hello! Do you have public repo already?
Comment 9 Morteza 2023-05-16 20:55:38 UTC
hmm no update on this bug? it's really pain in arse to renter all mount commands
everytime for chroot; making a gentoo-chroot is that hard?
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-16 20:56:20 UTC
We actually recently added arch-chroot (and genfstab) to install media.
Comment 11 Pacho Ramos gentoo-dev 2023-05-18 08:33:30 UTC
is it meant for general use? I wondered about why the script is not mentioned in the handbook (and, then, likely not being used by most people) and it seems it had some issues in the past:
https://wiki.gentoo.org/wiki/Handbook_Talk:AMD64/Installation/Base#Add_warning_about_arch-chroot

Maybe the issues were fixed and can finally be mentioned 

(In reply to Morteza from comment #9)
> hmm no update on this bug? it's really pain in arse to renter all mount
> commands
> everytime for chroot; making a gentoo-chroot is that hard?

I don't remember why I opened this back in the days ;), but I agree that one of the things that bothered me last time I installed Gentoo was needing to open the browser, visit the handbook page and copying and pasting each command to redo the chroot (I was having some stability issues on those systems due to a graphics driver bug that made be need to reboot and re-enter chroot multiple times)

Thanks