How to start single user mode or safe mode

Jez Hancock jez.hancock at
Mon Feb 23 10:50:26 PST 2004

On Mon, Feb 23, 2004 at 10:49:53PM +0800, Stephen Liu wrote:
> Accidentally I made a mistake
> # ee /etc/rc.conf
> .....
> hostname=localhost
> ....
> and could not start the PC
> At booting
> ......
> Enter full pathname of shell or RETURN for /bin/sh:
> Hit <ENTER>
> # ee  (could not work)
> I rebooted the PC.  At booting, selecting [3] or [4] could not boot to 
> 'safe mode' nor 'single user mode'

Firstly it would help if you could tell us why you were originally
dropped to single user mode - ie the messages prior to 'Enter full
pathname of shell...'.

To boot into single user mode at startup:

- hit any key APART FROM ENTER when the system counts down from 10.
  This will take you to the boot prompt.
- type 'boot -s' to boot into single user mode

After booting into single user mode, to be able to write any changes
/etc to disk you need to change the status of the / partition from read
only to read/write mode.  To do this execute:

/sbin/mount -u /

Note you should use the full path because /sbin may not be in your PATH
for one reason or another.

Now you can move on to fix any problems with /etc/rc.conf.  If you
really want to use ee(1) then you'll need to first mount the partition
containing /usr/sbin since ee(1) resides there and if the partition
containing /usr/sbin isn't mounted you won't be able to use ee(1).

If /usr has it's own dedicated partition you'd do:

mount /usr


Finally you should be able to do:

/usr/sbin/ee /etc/rc.conf

again using the full path to ee(1).

This is one of the reasons I forced myself to learn ed(1)/vi(1) - it's the one
editor that's generally available no matter what when you boot a system
in single user mode.

Jez Hancock
 - System Administrator / PHP Developer  - Another FreeBSD Diary        - ipfw peruser traffic logging

More information about the freebsd-questions mailing list