NixOS: FS and Nix Store Recovery on Critical Failures
The system fails to boot, dropping into emergency mode, or throws this error during operation: Structure needs cleaning This indicates critical metadata corruption (superblock, inode table, or journal). The kernel forcibly mounts the root (/) as Read-Only to protect the data. ⚠️ Limitations of In-System Recovery Attempting to fix the root FS from within the running system is a dead end: mount -o remount,ro / returns target is busy because background processes hold files open. Mass-killing processes (killall5, fuser) often causes session hangs or respawns. Using umount -l / (lazy unmount) detaches the root, but instantly makes all binaries unavailable (sudo, e2fsck, mount), as they reside in /nix/store, which is now unmounted. 💡 Conclusion: Fixing the root FS from within itself is impossible. The only reliable path is external intervention. ...