Summary
The install recipe in the justfile depends on build-release, which causes cargo build --release to re-run under sudo. On systems where rustup is installed per-user (the default for most Linux distros including CachyOS/Arch), root has no default toolchain configured, so the rebuild fails even though the user-level build succeeded moments earlier.
Steps to reproduce
- Fresh CachyOS install with rustup installed as a normal user (
rustup default stable set for the user)
- Follow the README exactly:
git clone https://codeberg.org/bhh32/cupola.git
cd cupola
sudo just install
Expected
Cupola builds and installs to /usr/local/bin.
Actual
cargo build --release
error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.
error: Recipe `build-release` failed on line 11 with exit code 1
Root cause
In the justfile:
install: build-release
sudo cp target/release/cupola /usr/local/bin
sudo cp data/*.desktop /usr/share/applications
sudo cp data/*.svg /usr/share/icons/hicolor/scalable/apps
When the whole recipe is run under sudo, the build-release dependency also runs under sudo, invoking cargo as root. Root's rustup has no default toolchain set.
Workaround
Build as user, then run the install steps manually:
just build-release
sudo cp target/release/cupola /usr/local/bin
sudo cp data/*.desktop /usr/share/applications
sudo cp data/*.svg /usr/share/icons/hicolor/scalable/apps
Suggested fix
Split the recipe so install only handles file copying, and add a separate recipe that does both. This way the user builds as themselves and only escalates for the copy step:
# Install (assumes binary is already built)
install:
sudo cp target/release/cupola /usr/local/bin
sudo cp data/*.desktop /usr/share/applications
sudo cp data/*.svg /usr/share/icons/hicolor/scalable/apps
# Build and install
install-all: build-release install
And update the README to:
git clone https://codeberg.org/bhh32/cupola.git
cd cupola
just build-release
sudo just install
Environment
- OS: CachyOS (Arch-based)
- Rust: stable (installed via rustup, user-level)
- just: installed
- libxkbcommon: installed
Summary
The
installrecipe in the justfile depends onbuild-release, which causescargo build --releaseto re-run under sudo. On systems where rustup is installed per-user (the default for most Linux distros including CachyOS/Arch), root has no default toolchain configured, so the rebuild fails even though the user-level build succeeded moments earlier.Steps to reproduce
rustup default stableset for the user)Expected
Cupola builds and installs to
/usr/local/bin.Actual
Root cause
In the justfile:
When the whole recipe is run under sudo, the
build-releasedependency also runs under sudo, invoking cargo as root. Root's rustup has no default toolchain set.Workaround
Build as user, then run the install steps manually:
Suggested fix
Split the recipe so
installonly handles file copying, and add a separate recipe that does both. This way the user builds as themselves and only escalates for the copy step:And update the README to:
Environment