{"record":{"id":"11b96da1b2f5642d","repo":"jdx/mise","slug":"is-still-not-writable-after-bootstrap","errorCode":null,"errorMessage":"{} is still not writable after bootstrap","messagePattern":"(.+?) is still not writable after bootstrap","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/prefix.rs","lineNumber":229,"sourceCode":"        let owner = if cfg!(target_os = \"macos\") {\n            format!(\"{user}:admin\")\n        } else {\n            user\n        };\n        let mut mkdir_dirs: Vec<String> = vec![prefix.to_string_lossy().to_string()];\n        mkdir_dirs.extend(dirs.iter().map(|d| d.display().to_string()));\n        let mkdir_args: Vec<String> = [\"-p\".to_string()].into_iter().chain(mkdir_dirs).collect();\n        let chown_args: Vec<String> = vec![\"-R\".to_string(), owner, prefix.display().to_string()];\n        if dry_run {\n            miseprintln!(\"{}\", sudo::argv(\"mkdir\", &mkdir_args).join(\" \"));\n            miseprintln!(\"{}\", sudo::argv(\"chown\", &chown_args).join(\" \"));\n            return Ok(());\n        }\n        info!(\"creating {} (requires sudo once)\", prefix.display());\n        sudo::run(\"mkdir\", &mkdir_args, &[])?;\n        sudo::run(\"chown\", &chown_args, &[])?;\n        if !writable(&prefix) {\n            bail!(\"{} is still not writable after bootstrap\", prefix.display());\n        }\n    } else if dry_run {\n        // prefix is ours but subdirs are missing — show what a real run\n        // would create (no sudo needed)\n        for dir in &missing_subdirs {\n            miseprintln!(\"mkdir -p {}\", dir.display());\n        }\n    } else {\n        // prefix is ours, just fill in missing subdirs\n        for dir in missing_subdirs {\n            crate::file::create_dir_all(&dir)?;\n        }\n    }\n    Ok(())\n}\n","sourceCodeStart":211,"sourceCodeEnd":245,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/prefix.rs#L211-L245","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run once interactively so sudo can prompt, or configure passwordless sudoers for mkdir/chown on the prefix","Manually create and chown the prefix: `sudo mkdir -p <prefix> && sudo chown -R $USER <prefix>` then re-run","Check the mount (`findmnt <prefix>`) — remount read-write or move MISE_SYSTEM_BREW_PREFIX to a writable location"],"exampleFix":"# before\nmise bootstrap packages apply   # fails in non-interactive CI\n# after (CI)\nsudo mkdir -p /home/linuxbrew/.linuxbrew && sudo chown -R \"$(id -un)\" /home/linuxbrew/.linuxbrew","handlingStrategy":"validation","validationCode":"p=\"${MISE_SYSTEM_BREW_PREFIX:-/home/linuxbrew/.linuxbrew}\"\n[ -w \"$p\" ] || echo \"prefix $p not writable — expect sudo bootstrap\"","typeGuard":null,"tryCatchPattern":"try {\n  bootstrapPackages();\n} catch (e) {\n  if (String(e).includes('still not writable after bootstrap')) {\n    // sudo likely failed non-interactively; pre-create with correct ownership\n    run(`sudo mkdir -p ${prefix} && sudo chown -R ${user} ${prefix}`);\n    bootstrapPackages();\n  } else throw e;\n}","preventionTips":["In CI, pre-create the prefix with correct ownership instead of relying on interactive sudo","Configure passwordless sudo for the bootstrap mkdir/chown commands","Verify the prefix lives on a writable (non-read-only, non-root-squashed) filesystem"],"tags":["brew","permissions","sudo"],"backgroundTag":"permission-denied","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}