November 24, 2010

Windows XP: Repairing a Corrupted Registry Hive

Windows XP: Repairing a Corrupted Registry Hive

 

Note

Note: Use these instructions at your own risk! They were originally intended for IS&T Help Desk internal use. Only clients experienced in installing, troubleshooting, and making repairs to Windows Operating Systems should attempt to follow these instructions on their own. If you choose to proceed, be aware that IS&T assumes no responsibility for any problems encountered.

Introduction

When your computer displays a message about corruption in \WINDOWS\SYSTEM32\CONFIG\SYSTEM or \WINDOWS\SYSTEM32\CONFIG\SOFTWARE instead of booting normally, it means that there is a problem with your Windows registry. The SYSTEM part of the registry determines Windows XP system settings, installed service packs and updates, etc. If the SYSTEM hive is unrecoverable, you will need to reinstall your operating system. The SOFTWARE part of the registry holds information about your installed software and their settings. If the SOFTWARE hive is unrecoverable, you will need to reinstall all of your software.

[Back to top]


Hardware Diagnostics

If you did not install any software, driver updates, etc., before your machine crashed, the registry corruption may have been caused by a hardware error. Run hardware diagnostics if you can, especially on the hard drive and memory. Microsoft's RAM diagnostic is a good third-party tool to try. Most brand-name machines now have bootable hardware diagnostics built-in; take a look at your user manual to see if this applies to your computer.

[Back to top]


Notes

These instructions were adapted from Microsoft's article how to recover from a corrupted registry that prevents Windows XP from starting. This procedure replaces the corrupted registry hives with a version automatically stored by your computer. This process will not necessarily restore a perfect system. However, it will hopefully get you up and running enough such that you can back up any critical data and reinstall your operating system if need be.

[Back to top]


Using the Recovery Console

  1. Boot up from your Windows XP CD. Pressing the F12 key right as your computer starts up will allow you to choose from a list of boot devices on most recent computer models. Otherwise, you will need to take a look at your user manual to figure out how to set the BIOS to boot from CD first.

    Once you have successfully booted from the CD, you will see the Windows XP "Welcome to Setup" screen.

    Windows XP istall: Welcome to Setup screen


  2. At the welcome screen press R to go into the Recovery Console. Press the number that corresponds to your Windows installation (usually 1) and press ENTER. Enter the password for the Administrator account on your computer (usually the password you put in the machine when you first bought the machine) and press ENTER. If your password is not accepted, try a blank password by just pressing ENTER.



  3. Once you are able to log into the Recovery Console, run checkdisk. Sometimes this alone will fix the problem. You can use the command "chkdsk c: /r".

     

    Note

    Note: In DOS, press ENTER after each command to executed the command. Case does not matter for DOS commands.


    checkdisk


  4. If you noticed any errors fixed, use the exit command at the prompt to restart the machine and see if it will boot. If not, log back into the Recover Console and go to the next step.


  5. Navigate to the C:\Windows\System32\config folder. You can use the command cd C:\Windows\System32\config

    navigate


  6. You can use the dir command to see a listing of the files in the directory.

    dir

  7. Rename your corrupted registry files.

    If your error listed the SOFTWARE hive, rename the SOFTWARE registry file with the command: rename SOFTWARE SOFTWARE.bak

    rename software hive

    If your error listed the SYSTEM hive, you will need to rename the SYSTEM, SAM, and SECURITY registry files:

    rename SYSTEM SYSTEM.bak
    rename SAM SAM.bak
    rename SECURITY SECURITY.bak


    rename system registry

    The SAM and SECURITY hives pertain to user accounts and logging into the machine. Since they are linked to the SYSTEM file, they need to be replaced when SYSTEM is replaced.


  8. Browse to the C:\Windows\repair directory with the command cd C:\Windows\repair. This is the directory which holds backup registry keys which were created when Windows was installed.

    repair directory


  9. Copy the backup files to the correct place.

    If your error listed the SOFTWARE hive, copy the SOFTWARE registry file with the command: copy SOFTWARE C:\Windows\System32\config.

    copy software registry hive

    If your error listed the SYSTEM hive, copy the SYSTEM, SAM, and SECURITY registry files:

    copy SYSTEM C:\Windows\System32\config
    copy SAM C:\Windows\System32\config
    copy SECURITY C:\Windows\System32\config


    Note that in some cases the SYSTEM file will be named "SYSTEM.bak", in which case you will use the command: "copy SYSTEM.bak C:\Windows\System32\config\SYSTEM.bak" to copy the file instead. You can use the "dir" command to ascertain the name of the file.

    copy system registry hive


  10. Navigate back to the config directory with the command "cd C:\Windows\System32\config".

    back to config directory

    Use the "dir" command to list the files in the directory. Make sure the following files exist in the directory (the names have to be exact, but it doesn't matter whether they are in upper or lower case):

    DEFAULT
    SAM
    SECURITY
    SOFTWARE
    SYSTEM


  11. Type exit to reboot the machine.


  12. Hopefully you will now be able to reboot into Windows XP.

[Back to top]


Putting Your System to Rights

  1. Reinstall Service Pack 2. This is important even if you already had Service Pack 2 installed before the crash because it will correct problems that may have come about because of the registry restore.

  2. If your error was with the SYSTEM file, you may need to reinstall your drivers. To see which drivers you're missing, go to the Control Panel > System > Hardware tab > Device Manager. Anything with a yellow question mark next to it is a missing driver. You'll need to reinstall these drivers from a system CD that came with your computer or download them from the manufacture's website.

  3. If your error was with the SOFTWARE file, try a system restore to see if your software can be restored. If that doesn't work, try Part Two of Microsoft's registry restore instructions. If all else fails, you may need to reinstall your software.

  4. Make sure you are up-to-date with Windows and critical updates from http://windowsupdate.microsoft.com

http://web.mit.edu/ist/products/winxp/advanced/registry-corruption.html