jdx/mise · error

is still not writable after bootstrap

Error message

{} is still not writable after bootstrap

What it means

After bootstrap runs sudo mkdir/chown to create the brew prefix and make it writable, it re-checks writability. If the prefix is still not writable by the current user — sudo failed silently, a read-only filesystem, sudoers denied the command, or something re-owned the tree — mise bails rather than continuing with a broken prefix.

Solutions

  1. Run once interactively so sudo can prompt, or configure passwordless sudoers for mkdir/chown on the prefix
  2. Manually create and chown the prefix: `sudo mkdir -p <prefix> && sudo chown -R $USER <prefix>` then re-run
  3. Check the mount (`findmnt <prefix>`) — remount read-write or move MISE_SYSTEM_BREW_PREFIX to a writable location

Example fix

# before
mise bootstrap packages apply   # fails in non-interactive CI
# after (CI)
sudo mkdir -p /home/linuxbrew/.linuxbrew && sudo chown -R "$(id -un)" /home/linuxbrew/.linuxbrew
Defensive patterns

Strategy: validation

Validate before calling

p="${MISE_SYSTEM_BREW_PREFIX:-/home/linuxbrew/.linuxbrew}"
[ -w "$p" ] || echo "prefix $p not writable — expect sudo bootstrap"

Try / catch

try {
  bootstrapPackages();
} catch (e) {
  if (String(e).includes('still not writable after bootstrap')) {
    // sudo likely failed non-interactively; pre-create with correct ownership
    run(`sudo mkdir -p ${prefix} && sudo chown -R ${user} ${prefix}`);
    bootstrapPackages();
  } else throw e;
}

Prevention

When it happens

Trigger: bootstrap executed `sudo mkdir`/`sudo chown` for the prefix, but writable(&prefix) still returns false afterwards: sudo requires a password (non-interactive run), sudoers lacks permission, the filesystem is read-only, or chown targeted the wrong tree.

Common situations: Running in CI without a TTY where `sudo` cannot prompt for a password; containers where sudo isn't configured for the user; the prefix on a read-only mount or NFS with root_squash.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/11b96da1b2f5642d. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/brew/prefix.rs:229

        let owner = if cfg!(target_os = "macos") {
            format!("{user}:admin")
        } else {
            user
        };
        let mut mkdir_dirs: Vec<String> = vec![prefix.to_string_lossy().to_string()];
        mkdir_dirs.extend(dirs.iter().map(|d| d.display().to_string()));
        let mkdir_args: Vec<String> = ["-p".to_string()].into_iter().chain(mkdir_dirs).collect();
        let chown_args: Vec<String> = vec!["-R".to_string(), owner, prefix.display().to_string()];
        if dry_run {
            miseprintln!("{}", sudo::argv("mkdir", &mkdir_args).join(" "));
            miseprintln!("{}", sudo::argv("chown", &chown_args).join(" "));
            return Ok(());
        }
        info!("creating {} (requires sudo once)", prefix.display());
        sudo::run("mkdir", &mkdir_args, &[])?;
        sudo::run("chown", &chown_args, &[])?;
        if !writable(&prefix) {
            bail!("{} is still not writable after bootstrap", prefix.display());
        }
    } else if dry_run {
        // prefix is ours but subdirs are missing — show what a real run
        // would create (no sudo needed)
        for dir in &missing_subdirs {
            miseprintln!("mkdir -p {}", dir.display());
        }
    } else {
        // prefix is ours, just fill in missing subdirs
        for dir in missing_subdirs {
            crate::file::create_dir_all(&dir)?;
        }
    }
    Ok(())
}

View on GitHub (pinned to 533346cc37)