WSL update caused all files to turn into read only due to file corruption

Posted by Deji Hastrup

8 months ago

0

wsl

Error message:

mkdir: cannot create directory ‘/home/pcuser/.cache/oh-my-zsh’: Read-only file system rm: cannot remove '/home/pcuser/.zcompdump-DESKTOP-PO7C18A-5.8.1': Read-only file system Starting ssh-agent ... _start_agent:23: read-only file system: /home/pcuser/.ssh/environment-DESKTOP-PO7C18A mkdtemp: private socket dir: Read-only file system chmod: changing permissions of '/home/pcuser/.ssh/environment-DESKTOP-PO7C18A': Read-only file system Error connecting to agent: Connection refused Error connecting to agent: Connection refused Starting postgresql (via systemctl): postgresql.service. zsh: locking failed for /home/pcuser/.zsh_history: read-only file system: reading anyway




sudo fsck -Af
Running sudo fsck -Af checks all filesystems listed in /etc/fstab and forces a check even if they're marked clean. It's typically used for filesystem repair, especially when the filesystem is behaving abnormally such as in this case where they're being mounted in read-only mode. Be cautious when running this on mounted filesystems like the root (/), and always ensure you have backups of important data.