ext4 Remounts Root Read-Only When It Cannot Trust the Disk, and the kubelet Falls with It

In progress Linux Kubernetes

ext4 protects its structure with a journal, and when the kernel detects errors it can't safely repair while running, it stops writing altogether: the root filesystem is remounted read-only, or the boot drops into emergency mode. The data is preserved, but every process that needs to write fails at once. On a Kubernetes node that means containerd, then the kubelet, then the node itself, which the control plane reports as NodeStatusUnknown.

What the Journal Guarantees

Before changing filesystem structures, ext4 first writes its intent to the journal. After a crash, the kernel replays or discards the unfinished transactions, so the directory tree stays consistent. By default (data=ordered) the journal covers metadata; file contents written at the moment of the crash can still be lost or stale. Journaling prevents a corrupt filesystem, not lost writes.

How a Node Ends Up Locked

  1. The node loses power or is hard-reset during shutdown, for example while systemd waits on containerd tearing down pod networking.
  2. The filesystem was not unmounted cleanly; at boot the kernel finds errors to check, or hits I/O errors from a failing disk.
  3. With the default error behaviour (errors=remount-ro on Debian), the kernel remounts / read-only to prevent further damage, or fsck must run from emergency mode.
  4. containerd cannot write its state and crashes; the CRI socket disappears; the kubelet crash-loops, unable to write under /var/lib/kubelet.
  5. Automation fails too: Ansible reports Failed to create temporary directory and scripts hit Read-only file system.

Preventing It

  • Stop the kubelet and containerd before halting a node, so shutdown doesn't hang on container networking.
  • Never cut power to "speed up" a stuck shutdown; wait or use the console.
  • Watch disk health (SMART wear indicators) on old SSDs used as node disks.
findmnt -no OPTIONS /        # "ro" in the list means locked
dmesg | grep -i -E 'ext4|i/o error'

References

Review cards

Flashcard Why does ext4 remount the root filesystem read-only when it detects unrecoverable errors?

To prevent further damage to the filesystem and ensure data integrity.

Flashcard fsck reports the filesystem clean, yet remounting read-write keeps failing. What's the likely cause?

The drive itself refuses writes: a worn-out SSD can lock itself read-only in firmware. Check smartctl -a, copy the data off and replace the drive.

Quiz Which of the following is a consequence of a node being locked due to ext4's read-only remount?
  • The kubelet can continue to function normally.
  • The node reports NodeStatusUnknown to the control plane.
  • The node automatically reboots to fix the issue.

The kubelet cannot function properly when the filesystem is read-only.

Flashcard What should be done to prevent a node from being locked due to ext4's read-only remount?

Stop the kubelet and containerd before halting a node to ensure a clean shutdown.