LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-15-2005, 02:36 AM   #1
Echo Kilo
Member
 
Registered: Jul 2004
Distribution: Ubuntu - Debian Based
Posts: 242

Rep: Reputation: 30
Using ed text editor for EMERGENCY


I need to edit my fstab so I can boot properly, but ed is the only edotor available. I've read the man pages, but can't figure it out.

I think I've deleted the line causing the error, but how do I save it and exit?
 
Old 01-15-2005, 02:42 AM   #2
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
w
q


If you would like to make sure you hit the correct line:
1,$p
will print the whole file for you.

Last edited by frob23; 01-15-2005 at 02:47 AM.
 
Old 01-15-2005, 02:46 AM   #3
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Hint, if you got the wrong one.

q
q

will quit without saving.

Then open it again and type
1,$n
Which will print all the lines with their line numbers.
This example is from an /etc/rc.conf on the live cd I am using.
Code:
1       background_dhclient="YES"
2       firewall_enable="YES"
3       firewall_type="open"
4       hostname="freesbie.livecd"
5
6       NIC="de em ixgb txp vx bfe bge dc fxp lge nge pcn re rl sf sis sk ste ti tl tx vge vr wb xl cs ed ex ep fe ie lnc sn xe an awi wi"
7
8       for i in $NIC; do
9               eval ifconfig_${i}0="DHCP"
10              eval ifconfig_${i}1="DHCP"
11      done
12
13      inetd_enable="NO"
14      moused_enable="YES"
15      saver="logo"
16      sendmail_enable="NONE"
17      sshd_enable="NO"
18      usbd_enable="YES"
19      background_fsck="YES"
If the line I wanted to delete was moused_enable="YES" I could use the number to tell ed to remove that line.
14d
Then save and exit
w
q
 
Old 01-15-2005, 02:49 AM   #4
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Note: it is very wise to have some passing familiarity with ed (and vi) for the very situations like this one. Even if you personally don't like to use them. There have been times when it was only my knowledge of ed which saved me from reinstalling a system which would not behave enough to use a different editor.
 
Old 01-15-2005, 02:50 AM   #5
Echo Kilo
Member
 
Registered: Jul 2004
Distribution: Ubuntu - Debian Based
Posts: 242

Original Poster
Rep: Reputation: 30
Thanks! That worked to save the fstab, but my theory didn''t fix the problem.

I mounted a drive that was plugged in via usb so that I could format it. Then I unplugged it and now it looks for it when I boot up and it says:

"no such file or directory when trying to open /dev/sda1
Failed to check file system.
 
Old 01-15-2005, 02:51 AM   #6
RoaCh Of DisCor
Member
 
Registered: Apr 2004
Location: Washington State
Distribution: SuSE 9.3 / Slackware-Current
Posts: 701

Rep: Reputation: 30
Never used ed, but I'm sure I'm could if I had to. I always make sure pico or nano is installed. Very great easy to use in-console editors. You may want to see if you have one of them installed.
 
Old 01-15-2005, 02:53 AM   #7
Echo Kilo
Member
 
Registered: Jul 2004
Distribution: Ubuntu - Debian Based
Posts: 242

Original Poster
Rep: Reputation: 30
I guess my issue is different now so I'll start another thread....
 
Old 01-15-2005, 02:54 AM   #8
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
What is currently in your fstab?

If you have a reference to /dev/sda1 make sure the last two columns are 0 and the one before that includes the keyword "noauto"
 
Old 01-15-2005, 02:58 AM   #9
Echo Kilo
Member
 
Registered: Jul 2004
Distribution: Ubuntu - Debian Based
Posts: 242

Original Poster
Rep: Reputation: 30
Not sure what you mean (or do that with ed)
 
Old 01-15-2005, 02:58 AM   #10
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Quote:
Originally posted by RoaCh Of DisCor
Never used ed, but I'm sure I'm could if I had to. I always make sure pico or nano is installed. Very great easy to use in-console editors. You may want to see if you have one of them installed.
A problem that results in the need to use ed usually means the terminal can't be defined. You may no longer have a terminal definition file or whatever. So anything that would need a terminal definition to work wouldn't load. That would include pico, nano, and even vi.

ed is not very hard and actually will be very easy to use (at least the basics) if you have any experience with EDLIN from back in the long ago days of DOS.

Nothing like a good line editor to keep it simple and make changes.
 
Old 01-15-2005, 03:00 AM   #11
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Quote:
Originally posted by Echo Kilo
Not sure what you mean (or do that with ed)
You don't have to do it with ed if your computer can boot beyond the point you were stuck at before.

I just want to know what is in /etc/fstab... if you could cut and paste the whole file here it might help solve the problem.
 
Old 01-15-2005, 03:09 AM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You may have 'vim-minimal' available.
 
Old 01-15-2005, 03:19 AM   #13
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Quote:
Originally posted by jschiwal
You may have 'vim-minimal' available.
That is possible but I am fairly certain that vim-minimal (which is installed as /bin/vi anyway) is still not going to work without any terminal definitions. Not that it really matters. If you are fairly comfortable with vi then using ed is not going to be a major issue.
 
Old 01-15-2005, 03:20 AM   #14
Echo Kilo
Member
 
Registered: Jul 2004
Distribution: Ubuntu - Debian Based
Posts: 242

Original Poster
Rep: Reputation: 30
I can't cut and paste b/c I'm on another computer.

I think I got it. I removed the line from fstab and it works!!!
 
Old 01-15-2005, 03:21 AM   #15
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Cool... good to know.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which light text editor can copy text from file and paste in browser? davidas Linux - Software 9 03-06-2006 11:28 AM
text editor Mig21 Linux - Software 17 07-07-2005 05:27 PM
x text editor monohouse Linux - Software 8 11-08-2004 06:09 AM
Emergency! NO TEXT lramos85 Fedora 2 04-10-2004 01:36 AM
text editor dauphinfay Linux - General 2 02-29-2004 09:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:30 AM.

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