How to edit file in single user mode

Parv parv at pair.com
Wed Dec 1 19:27:59 PST 2004


in message <41AE5BB9.1000902 at daleco.biz>,
wrote Kevin D. Kinsey, DaleCo, S.P. thusly...
>
> >>On Sun, 28 Nov 2004, Trey Sizemore wrote:
> >>
> >>>I made a typo in rc.conf and now am able to boot only into single user
> >>>mode.  I thought vi would be available to edit the file, but cannot
> >>>execute it (vi not found).
> 
> What if you can't mount /usr ?  then you've even more trouble.
> You can learn to use ed(1), but that's like going back thirty
> years.

Key is to learn some ed before the actual need arises.  Else,
frustration lies the other way.


> There was some discussion ... on the idea of building a small
> editor binary that you like ... and cp'ing it to /bin in
> preparation

Remember to link your favourite editor statically before even bother
to copy.  Currently, ee is linked here (4.10-p4) to ...

  libncurses.so.5 => /usr/lib/libncurses.so.5 (0x28073000)
  libc.so.4 => /usr/lib/libc.so.4 (0x280b5000)


Whatever happens to the editor, it needs to be self
contained/sufficient by being small, statically compiled, and be
usable w/o the facility of curses.


That reminds me of my old C++ class editor project.  My version of the
editor -- ed like commands, no regex support, menu driven --
statically compiled w/ GCC 3.4 & stripped takes 403 kB (-O1) or 389 kB
(-O2).  (It has yet to go through a thorough review though.  Anybody
care to take a look?)  I suppose i could/should save a copy just in
case.


  - Parv

-- 



More information about the freebsd-questions mailing list