From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: John Kehayias <john.kehayias@protonmail.com>,
"guix-devel@gnu.org" <guix-devel@gnu.org>
Subject: Re: [WIP Patch] Adding an FHS container to guix shell
Date: Thu, 14 Jul 2022 16:59:36 +0200 [thread overview]
Message-ID: <47c56b0d58dbcf4d48b5a4a6bc70d9955cb86a91.camel@gmail.com> (raw)
In-Reply-To: <wRurC6zEkibzf7R3zDyicYmqKPN1NUSJ6gAS5qvTrsL-MmfRTpbJOqbBoIhjhEGYFMswI0RvU3tDSTldLKot9fP21R4XW_bXwMKbL4RE7P4=@protonmail.com>
Hi John,
Am Dienstag, dem 12.07.2022 um 15:59 +0000 schrieb John Kehayias:
> Hi Guixers,
>
> Apologies for the long email, so let me start with the punchline:
> attached is a diff which adds an '--fhs-container' (or -F) option to
> guix shell/environment to set up an FHS-like container. This includes
> the usual /lib directory and a glibc which loads (a generated in the
> container) /etc/ld.so.cache. This should allow running most things
> that expect a more "typical" Linux environment. Give it a try!
>
> First, I wanted to ask how people feel about such a feature.
> Obviously, one use is to run pre-built binaries (isolated!), but this
> is also handy for setting up development environments when not able
> (or wanting) to with Guix packages only. For example, using the
> rustup [0] scripts, pretty much anything JS, or just following
> typical Readme instructions to try out something new before
> packaging. I won't debate the details here other than to say this
> topic comes up with Guix and I think it is yet another useful tool
> for guix shell and containers.
>
> Nix, which I know almost nothing about, does have some FHS
> container/environment options as well.
>
> Next, some technical points about implementation, which I hope will
> be informed by the first question and what we want from this tool.
> There are two main things needed for the FHS-container:
>
> 1. Set up directories like /lib. This is easy enough and can be done
> currently, like in roptat's response here [1] by building the profile
> first to know where to link to. Note that it is easier to do it
> within the environment code since we have access to the profile even
> if it is being built for the first time. There are some wrinkles with
> linking something like /bin since we currently add a link for sh; see
> the comments in my diff.
>
> Right now I did not handle a multi-arch setup, though that shouldn't
> be too difficult. This would probably require an option to build
> either all or specified packages for an additional arch, like 32bit
> in a 64bit system, and make the libraries available (/lib32 or
> something). Though may run into a union-build bug [2]?
>
> 2. Typically binaries will expect the ld loader to use
> /etc/ld.so.cache for finding libraries. So, I made a glibc package
> that removes our dl cache patch to restore this behavior. It seems
> enough to add this as a default package to the container, though I
> commented out an option to automatically graft everything with this
> glibc. Both worked for me, but grafting didn't seem necessary.
Would it make sense to keep our libc, but also symlink the cache to its
FHS place? Or do we need to patch our libc so that this cache is tried
if a Guix-specific one isn't found?
> The second step is to generate the ld cache, which is done with a
> simple startup script in the container, after creating a temporary
> ld.so.conf (our ldconfig doesn't use the usual default directories?).
> I'm sure I found the hackiest way to do this, but it works :) Again,
> this could be possible without modifying guix containers, but this is
> easier. (For example, you can see work done by myself and others at a
> certain non-free channel to do exactly this.)
>
> Some questions going forward, besides overall cleanup and tweaking of
> the code (which I provided comments in for some details, please see
> there). It might be nice to be able to extend containers more easily
> with setup scripts, though again this can be done by making some
> Guile scripts to wrap a container and making a package around that
> (e.g. from the non-free channel). What kind of extensions would be
> useful to expose? I think I saw some talk on IRC recently about how
> to manage env variables when using guix shell. Perhaps an extended
> manifest format for shell?
>
> Relatedly and more generally, perhaps it would be good to have
> somewhere (cookbook?) some recipes of useful guix shell container
> incantations. Sharing what you need from the host for graphical
> programs can be a little tricky to figure out. We have the --network
> option, maybe others would be useful? Or some base package lists for
> development: just like we have our various -build-system's, a package
> list with typical library sets might be a nice convenience.
>
> What about other uses for this container, like providing an isolated
> environment to build and run software we can't do fully with
> bootstrap and sources (like JS)? Could this become some stop-gap to
> allow people to work with these ecosystems in a more controlled way
> within Guix? Or an alternative build environment? Not entirely sure
> what this could mean, just thinking out loud.
I don't think we should rely on FHS containers in the build system.
It's nice to have such a feature as a user, who really needs
$ELECTRON_APP and doesn't care about the fact that it's a packaging
nightmare, but on a system level, we ought to provide abstractions that
are meaningful and helpful to *everyone*, and FHS containers increase
both the complexity and the failure potential. See also antioxidant-
build-system as an example for making Rust packaging sane (we'll likely
need a similar effort for JS).
> [...]
> +;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
Is this the right year?
> + -F, --fhs-container run command within an isolated FHS
> container"))
Rather than adding "--fhs-container" as an alternative to --container,
I'd like something like "--emulate-fhs", which as the "--networking"
option is to be *combined* with -C. This makes the interface more
symmetric.
> + (symlink lib-dir "/lib64")
> + (symlink lib-dir "/lib")
You'll probably want to split 32-bit libraries (if any) and 64-bit ones
here. Also, bear in mind that certain architectures are 32-bit only.
Cheers
next prev parent reply other threads:[~2022-07-14 14:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 15:59 [WIP Patch] Adding an FHS container to guix shell John Kehayias
2022-07-12 17:34 ` Vagrant Cascadian
2022-07-15 15:41 ` John Kehayias
2022-07-13 2:11 ` Dominic Martinez
2022-07-13 23:27 ` Blake Shaw
2022-07-15 15:44 ` John Kehayias
2022-07-14 10:01 ` zimoun
2022-07-15 15:46 ` John Kehayias
2022-07-14 14:59 ` Liliana Marie Prikler [this message]
2022-07-15 16:00 ` John Kehayias
2022-07-15 13:43 ` Maxim Cournoyer
2022-07-15 16:35 ` John Kehayias
2022-07-15 13:45 ` Maxim Cournoyer
2022-07-18 11:40 ` Ludovic Courtès
2022-07-20 21:22 ` John Kehayias
2022-07-20 23:49 ` Maxime Devos
2022-07-21 3:15 ` John Kehayias
2022-07-21 0:20 ` debbugs irritation Was: " Csepp
2022-07-21 4:18 ` John Kehayias
2022-07-21 16:45 ` zimoun
2022-07-21 20:22 ` Csepp
2022-08-18 10:55 ` zimoun
2022-08-19 22:13 ` jbranso
2022-07-21 4:25 ` John Kehayias
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47c56b0d58dbcf4d48b5a4a6bc70d9955cb86a91.camel@gmail.com \
--to=liliana.prikler@gmail.com \
--cc=guix-devel@gnu.org \
--cc=john.kehayias@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).