How to edit file in single user mode

Kevin D. Kinsey, DaleCo, S.P. kdk at daleco.biz
Wed Dec 1 16:02:49 PST 2004


Trey Sizemore wrote:

> Fernando Gleiser wrote:
>
>> 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).  How can I edit my rc.conf at this point/
>>>   
>>
>>
>> After you drop into single user, say the magic words:
>>
>> # mount -a
>>
>> that will mount all the filesystems and then vi will be available.
>>
>>
>>             Fer
>>  
>>
> D'oh....sorry.  Dumb question, but thanks for answering anyway! 


{Sorry to come into this so late...}

Not necessarily a dumb question.  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.  Not that
we hate anyone who was using computers back then ...

There was some discussion on the lists (IIRC) a while back
on the idea of building a small editor binary that you like
(trying to remember some of the possibilities: zed, ved, led,
sted, (but not ted), ee (already in the base system), pico, nano,
nah, can't really remember :-< ) and cp'ing it to /bin in preparation
for just such an emergency.  With root partitions {generally}
being a tad larger these days than in the elder times, it might
be a feasible idea...I'm pretty sure *someone* out there has
tried it.  Come to think of it, I may. :-)

Kevin Kinsey
DaleCo, S.P.


More information about the freebsd-questions mailing list