I am currently using Ubuntu 11.10. My HDD has been frequently used for more than 5 years now. When I try to use the sudo command, or execute a command as root, I receive a message stating that the filesystem is read-only. For example, when I try to run sudo apt-get install gnome-tweak-tool, I receive the following output:
sudo: Can't ipen /var/lib/sudo/aaron/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
I have heard that Ubuntu will make the filesystem read only because of disk errors. After checking my hard drive with Disk Utility, I discovered that it has 7 bad sectors. Disk Utility also warned about imminent disk failure. Is this kind of thing normal, and can/should I make the filesystem writeable again? Or should I simply replace my hard drive?
Given the age of the disk, and that it has started getting bad sectors, it really sounds like your disk is failing. My best advice is to stop using it, get hold of a new disk, and either try to copy everything to the new disk, or do a fresh install on the new disk, and copy the files of importance from the old (The latter is the easiest, but the former is possible too).
I had a problem where I could not write to my Toshiba 500GB external hard drive. I kept getting an error stating: "Cannot create directory: Read-only file system"
Note: I am using Ubuntu 11.10. The software Disk Utility is pre-installed with 11.10.
My hard drive seems to be back working now after I did the following:
Firstly, using Disk Utility I unmounted the drive "Unmount Volume", then I selected "Check File System". It did it's thing and in my case found no errors. Then I mounted the drive using Disk Utility and hey presto, it seems to be working as it did before.
If there's errors on your drive I'd back up everything on it and let Disk Utility try to repair them. If Disk Utility can't repair the drive then a new drive may be required.
Hope this helps. This issue annoyed me Greatly!!