start page | rating of books | rating of authors | reviews | copyrights

Book HomeMac OS X for Unix GeeksSearch this book

3.12. Restoring the NetInfo Database

If the NetInfo database is damaged, boot into single-user mode by holding down Figure -S as the system starts up. Next, check to see if you have a backup of the NetInfo database. The /etc/daily cron job backs up the NetInfo database each time it is run. You can find the backup in /var/backups/local.nidump. If you don't have a backup, you won't be able to restore the NetInfo settings. The local.nidump file is overwritten each time the cron job runs, so make sure you back it up regularly (preferably to some form of removable media).

WARNING: If your computer is generally not turned on at 3:15 a.m. (the default time for the daily cron job), you'll never get a backup of your NetInfo database. You can solve this problem by editing /etc/crontab to run this job at a different time, or to run the job periodically with the command sudo periodic daily. See Section 2.3.1 in Chapter 2 for more details.

After the system boots in single-user mode, you should:

  1. Log in as the root user.

  2. Fix any filesystem errors:

    # /sbin/fsck -y
  3. Mount the root filesystem as read/write:

    # /sbin/mount -uw /
  4. Change directories and go to the NetInfo database directory:

    # cd /var/db/netinfo/
  5. Move the database out of the way and give it a different name:

    # mv local.nidb/ local.nidb.broken
  6. Switch directories and go to the StartupItems directory:

    # cd /System/Library/StartupItems
  7. Start the network:

    # ./Network/Network start
  8. Start the port mapper, since NetInfo depends on it. Ignore any warnings about a missing NetInfo database:

    # ./Portmap/Portmap start
  9. Start NetInfo. Since it has to rebuild the NetInfo database, this may take several minutes:

    # ./DirectoryServices/DirectoryServices start
  10. Load the backup into NetInfo:

    # /usr/bin/niload -d -r / . < /var/backups/local.nidump
  11. Create the .AppleSetupDone file so that the Setup Assistant does not appear when you reboot:

    # touch /var/db/.AppleSetupDone

After you have restored the NetInfo database, reboot the system with the reboot command.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.