LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Changing read only file /etc/fstab (https://www.linuxquestions.org/questions/linux-newbie-8/changing-read-only-file-etc-fstab-700468/)

varaahan 01-28-2009 06:06 AM

Changing read only file /etc/fstab
 
I accidentally edited the /etc/fstab file which has made my arch box unbootable. Now I want to edit it but the editor says "read-only" file. Tried chmod but no use. How to release the "sticky bit" of the file ?

repo 01-28-2009 06:13 AM

boot from a live cd, and mount the partition rw

varaahan 01-28-2009 06:29 AM

I don't have the CD now! Any other way ?

linuxlover.chaitanya 01-28-2009 07:08 AM

If you do not have the cd of the same distro you installed you could try using any live distro to edit the files.

pixellany 01-28-2009 07:13 AM

If you can't boot the Arch system, where are you using your editor? And where did you try chmod?

You should be able to edit as root. ("su" to become root) (and you would also need to run chmod as root)

I've never seen the sticky bit used on /etc/fstab

repo 01-28-2009 07:19 AM

Quote:

I've never seen the sticky bit used on /etc/fstab
Seems to me he changed fstab to mount / ro

varaahan 01-28-2009 08:24 AM

The system boots thro HAL and I could login but all files are read-only. Even I could not run pppoe-start and connect to internet.

What I did was to edit the fstab file and commented out the lines having / and swap partitions.

My CD drive is out of order and so having a live CD is of no use.

repo 01-28-2009 08:26 AM

download puppy , burn it to cd and boot from it

varaahan 02-01-2009 04:34 AM

Tried using arch (older version 0.8) but again the partition / file is mounted as read-only .
I could login as root but I could not chnage the file permissions. Tried chmod u+rwx, chown , umask command but in vain.

mount and remount commands didn't work since they rely on /etc/fstab which is read-only.

repo 02-01-2009 04:36 AM

Quote:

Tried using arch (older version 0.8) but again the partition / file is mounted as read-only .
Did you booted from a live cd ?

r3sistance 02-01-2009 08:51 AM

Isn't the following possible?

Launch the operating system up into single user mode, do umount on the partition containing /etc/fstab then do mount -rw on the partition that contains /etc/fstab and this should restore the ability to write to /etc/fstab...? I don't get why people go around roundabout methods of having to download things to try and fix things when the tools already exist their to fix them o.O?

saagar 02-01-2009 11:04 AM

I think this might work, but take a better advise before tryint it..
mount -o rw,remount / and try to edit the /etc/fstab file.

varaahan 02-01-2009 08:06 PM

The entire OS is one single partition and so I am afraid to try umount.
The command mount -o remount,rw didn't work with error msg not found in /etc/fstab or mtab.
Tried puppy in live mode but it threw some error msg and didn't boot at all. (Perhaps some problem with my new SATA Moser BAer DVD writer !)

jschiwal 02-01-2009 11:43 PM

Look at what is mounted and where the current root (/) directory is. If you couldn't boot your system root directory, you may still be running with the system directory in ram (the initrd filesystem) and can try remounting the root system as rw. The system may have bailed out into a root shell before performing the pivot to the system directory (your normal /) and remounting as r/w.

What change did you make to /etc/fstab before rebooting? Was it for you root filesystem partition or another one?

Another possibility is that there was a problem with the filesystem detected and so it was mounted ro as a result. This could have been that you made a mistake editing the root filesystem's fstab entry, or an actual problem was detected. The the boot processes launches fsck, the filesystem isn't mounted r/w yet.

varaahan 02-02-2009 07:13 AM

I did the following originally :

When working as a normal user , I sudoed and edited the /etc/fstab file and commented out the lines starting with UUID.... representing the / and swap file systems. Upon restart the system took a long while to boot throwing out a lot of error messages.And finally hanging for a long time at HAL I was logged into a shell . Since I had to edit the fstab file I logged in as root but found the fstab file mounted as read-only. Since I could not edit the file the problem persisted .

Now I have edited the fstab file by using Nimblex live Cd and I Could boot Arch the normal way. Yet my problem of making the file attribute of fstab file as rw from read-only remains unsolved.
I would have been happier if I had edited the file within Arch.

Anyhow thanks to all of you friends for your help and support.


All times are GMT -5. The time now is 03:59 AM.