PGTS Humble Blog
Thread: Mac OS X, Apple
|And if your head explodes with dark forebodings too -- I'll see you on the dark side of the moon!|
Single User Mode For A Mac
Chronogical Blog Entries:
Date: Mon, 09 Jun 2008 22:06:02 +1000
Not too long ago, I had a problem with my Mac Pro, and I wanted to start it up in single user mode.
Problem was, all the documentation for the Mac was on the Mac! So how does one starup in Single User Mode?
Of course, Google gave me the answer. Here it is:
Hold down the [Mac]-S key after starting up the computer.
The system will start up in single user mode.
- If you have a standard distribution of OS X you will see a command
line prompt. The shell will be Apple's GNU bash (for Darwin). The
primary drive will be mounted as read only. So you should have access
to most of the unix commands, and it will be possible to run fsck on
it. The mouse will not be available, so you can't use cut and paste.
Networking will not be available either, so if you need them the
individual components will need to be started manually. Fortunately
the man command is available, so you can refresh your memory
about any commands you may have forgotten.
Depending on the version of OSX you may see message on the screen that indicates that the root file system is mounted read only and instructions on how to fsck the root file and system and how to continue the startup sequence.
- If all you want to do is fsck the primary hard disk, then the
commands which appear on the startup prompt are about all you need to
know. For more intrepid users, here are a few handy commands which
work on a Mac Pro 2. (Note: on this particular machine the top USB
port on the front panel can be mounted as /dev/disk1). Now a word of
warning. If you are GUI user who can't follow instructions and is not
really comfortable with the command line, you should only use the
first two commands in the following list:
# NOTE: Don't try these unless you are OK with the command line
# check and fix the root file system
# remount the root file system as read-write (do this after fsck)
/sbin/mount -uw /
# mount an extended FAT memory stick on USB 1 on front panel
# NB: this implies you already have an empty folder called adhoc
mount -t msdos /dev/disk1 /adhoc
# force the setup assistant to run on next boot
# WARNING: Only do this if you REALLY want to lose your settings
mv /var/db/.AppleSetupDone /var/db/AppleSetupDone_bak
# Mount and backup a mangled HFS file system called /dev/disk1s2
mount -t hfs -r /dev/disk1s2 /Volumes/d1
tar cvfz /backup/d1.tar.gz *
# shutdown the system immediately
shutdown -h now
# continue with the normal startup sequence
# restart the system
For earlier versions of Mac OSX (prior to Leopard), it was possible to manually start some components, using the following daemons:
- kextd, /usr/libexec/kextd, which handled requests from the kernel to load kernel extensions.
- configd, /usr/sbin/configd, which was intended to help configure the system. In Mac OS X this has mainly been used for configuration of the network.
- lookupd, /usr/sbin/lookupd, which was used to lookup information for Directory services and DNS It is no longer used since Leopard.
Since 10.5 (Leopard), most startup is performed by the
launchd daemon. This daemon is started by launchctl. The setup
files are XML file with a .plist extension in the folder
/System/Library/LaunchDaemons/. So, with the most recent version of OS
X, one would use the following code to start the kextd and configd
# start the kextd daemon
launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist
# start the configd daemon (mostly networking)
launchctl load /System/Library/LaunchDaemons/com.apple.configd.plist
Generally speaking, it is not advisable to try starting these services manually from single user mode. If for some reason, it is necessary to do so, it might be safest to reboot when the maintenance tasks have been completed.
Note: To force the Mac to boot from the CD drive, press the "c" key immediately after Power On ... (Assuming you have a bootable DVD or CD in the drive).