LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-23-2008, 05:02 AM   #1
Wambat
LQ Newbie
 
Registered: Oct 2004
Posts: 7

Rep: Reputation: 0
Can't boot because of incorrect fstab


Hi,
I'm using Fedora 8.
I put an incorrect entry in /etc/fstab, and when I reboot, I get the options of reboot or shell. I tried to edit fstab, but it won't let me save because the "file system is read only".

Being a newbie, can anyone give me step instructions on what to do.

Thanks in advance,

Wambat
 
Old 01-23-2008, 05:14 AM   #2
wraithe
Member
 
Registered: Feb 2006
Location: Australia
Distribution: Linux... :-)
Posts: 241
Blog Entries: 1

Rep: Reputation: 50
go into the shell and login as root (it will ask for root password then)

once in there enter vim /etc/fstab

once open press i
then remove the line/s you added

now hit esc and then press :x and hit enter(this will save your file)

if you wish to check then run vim /etc/fstab
then use :q to exit without writing..
 
Old 01-23-2008, 05:51 AM   #3
Wambat
LQ Newbie
 
Registered: Oct 2004
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by wraithe View Post
now hit esc and then press :x and hit enter(this will save your file)
..
Thanks for the quick reply,
The machine is at work, so I can't try it immediately, but, I tried editing it with MC. When I go to save it says it's READ ONLY. I tried CHMOD but I get the "File system is READ ONLY" message.

Will VI work around this somehow?

regards,

Wambat
 
Old 01-23-2008, 06:05 AM   #4
wraithe
Member
 
Registered: Feb 2006
Location: Australia
Distribution: Linux... :-)
Posts: 241
Blog Entries: 1

Rep: Reputation: 50
if you login as root, you will have write permissions to the fstab file...
but use vi (vim now but vi works too)
i dont use mc for editing so cant help you there...
 
Old 01-23-2008, 07:19 AM   #5
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
You can also boot the system using a live cd like system-rescue-cd or partedmagic. Mount your / partition and then edit /etc/fstab.
 
Old 01-23-2008, 07:52 AM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Well, reddazz used the phrase "you can also," which is true (although "can also" is misleading), but misses the point that you can not edit fies on a read-only file system. (You must, however, have a read-only file system if you want to fix partition table errors.)

Thus your only option is to use a Live CD or, if you have your Fedora installation media, you can boot from it and, at the first prompt, type "linux rescue" to boot into rescue mode. Follow the instruction to chroot /mnt/sysroot, and change /etc/fstab as needed. Note that you will need a "Live CD" that supports the lvm command if you choose that route.

There's actually few other options but they require that you have other operating systems installed that can mount the Fedora Logical Volume(s) and edit files on them, or that you physically move the drive to another such system.

Aside: You can check your fstab entries before using them by opening a terminal window after you save your changes and then issuing a mount /... (where the "..." is the new mount point you just defined).

Also, there are several options beside LABEL= that you can use to make your fstab entries more robust. When you get your system working again, look at the subdirectories under /dev/disk for what you can put in UUID=, PATH=, or ID=. For even more flexibility, look at man udev.
 
Old 01-23-2008, 08:53 AM   #7
rpeter
LQ Newbie
 
Registered: Jan 2008
Location: Hungary
Distribution: Slackware
Posts: 7

Rep: Reputation: 0
I had a similar problem, but after having entered the command

# mount -n -o remount,rw /

I could edit and writing /etc/fstab. After editing, just type CTRL+D, and your machine will reboot.

But if you aren't during booting, then you can mount your Fedora partition from an other Linux partition, (if you have one, and Fedora partition isn't mounted yet,) and edit /etc/fstab. In this case your command:

# mount /dev/hdx /mnt/mount_point
# vi /mnt/mount_point/etc/fstab

hdx (e.g. hda3, hdb2 etc.) may be sdx, if you have SATA disk, and
/mnt/mount_point may be any directory, without any content.

Last edited by rpeter; 01-23-2008 at 09:00 AM.
 
Old 01-23-2008, 09:15 AM   #8
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Quote:
Originally Posted by rpeter View Post
I had a similar problem, but after having entered the command

# mount -n -o remount,rw /

I could edit and writing /etc/fstab. After editing, just type CTRL+D, and your machine will reboot.

But if you aren't during booting, then you can mount your Fedora partition from an other Linux partition, (if you have one, and Fedora partition isn't mounted yet,) and edit /etc/fstab. In this case your command:

# mount /dev/hdx /mnt/mount_point
# vi /mnt/mount_point/etc/fstab


hdx (e.g. hda3, hdb2 etc.) may be sdx, if you have SATA disk, and
/mnt/mount_point may be any directory, without any content.
WARNING: The above commands in red are not appropriate if you are using the default Fedora 8 Logical Volume installation.

And, in any case, Fedora no longer uses the obsolete hd device descriptors (although you can force them by defining then as symbolic links in udev). By default, in Fedora 8 all hard drives, regardless of their physical characteristics, are in the form /dev/sd?.

<edit>
Second Warning: Logical Volumes are, generally, found the /dev in the following format: /dev/<Volume Group Name>/<Volume Name>. This is not a warning for Wambat, but for anyone who needs to run fsck on a logical volume inside a volume group: Running fsck on the physical device (e.g., /dev/sda) containing a volume group will destroy the volume group.
</edit>

Last edited by PTrenholme; 01-23-2008 at 09:25 AM.
 
Old 01-23-2008, 11:17 AM   #9
rpeter
LQ Newbie
 
Registered: Jan 2008
Location: Hungary
Distribution: Slackware
Posts: 7

Rep: Reputation: 0
PTrenholme, thanks for your useful supplement.

But if someone get a prompt during booting, because of an error, and can't write the modification out because of a read-only message, then remounting the filesystem as read-write with the first command will help them.
This helped me at least.

Last edited by rpeter; 01-23-2008 at 11:19 AM.
 
Old 01-23-2008, 07:05 PM   #10
Wambat
LQ Newbie
 
Registered: Oct 2004
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by PTrenholme View Post

Thus your only option is to use a Live CD or, if you have your Fedora installation media, you can boot from it and, at the first prompt, type "linux rescue" to boot into rescue mode. Follow the instruction to chroot /mnt/sysroot, and change /etc/fstab as needed. Note that you will need a "Live CD" that supports the lvm command if you choose that route.
Thankyou for the most useful reply. Yes, my main problem was that it was read only, and using rescue from the install media helped with that. Still had to use VI, but managed to get it first go :-)

Thanks to all who replied.

Wambat
 
Old 03-02-2008, 08:04 PM   #11
roscoe_x
LQ Newbie
 
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by rpeter View Post

# mount -n -o remount,rw /
Thiw work very well for me. Thanks rpeter. Can you explain what the command do?
 
Old 03-03-2008, 08:23 AM   #12
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
From man mount:
Code:
       -n     Mount  without writing in /etc/mtab.  This is necessary for example when
              /etc is on a read-only file system.

       -o     Options are specified with a -o  flag  followed  by  a  comma  separated
              string  of  options.
The "/" at the end of the command specifies the "root" file system. The "rw" means, of course, "read/write," and "remount" is, I hope, obvious.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot boot due to incorrect entry in fstab metcub Linux - General 3 11-27-2012 03:52 AM
openSUSE 10.3 Dual boot to USB - incorrect boot location antitech Linux - General 2 11-06-2007 11:20 PM
Suse won't boot after fstab changes - fstab not editable baking-a-77 Linux - Newbie 10 06-02-2007 10:51 AM
Is there anything incorrect or "dangerous" in my fstab? Underhill Debian 6 09-30-2004 07:47 AM
/etc/fstab incorrect narinder31 Linux - Newbie 5 08-15-2003 02:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration