How Do You Make Changes to an /etc/fstab File when It Is Read Only?

Problem scenario
You cannot make changes to an /etc/fstab file. It is read only. What should you do?

Possible Solution #1
If your /etc/fstab file is messed up (through manual changes to it), and your system boots it as read only, can you run a command like this?

sudo mount -o remount,rw /dev/mapper/foobar /directory/to/be/mounted

If you run "sudo cat /etc/fstab" you will see lines like this:

/dev/mapper/foobar / ext4 defaults 1 1

(If you saw the above, and that was the line that was corrupt, replace "/directory/to/be/mounted" with "/".)

If it doesn't work, with modern Linux OSes and modern hardware, you can boot to rescue mode without installation media (e.g., a CD, DVD or USB stick).

Possible Solution #2
Use "sudo". Sometimes when you are frantic, you forget that normal users cannot make changes to sensitive files. Can you assume the root user?

Possible Solution #3

See one of these three links:

There was a good (e.g., posting and answer for something similar that involved booting up, then moving the file system temporarily to RAM and/or /tmp/. If you know which one this was, please post it in the comments below.

Leave a comment

Your email address will not be published. Required fields are marked *