EROFS (errno 30)

errno 30

LINUX

Read-only file system

Also searched as: Read-only file system, errno 30, EROFS: read-only file system

Linux terminal running strace with the failing system call and errno highlighted
Linux errno: trace the exact failing system call before changing anything.

What it means

EROFS, 'Read-only file system' (errno 30), means a write was attempted on a filesystem mounted read-only. Linux often remounts a filesystem read-only automatically after detecting errors, so a sudden EROFS on a normally writable disk deserves investigation.

Applies to: Linux, macOS (BSD errno), WSL, Docker containers

How to fix EROFS (errno 30)

  1. Check how it is mounted with 'findmnt <path>' or 'mount | grep " ro"'
  2. Look at 'dmesg -T' for messages like 'Remounting filesystem read-only' that indicate disk or filesystem errors
  3. Back up data, then run 'fsck' on the unmounted filesystem (from a rescue system for the root filesystem)
  4. If the read-only mount was intended, remount it read-write with 'sudo mount -o remount,rw <mountpoint>'
  5. In Docker or Kubernetes, check whether the container uses '--read-only' or 'readOnlyRootFilesystem' and write to a mounted volume or tmpfs instead
  6. On macOS, the system volume is read-only by design; write to your home or /usr/local instead

Why it happens

Filesystems are read-only by mount option, by policy (containers, immutable OS images, macOS system volume), or after the kernel detects corruption or I/O errors and protects the data by remounting read-only.

FAQ

Why did my Linux disk suddenly become read-only?

The kernel likely found filesystem or disk errors and remounted it to prevent damage. Check dmesg and SMART data before forcing it writable.

Related errors

Source: Linux kernel errno.h · fixes written and reviewed by the editors (see our editorial policy)

Last updated: