Skip to content
Latchkey

Rust "rustup is being run from a directory" / self-update Disabled in CI

A pre-installed, distro-managed rustup refuses to install or update toolchains because self-update is disabled or it lives in a non-default location. The package-managed rustup is locked down, so toolchain operations fail.

What this error means

A rustup toolchain install or rustup self update step fails noting self-update is disabled, rustup is managed by the system, or it runs from a non-default location. The base rustup works but cannot add toolchains.

rustup
error: self-update is disabled for this build of rustup
note: you should probably use your system package manager to update rustup
# or:
error: cannot install while rustup is in a non-default location

Common causes

Distro-managed rustup is locked down

A rustup installed via apt/apk/dnf often disables self-update and pins toolchain management to the package manager, so direct rustup toolchain install is blocked.

RUSTUP_HOME in a non-default path

A system install places rustup outside ~/.rustup; rustup then refuses certain install operations from that non-default location.

How to fix it

Install upstream rustup via rustup-init

Use the official installer so you control toolchain management.

Terminal
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
. "$HOME/.cargo/env"
rustup toolchain install stable

Or use a setup action that manages its own rustup

A maintained toolchain action installs a self-managed rustup for the job.

.github/workflows/ci.yml
- uses: dtolnay/rust-toolchain@stable

How to prevent it

  • Use the upstream rustup-init installer rather than the distro package in CI.
  • Let a setup action own rustup so toolchain installs are unrestricted.
  • Keep RUSTUP_HOME/CARGO_HOME at default, writable locations.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →