go io_error ai_generated true

go: creating module cache directory: mkdir /go/pkg/mod: read-only file system

ID: go/read-only-file-system

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2024-06-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.13 active
1.20 active

Root Cause

The Go module cache directory is on a read-only file system, often in containerized environments.

generic

中文

Go 模块缓存目录位于只读文件系统上,常见于容器化环境。

Workarounds

  1. 95% success
    GOMODCACHE=/tmp/gomodcache go mod download
  2. 70% success
    mount -o remount,rw /go

Dead Ends

Common approaches that don't work:

  1. 90% fail

    If the file system is truly read-only (e.g., squashfs), chmod won't work.

  2. 80% fail

    Even root cannot write to a read-only file system unless remounted.