Troubleshooting the Startup Sequence


To troubleshoot issues during startup, try the following techniques.

Start the Computer in Verbose Mode

Start the computer in verbose mode (press Command-V at startup) to get more details on startup issues.

Start the Computer in Open Firmware Mode

You can boot into Open Firmware by pressing Command-Option-O-F during startup. The Open Firmware environment can be intimidating, because even the user prompt is simplified. The following five commands are useful in Open Firmware mode:

  • mac-boot (starts loginwindow and completes startup normally)

  • shut-down (shuts down the computer)

  • reset-all (resets the NVRAM, all ports, and the processor)

  • reset-nvram (resets the NVRAM)

  • eject cd (ejects the optical drive tray, or optical media in a slot-loading drive)

Start the Computer in Safe Mode

Safe mode is the state Mac OS X is in after a Safe Boot (press Shift at startup)a special way to start Mac OS X when troubleshooting. Starting up into Safe Mode simplifies the startup and operation of your computer in the following ways:

  • It forces a directory check of the startup volume and runs fsck. Running fsck in this way takes extra time because it performs more extensive checks.

  • It loads only required kernel extensions (some of the items in /System/Library/Extensions).

  • It loads only launchd items located in /System/Library/LaunchDaemons and /System/Library/LaunchAgents.

  • None of the items in /System/Library/StartupItems or /Library/StartupItems are run.

Starting in Safe mode is useful when you are trying to isolate the cause of a problem that may be caused by third-party kernel extension conflicts or startup items that cause the machine to act erratically. If the problem goes away, then you can narrow your troubleshooting focus to find out which startup item could be causing the problem.

Identifying Startup Item Locations

In this exercise, you will view three locations where your computer identifies startup items that are affected by Safe Boot. When you troubleshoot problems, it's important to understand that Safe Boot is simply a way to turn off a number of items. If the computer boots properly in Safe Boot, your understanding of where those items are located is essential for you to perform a split-half search (removing items that might be problematic) to determine what has caused the problem.

1.

In the Finder, navigate to /Library/StartupItems.

Third-party applications will often place startup items here. The folder may be empty if you haven't installed any third-party applications, but this is an important place to check when troubleshooting startup problems.

If you find that a problem is user-specific, go to ~/Library/StartupItems.

2.

In the Finder, navigate to /System/Library/LaunchDaemons.

These are preferences for the tasks that are run at startup by launchd. It's important to know that these exist, because these will still launch in Safe Boot.

In this folder, troubleshooting is very straightforward: if a daemon with a file here seems to cause the problem, remove the file and allow it to be recreated on the next startup. If the problem persists, that might indicate a problem with the daemon itself, something serious enough to require you to reinstall Mac OS X.

3.

Scroll the /System/Library folder to see StartupItems.

4.

Select the StartupItems folder to see its contents.

This folder contains the system scripts that run on a normal startup. During a normal startup, the rc script goes through this folder recursively and runs each of these scripts. Some start background processes, some check for particular hardware components, and some perform configuration steps and stop executing.

Items in this folder that are not critical for system operation or security are disabled by a Safe Boot. For example, you can see the folders for cron and CrashReporter, which are important for everyday use, but not as important when you are doing startup troubleshooting.

When you troubleshoot startup problems, remember that your computer checks several places for its startup scripts.

Prevent Login Items from Launching

If you suspect that a login item (an application that launches automatically at login, as specified in the Login Items pane of Accounts preferences) is preventing successful login, you can prevent startup items from launching as follows:

1.

Start the computer.

2.

As soon as you see the blue background followed by the Mac OS X progress window, press and hold the Shift key.

By pressing Shift at this point, you prevent Mac OS X from logging in automatically, giving you the option of logging in as any user.

3.

When the login window appears, release the Shift key, log in, then immediately press the Shift key again.

4.

Release the Shift key after the Finder's menu bar appears.

Examine Logs in Single-User Mode

Start your Mac OS X computer in single-user mode (press Command-S at startup), and when the command-line prompt appears, examine the system log by entering

less /var/log/system.log

If the startup sequence is hanging, the system log shows where the process stops.

Remove Corrupted Preferences in Single-User Mode

Corrupted system, loginwindow, or directory services preferences can cause long delays and possibly stop the machine from completely starting up. Delete these preferences by starting your computer in single-user mode, moving them to a temporary location, and restarting. These preferences are located at

  • /Library/Preferences/SystemConfiguration/preferences.plist

  • /Library/Preferences/com.apple.loginwindow.plist

  • /Library/Preferences/DirectoryService

  • ~/Library/Preferences

Restore /mach_kernel, /etc, /var if Deleted

If you start in Mac OS 9 (Macintosh models introduced after January 2003 don't boot in Mac OS 9) or another partition that has a version of Mac OS X installed and you delete key files and folders required for Mac OS X to function properly, you will need to repair the system before your drive is able to boot properly. Key files to be aware of are /mach, /mach-sym, and /mach_kernel. Other key files are actually symbolic links to important system folders required for the underlying UNIX subsystem. These symbolic links are /etc, /var, and /tmp, which are all symbolic links to folders of the same name, but located in /private. Note that most of these files and folders are set to be invisible when viewed from the Finder in either Mac OS 9 or Mac OS X.

If you deleted the /mach_kernel file, restart the computer from another drive and copy the mach_kernel file from the root level of the Mac OS X Install DVD to the root level of the Mac OS X startup volume.

If you deleted the /etc or /var links, start your computer in single-user mode, run fsck (use fsck -f to force fsck to run on journaled systems), mount the file system, and enter the following to re-create the /etc and /var links:

ln -s /private/etc etc

ln -s /private/var var

NOTE

Even though /etc, /var, and /tmp tend to be referred to as folders, they are actually symbolic links to their respective folders in /private.


MORE INFO

Refer to Knowledge Base documents 106908, "Mac OS X: Issues after removing 'etc' and/or 'var' directory alias when started up from Mac OS 9" and 107396, "Mac OS X: Cannot print, use Classic, start file sharing, burn discs, or update software if /tmp missing."


Single-User Mode and Network Troubleshooting

In this exercise, you will enter single-user mode, verify networking, then continue booting to the login window.

1.

Boot into single-user mode by pressing Command-S immediately after turning on your computer.

When your computer reaches the prompt for single-user mode, notice that Mac OS X 10.4 displays instructions on how to continue booting the system, but stays in single-user mode. This is useful for troubleshooting issues with the network or user environment.

2.

Try to run the ping command. Enter

ping 17.254.0.91

and press Return. Because networking is not enabled at this point, you will not be able to access Apple's server.

3.

Press Control-C to exit the ping command.

4.

To continue booting in single-user mode, enter

sh /etc/rc

and press Return. Your system will remain in single-user mode, but it will mount the local file system, start virtual memory, and enable networking.

5.

After you see the "Link is up" message, press Return to return to the command prompt.

6.

Run the ping command again. Enter

ping 17.254.0.91

and press Return.

7.

Press Control-C to exit the ping command.

You should now be able to verify the network connection between your computer and Apple's server.

At this point in troubleshooting, you could also verify network status by testing DNS or verifying the packets received from your DHCP server.

8.

Enter

host 17.254.0.91

and press Return. You will see that DNS resolves because networking is now enabled.

You will now proceed by exiting single-user mode and booting to the login window.

In Mac OS X 10.4, the boot sequence occurs much faster than in previous versions. Be prepared to watch carefully after you press Return in the next step.

9.

Enter

exit

and press Return.

The computer will exit single-user mode, initialize the user environment, and show the login window so that you can log in normally.

10.

Log in as Chris Johnson when the login window appears.




Apple Training Series Mac OS X Support Essentials
Apple Training Series: Mac OS X Support Essentials v10.6: A Guide to Supporting and Troubleshooting Mac OS X v10.6 Snow Leopard
ISBN: 0321635345
EAN: 2147483647
Year: 2003
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net