Skip to content

Commit 9a44326

Browse files
committed
BUG: Bind-mount even more files for better OOTBE
1 parent 95b280b commit 9a44326

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ process invocations via **`$BWRAP_ARGS` environment variable**. E.g.:
7777

7878
```sh
7979
BWRAP_ARGS='--bind /opt /opt' \
80-
python -c 'import os; print(os.listdir("/opt"))'
80+
sandbox-run ./NVIDIA-Driver-Installer.run
8181
```
8282

8383
For details, see `bubblewrap --help` or [`man 1 bwrap`](https://manpages.debian.org/unstable/bwrap).
@@ -104,6 +104,7 @@ is lost upon container termination.
104104

105105
See `bwrap` switches [`--seccomp FD` and `--add-seccomp-fd FD`](https://manpages.debian.org/unstable/bubblewrap/bwrap.1.en.html#:~:text=Lockdown%20options%3A-,--seccomp%20fd,-Load%20and%20use).
106106

107+
107108
#### Runtime monitoring
108109

109110
If **environment variable `VERBOSE=`** is set to a non-empty value,

sandbox-run

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,28 @@ split_args_by_lf () { printf '%s' "$1" | case "$1" in *$lf*) cat ;; *) tr ' ' '\
4040

4141
# RO-bind select paths
4242
paths='
43+
/bin
4344
/etc/alternatives
4445
/etc/resolv.conf
4546
/etc/ssl
4647
/etc/hosts
4748
/etc/pki
49+
/etc/pkcs11
4850
/etc/ld.so.cache
51+
/etc/ld.so.conf.d
4952
/etc/localtime
50-
/etc/mtab
5153
/etc/os-release
5254
/etc/timezone
5355
/lib
5456
/lib64
5557
/run/dbus/system_bus_socket
58+
/sbin
5659
/usr
5760
'
61+
# ld.so.conf.d: https://containertoolbx.org/doc/#ldconfig8
62+
RW_paths='
63+
/etc/ld.so.conf.d
64+
'
5865

5966
# Support BWRAP_ARGS passed to the process as well as via .env file
6067
prev_BWRAP_ARGS="${BWRAP_ARGS:-}"
@@ -97,16 +104,18 @@ warn "exec bwrap [...] $formatted_cmdline"
97104

98105
# shellcheck disable=SC2046
99106
bwrap \
100-
--dir /tmp \
107+
--tmpfs /tmp \
101108
--tmpfs /run \
102109
--proc /proc \
103110
--dev /dev \
111+
--symlink /run /var/run \
104112
--symlink /tmp /var/tmp \
105113
--symlink /usr/bin /bin \
106114
--symlink /usr/bin /sbin \
107115
--dev-bind-try /dev/fuse /dev/fuse \
108116
--ro-bind "$bin" "$bin" \
109117
$(set +x; for path in $paths; do [ ! -e "$path" ] || printf -- '--ro-bind-try %s %s ' "$path" "$path"; done) \
118+
$(set +x; for path in $RW_paths; do [ ! -e "$path" ] || printf -- '--bind-try %s %s ' "$path" "$path"; done) \
110119
--bind "$cwd" "$cwd" \
111120
--chdir "$cwd" \
112121
--clearenv \

tests/smoke-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -eu
33

44
. "${0%/*}/_init.sh"
55

6-
sandbox-run sh -c 'awk' # Awk is available
6+
sandbox-run sh -c 'awk' # Awk via /etc/alternatives
77

88
sandbox-run sh -c 'touch "$HOME/success"'
99

0 commit comments

Comments
 (0)