-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Problem
I'm trying to compile Rust in a Docker container (on Linux/Debian) with a read-only root filesystem (--read-only), and a tmpfs to work in (--tmpfs /home/dev/build:exec). After running the ./x.py build script, I end up with the following error:
error: Read-only file system (os error 30)
failed to run: /home/dev/build/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /home/dev/build/rust/src/bootstrap/Cargo.tomlThe problem is that this error message doesn't say which path it tried to write to.
I ran the failing command again with strace to find that the missing part is $HOME/.cargo:
$ strace /home/dev/build/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /home/dev/build/rust/src/bootstrap/Cargo.toml
...
mkdir("/home/dev/.cargo", 0777) = -1 EROFS (Read-only file system)
...
I expected the error message to indicate which path triggered the EROFS (Read-only file system) error, for example:
error: Cannot create "/home/dev/.cargo": Read-only file system (os error 30)
That would be more user-friendly :)
Steps
- Start a Docker container (or a similar setup) with a read-only root filesystem, and a tmpfs in
$HOME/build(with theexecflag enabled) - Clone
https://github.com/rust-lang/rustinside$HOME/build - Run
./x.pyinside$HOME/build/rust
Possible Solution(s)
I couldn't locate where this specific mkdir occurs in the code, but I'd suggest to add the faulty path to the I/O error message.
Notes
Output of cargo version:
cargo 1.38.0-beta (e853aa976 2019-08-09)