1

This just happened on my server a few days ago, it's an Ubuntu server and there is only one hard drive on it. I am logged in as root, and I cannot write to any place on the drive. I can't even use chmod, or chown anywhere in the entire drive.

When I try something like sudo chmod -R -v 755 * I get an error on every single directory saying failed to change mode of <directory>: Read-only filesystem

I am the only one who uses and has access to this server, I have no idea what I did to make this happen but I really need to fix this.

1 Answers1

1

First of all when you see a read-only filesystem error, your first step should always be to run an fsck (filesystem check) on the affected drive. That's because Linux has mounted the filesystem as read-only because it detected an issue on boot, and if that error was something like corruption then remounting as read/write could damage your disk beyond recovery.

Second of all, as Eyoung100 mentioned, you should NEVER run a recursive command on the root of your filesystem. You're extremely lucky that in this case Linux didn't let you actually execute that command or your Droplet would probably be messed up such that a repair would be unreasonably difficult for you.

Third you don't actually need the rw portion of eyoung's command, as it's the default in these cases. You can get away with just sudo mount -o remount / which will attempt to remount your filesystem.

Typically the write-protected error isn't the problem with these, that is odd. But you should be able to get around it by running:

blockdev --setrw /dev/vda1

Then try the previous command:

mount -o remount /

Please let me know what you see when you try that. If it doesn't work, you'll probably need to request the recovery ISO and just migrate your files off the Droplet.

Darian
  • 306