ostree-prepare-root: Fix running with musl
musl libc's implementation of `realpath` works by opening the path and then doing a lookup in `/proc/self/fd` to find the canonical path. This fails if `/proc` is not mounted. This causes problems for us if `ostree-prepare-root` is `init` as `/proc` won't be mounted. We have to mount `/proc` anyway for `/proc/cmdline` so this fix just expands the scope over which `/proc` is mounted to include both our `realpath` calls. See also: * http://www.openwall.com/lists/musl/2016/06/08/2 and * http://git.musl-libc.org/cgit/musl/tree/src/misc/realpath.c?id=e738b8cbe64b6dd3ed9f47b6d4cd7eb2c422b38d Closes: #485 Approved by: cgwalters
This commit is contained in:
1 parent
5424404813
commit
2aacc6912b
2 files changed
+28
-18
No files matched your search
@@ -4,7 +4,14 @@ this_script="${BASH_SOURCE:-$(readlink -f "$0")}"
|
||||
|
||||
setup_bootfs() {
|
||||
mkdir -p "$1/proc" "$1/bin"
|
||||
echo "quiet ostree=/ostree/boot.0 ro" >"$1/proc/cmdline"
|
||||
|
||||
# We need the real /proc mounted here so musl's realpath will work, but we
|
||||
# want to be able to override /proc/cmdline, so bind mount.
|
||||
mount -t proc proc "$1/proc"
|
||||
|
||||
echo "quiet ostree=/ostree/boot.0 ro" >"$1/override_cmdline"
|
||||
mount --bind "$1/override_cmdline" "$1/proc/cmdline"
|
||||
|
||||
touch "$1/this_is_bootfs"
|
||||
cp "$(dirname "$this_script")/../ostree-prepare-root" "$1/bin"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user