Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Feb 2004 18:50:21 +0000
From:      Jez Hancock <jez.hancock@munk.nu>
To:        Stephen Liu <satimis@icare.com.hk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How to start single user mode or safe mode
Message-ID:  <20040223185021.GB21636@users.munk.nu>
In-Reply-To: <403A1311.6000703@icare.com.hk>
References:  <403A1311.6000703@icare.com.hk>

next in thread | previous in thread | raw e-mail | index | archive | help
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

generally.

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

http://munk.nu/
http://jez.hancock-family.com/  - Another FreeBSD Diary
http://ipfwstats.sf.net/        - ipfw peruser traffic logging



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040223185021.GB21636>