Commit Graph

30 Commits

Author SHA1 Message Date
Daniel Fullmer
0a8007498f bash: use default PATH in FHS environments
If bash is executed within an environment where PATH is not set, it uses
the DEFAULT_PATH_VALUE compiled into bash to set PATH. In nixpkgs we set
this to /no-such-path by default. This makes sense in a nixpkgs/NixOS
environment since paths like /bin or /usr/bin should not be used.
However, when bash is used inside an FHS environment, this produces
results that differ from distributions which follow the FHS standard.

Before this change:
$ steam-run env -i /bin/bash -c 'echo $PATH'
/no-such-path

After this change:
$ steam-run env -i /bin/bash -c 'echo $PATH'
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
2022-02-27 15:59:39 -08:00
Linus Heckemann
f76bef6136
Merge pull request #145258 from Ma27/steam-resolv-conf-override
steam: fix `/etc/resolv.conf` reference in FHS env
2022-01-18 22:59:08 +01:00
Ben Pye
29b40b07db fhs-userenv-bubblewrap: allow additional arguments to bwrap 2022-01-01 16:53:27 -08:00
Maximilian Bosch
f3f82d8330
steam: fix /etc/resolv.conf reference in FHS env
It seems as if it's a problem if `/etc/resolv.conf` is a symlink to
`/run/systemd/resolve/stub-resolv.conf` which is the case when using
`systemd-resolved.service`:

    bwrap: Can't bind mount /oldroot/etc/resolv.conf on /newroot/etc/resolv.conf: Unable to mount source on destination: No such file or directory

I confirmed that by following the symlink of `/etc/resolv.conf`
(pointing to `/run/systemd/resolve/stub-resolv.conf`) with `readlink -f`
the issues are all gone.
2021-12-25 19:32:52 +01:00
Artturi
d9e8a587e1
Merge pull request #128126 from wentasah/chrootenv-opt 2021-11-19 04:40:34 +02:00
libjared
badb5a1af2 fhs-userenv-bubblewrap: add ca-certificates to fhs
In Arch Linux, many of the certs in /etc/ssl/certs/ are symlinks to
/etc/ca-certificates/extracted/. These symlinks are broken in the FHS
env.

This commit adds ca-certificates to the list of bind mounts, which fixes
connection issues with Steam, wget, etc on Arch Linux hosts.
2021-11-15 15:29:33 -08:00
Simon Bruder
ac5cd3a6a2
build-fhs-user-env-bubblewrap: add compatibility for pipewire alsa emulation
The NixOS pipewire module places its alsa compatiblity configuration in
/etc/alsa/conf.d/ instead of /etc/asound.conf. This commit enables
applications running in a bubblewrap fhs environment to use alsa on
systems running pipewire.
2021-07-10 12:50:52 +02:00
Michal Sojka
b681ad3254 buildFHSUserEnv: Allow having custom /opt in the FHS environment
buildFHSUserEnv is meant primarily for running 3rd-party software
which is difficult to patch for NixOS. Such software is often built to
run from /opt. Currently, running such a software from FHS environment
is difficult for two reasons:

1. If the 3rd-party software is put into the Nix store via a simple
   derivation (with e.g. installPhase = "dpkg-deb -x $src $out"), the
   content of /opt directory of that derivation does not appear in the
   FHSEnv even if the derivation is specified in targetPkgs. This is
   why we change env.nix.

2. If using buildFHSUserEnvChroot and the host system has the /opt
   directory, it always gets bind-mounted to the FHSEnv even if some
   targetPkgs contain /opt (NB buildFHSUserEnvBubblewrap does not have
   this problem). If that directory is not accessible for non-root
   users (which is what docker's containerd does with /opt :-(), the
   user running the FHSEnv cannot use it.

   With the change in chrootenv.c, /opt is not bind-mounted to the
   container, but instead created as user-modifiable symlink to
   /host/opt (see the init attribute in
   build-fhs-userenv/default.nix). If needed, the user can remove this
   symlink and create an empty /opt directory which is under his/her
   control.
2021-06-27 08:33:51 +02:00
Jonathan Ringer
73a0b6c826 buildFHSUserEnvBubblewrap: add dieWithParent option, and /etc/nix
Allows for processes which fork to not be immediately
killed when the parent process dies.
2021-05-02 13:38:52 -07:00
Matthew Mazzanti
eb268eabad fhs-userenv-bubblewrap: Add store path to readlink
Commit df4761 added a call to readlink, which fails if it is not in the
user's path when run. Updated the readlink call to pull from the
coreutils store path directly.
2021-03-11 08:50:15 -05:00
Bernardo Meurer
cdcaafc3fe
Merge pull request #114024 from LuigiPiucco/pressure-vessel
steam: fix proton versions with pressure-vessel
2021-02-23 19:20:12 +00:00
Luigi Sartor Piucco
548d50d695 build-fhs-userenv-bubblewrap:->writeShellScriptBin 2021-02-23 11:47:40 -03:00
Luigi Sartor Piucco
12c2eae2c5 build-fhs-userenv-bubblewrap: add folders comment 2021-02-23 11:44:16 -03:00
André Silva
770cd71936
build-fhs-userenv: fix ssl certificates mount point 2021-02-22 19:54:04 +00:00
Luigi Sartor Piucco
baaec29531 fhs-bubblewrap: mount cache on 32 bit glibc too 2021-02-22 14:35:45 -03:00
Luigi Sartor Piucco
bdd9027760 fhs-bubblewrap: merge /usr/share from both archs 2021-02-22 14:35:45 -03:00
Benedikt Morbach
d5cbb650e1 fhs-userenv-bubblewrap: add ld.so.conf/cache to fhs 2021-02-22 14:35:44 -03:00
Benedikt Morbach
df4761d450 fhs-userenv-bubblewrap: Preserve symlinks
Preserve top-level symlinks such as /lib -> /usr/lib.

This allows nested containers such as Steam's new runtime to remount
/usr if they need to and then run unmodified binaries that reference
e.g. /lib/ld-linux-x86-64.so.2

Before, we would mount the fully resolved host directory at /lib and
thus the dynamic loader would always be the one from the host filesystem.
2021-02-22 14:35:44 -03:00
André Silva
34fae590bf
build-fhs-userenv-bubblewrap: don't bind /etc/fonts from fhs environment 2021-01-26 00:53:59 +00:00
André Silva
fe49d856b0
build-fhs-userenv: bind /etc/profiles 2021-01-26 00:41:50 +00:00
André Silva
65de42b9cc
build-fhs-userenv-bubblewrap: remove unused variable 2021-01-26 00:41:01 +00:00
Pavol Rusnak
a6ce00c50c
treewide: remove stdenv where not needed 2021-01-25 18:31:47 +01:00
Jonathan Ringer
6c52434eb0
buildFHSUserEnvBubblewrap: expand unshare options 2020-12-08 18:40:51 -08:00
Atemu
74c4a55e10 buildFHSUserEnvBubblewrap: use arrays for constructing argument list
Generally a cleaner way of doing it and prevents issues with spaces in paths

Used to fix #97234 but #101967 already didt this with a smaller scope
2020-11-22 19:26:59 +01:00
Jonathan Ringer
ec38df81a9 buildFHSUserEnvBubblewrap: fix whitespace with root directories 2020-10-30 22:52:58 -07:00
Jörg Thalheim
b1d86d0e51 build-fhs-user-env-bubblewrap: consistent camelCase 2020-08-17 10:05:25 +02:00
Michael Eden
8c91b3c5b7 fhs-userenv-bubblewrap: bind mount host's devfs
Allows us to talk to devices
2020-08-17 08:49:34 +02:00
Michael Eden
2da4f24e22 fhs-userenv-bubblewrap: bind mount parts of host etc directly 2020-08-17 08:49:29 +02:00
Michael Eden
2ddb43ec24 fhs-userenv-bubblewrap: change to using bubblewrap over chrootenv 2020-08-17 08:49:24 +02:00
Atemu
fafbfd2305 fhs-userenv-bubblewrap: start with build-fhs-userenv
Just here to track @illegalprime's actual changes to build-fhs-userenv in the
next commits
2020-08-17 08:48:31 +02:00