How to Fix "Read-only file system" error when I run something as sudo and try to make a folder/file?

When I try to save something or rename a file/folder it say this error " Read-only file system" or run something as root in the terminal it say this error

sudo: unable to open /var/lib/sudo/"My User Name"/0: Read-only file system 
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/  
E: The package lists or status file could not be parsed or opened.

When I make a Folder the error dialog in the details with Nautilus is this:

Error creating directory: Read-only file system

I would show you I picture of it but it isn't even letting my save onto my flash drive. Please help me.


Solution 1:

This worked for me:

First, run this command with sudo permission:

sudo fsck -n -f

Then reboot the machine

Solution 2:

When the system enters a read-only state, it does so to prevent damage to the system. Make sure your HDD is working properly and/or backup your data before doing anything.

I suggest to boot a live USB/DVD, open GParted, and use the check/repair feature.

This is the command to enable writing:

sudo mount -o rw,remount /