Carl's blog

Recovering from Windows registry hive corruption, the smart way.

by on Dec.11, 2010, under Computer Stuff

I like this trick. Every time I do it, I think about all those people doing repair installs (in-place upgrades).

It works pretty much every time unless the filesystem is really truly screwed, in which case you need a backup, say from the system restore directory (System Volume Information), as per this knowledgebase article (don’t bother with the recovery console though, use your USB to IDE or USB to SATA cable and fix it from your laptop.)

Here are the symptoms. You try to start up your Windows 2000/XP (Vista too?) computer and you get a message, white text on black background:

Windows could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM

or

Windows could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SOFTWARE

Sometimes, the message is cut short, so you might see “\WINDOWS\SYSTEM32\CONFIG\SYS” or similar. Hint: If it’s really cut short, and you can’t see if it’s SOFTWARE or SYSTEM, do the following procedure on both files. Whichever one is identified as having been repaired, well that’s the one that was broken ;)

Anyway, how to fix it in 2 minutes:

Use your USB to IDE/SATA adapter cable, and connect the broken machine’s hard drive to your laptop, or your spare PC or whatever. You don’t have to use a USB to IDE/SATA adapter cable – if you’re a person at home with another PC you can stick the drive on a spare IDE or SATA channel. You just need to get that hard drive into a working Windows XP computer for a few minutes.

Windows will mount the broken computer’s hard drive as, say E: or F:. Make sure you have your computer set to show hidden files and also system files. To check this, go into My Computer -> Tools -> Folder Options, -> View Tab, and select “Show hidden files”, and make sure “Hide protected operating system files” is not ticked.

First things first, run chkdsk on that drive, after all it is most likely filesystem corruption that has caused the registry to become corrupt in the first place. In My Computer, right-click the broken computer’s drive and choose properties. Go to tools, “Check Now”, put a tick in only the first box (Automatically fix filesystem errors), and click start. Let that finish before continuing.

Here’s where the magic happens. Go to start -> run, and type regedit [enter]. This will launch the registry editor on your computer. In the registry editor, highlight HKEY_LOCAL_MACHINE, and then go to File -> Load Hive. Find the file that is “missing or corrupt” (from your error message earlier), and choose to load that. It will be in E:\(or F:\)Windows\System32\Config, and will be called just SOFTWARE or SYSTEM. Regedit will ask you to name the hive, just type “badpc” (any old garbage will do – it’s only temporary).

Regedit will say “One or more files containing the registry were corrupt and had to be recovered by use of log files. The recovery was successful.” You have just repaired the registry! Now you need to Un-load that hive, so highlight that “badpc” hive that you can now see under HKEY_LOCAL_MACHINE, and go to File -> Unload Hive.

You now just need to put that hard drive back in the broken computer, which hopefully won’t be broken any more! If you used a USB to SATA or USB to IDE cable from your laptop, make sure you use the “Safely remove hardware” icon in the system tray next to the clock to safely remove the hard drive, else you may cause filesystem corruption again. Alternatively just shut your laptop/working computer down properly and remove the hard drive once it’s shut down.

All done.

Some background:

The registry is a database. It has transaction log files which can be used to recover from corruption. It would appear that the early Windows boot process is not able to work with those log files, but regedit (and Windows itself further on in the boot process) is.

:,

28 Comments for this entry

  • mikeluvs43

    i was having some trouble with my laptop and stumbled across a thread that you had an answer to. I have a question about your answer though.
    My problem is this: Windows could not start because the following file is missing or corrupt : \WINDOWS\SYSTEM32\CONFIG\SYSTEM

    in the thread you directed the person to a web page where you had the answer to it. Problem i have is in your answer it has you typing stuff on the broken computer. Thats where I have the problem, i cant type anything into the broken computer. It doesnt boot up. I connected the laptop to another lap top by a usb on each end. Could this be the problem? am i supposed to use the ide or sata? If so where do I find these on a laptop, a dell 800 lattitude.

    any help would be greatly appreciated

    thanks Mike

  • Allan

    Thank you very much for this helpful publication… Saved me from various headaches!

  • David

    AWESOME. I’ve been doing that lame “repair” install method up until I noticed this article.

    Anyway, we can even shave a few more minutes (and tools) off this fix – I tried it with RegeditPE on Hiren MiniXP and it worked too, so in fact you don’t even need a working windows install – just boot up the bad machine from Hiren CD. (Which is especially handy when the bad machine is a laptop) :-)

  • JCP

    As discussed I have the same error message (Windows could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM)

    I have gone through the steps, but when it comes to the LOAD HIVE step, it will not allow me to load the “system” hive – it asks for a Hive Name, but then gives me a “error while loading Hive” message.

    Any suggestions?

    ** NOTE used this process running from Hirens boot CD (on USB drive) rather than with a separate PC**

    PS: I don’t have XP disks and am on an OEM laptop install of Windows XP SP3

    Thanks

  • JS

    Hi, I’m trying to restore my hard drive using the described workflow, but at the stage ‘load hive’ I get the message “F:\ not available. The file or folder is damaged or can not be read.”

    Is there a way out of this ?

    Thanks

    • Carl

      Hi. You need to do the chkdsk part first. You might also check the System event log, to look for red disk errors.

  • JS

    Hi again and thanks for taking the time.
    I have done the chkdsk but it may be a worry that it takes close to no time to run it. The system event log give a similar message: “The file system structure on the disk is corrupt and unuseable. Please run the chkdisk utility on the volume F:”
    In the Controle Panel > Administrative Tools > Computer management > Disk managment the disk is shown but no File System, fat or ntfs, is assigned to it. Is there anything to do with that, or are we approaching the stage of full reinstall?
    Thanks

  • ASH

    Will this work Win7 to Winxp? Or does it have to be the same OS

  • Phoenixjv

    This really worked. I appreciate the time and effort to write this steps

    thanks

  • schwarzennegger

    Dear Bro,
    Wat can i say…whole day i was breaking my head(iam not a computer pro.)came to u r blog luckly,just did wat u said..that s it…(of course i purchased usb to sata cable/with adapter frm ebay)every thing done as in few minutes as u said earlier…thank u soooooooooooooooooooooooooo much bro

  • YouAre AnAngel!

    Hi and THANKS FOR TAKING THE TIME to write an infinitely superior line of attack for corrupt registries! I had thought about building another disk, updating the windows files, then copying it’s registry over -but that would wipe out…I’m betting, many critical registry entries.

    As a website designer, I’m always turning to google images and the hackers have attack sites that turn up first in picture searches – I believe that’s how I got the virus which posed as a Windows Updates window, but of course fooled no one. If you see an overtly dubious popup window with accompanying taskbar item, don’t walk RUN TO THE OFF SWITCH. I don’t mean take the time to shut down but RUN TO THE POWER DOWN BUTTON!!!

    If you are fast enough, it won’t hose your computer. Then DO NOT boot up normally but boot into safe mode. You should have AUTORUNS installed – check to see what’s been inserted into the auto startup registry hives, scheduled tasks and windows startup folders. Kill suspicious items.

    I have an acronis backup of the c: drive, and could copy that registry…but it’s 2 months old…and your method, using log files, probably brings the broken registry to within a day or two of being up to date I’m guessing.

    For those who don’t get it – you just need to take out the BROKEN HARDDRIVE and put it into another computer, so you can look at it with various tools, such as regedit as described here.

    The OP was saving you a step by saying you could drag a 2nd working pc RIGHT NEXT TO THE BROKEN ONE, and just run a sata cable from the working pc to the broken drive on the broken pc. So the broken pc would be connected to the 2nd working pc via the cable – sata, ide or some form of usb to ide/sata adaptor.

    This is an old tech support trick saving the step of removing the broken harddrive.

    If anyone can download a copy of tinyxp rev 09 – I believe it has hiren boot cd built into it and 1,000 other tools – many for dealing with situations just like this. For tinyxp rev 09, you need to burn it to dvd to get it to work for installing a quick xp, but burning it to cd usually works for just using the utilities. Also tiny xp could be used to automatically install, in 10 minutes, another copy of xp on a separate harddrive or partition, for repair purposes, but be careful not to format or overwrite your existing data filled partition / c:drive!

    For the worry warts, if you have a licensed xp, it’s perfectly fine to install xp from tinyxp. But sometimes the right thing to do is illegal, according to Jesus, who would not hesitate to break a “rule” if it helped someone: Luke 16:9 – the Parable of the “Unjust Steward.”

    TheAngel . com

  • Jeff

    Slicker than crap through a goose!
    I wish I had read the commend about Hiren’s boot CD MiniXP, but I needed a USB 2.5″ HDD cable anyway.

  • Steve

    THANKS!!!!!! worked like a charm! You da man.

  • Matt L

    Thank you! You’r a life saver!

  • Phil Barrett

    THANK YOU SO MUCH!!! I was worried to say the least. Already spent £85 on a ‘just-in-case’ online tech support (Virgin) who were going to take me through RE-INSTALLING WINDOWS….. So I went for a knowledge trawl and found your article. Worked a treat!

  • Mio

    Worked. You made my day. THANK YOU VERY VERY MUCH!!!

  • Haplo

    Worked great…

    Thanks

  • P

    Hey man, this was great!!!!! I was in a bad situation and this did the trick! Great post and keept it up!

  • Funny Pugs

    A wise person once told me to reinstall Windows when getting a new PC… And start by formatting the drive into two partitions. Now I see why! I was able to install Windows on the 2nd partition (making the system dual boot) then loaded from Windows on the D: drive without any issues. Now I can run chkdsk & fix the corrupt registry on the C: drive, back up files and so on, without a laptop or other computer. So for future readers, this guide assumes you have no other partitions! If you do, use those instead of hacking hardware. Great post!

  • Georgist

    No connection with the blog!
    Just a reminder that you have not responded to my offer for the Pandaboard.
    (But maybe I don’t want it anymore, having just bought a RasPi. :-)

    • Carl

      oops,sorry! I’ve been away. Was it an eBay offer? I think I did respond that I would take offers.. it’s just sat doing nothing.

  • Steven Hong

    Thanks! This was the exact answer to the problem I was helping someone out with. Their computer did not have a backup system hive, and the only other option was to reinstall. I blogged about the problem and referenced your site.

    Thanks again!

  • Jorata

    Thanks, man! Saved my day! :-)
    I used the Hiren’s Mini XP on a corrupt Win2K installation.
    Works as well :-)

  • Trueangel

    Hi I’m having a problem I don’t know where to start I have a compaq nx9010 laptop and the HD had a virus I think and windows would not boot with xp pro cd, I have a Last xp 15 cd and I don’t have a clue what tools to use to get my laptop to start up again I really don’t mind loosing all the info just want ot to start up again

  • Millie

    Will this restore technique work if I already replaced the corrupted SOFTWARE registry file with a old copy that was in the repair folder? My PC boots now but 3 years of software settings are gone.

    • Carl

      erm, well, you won’t those settings back unless you find a recent copy of SOFTWARE.
      Try \system volume information\rpxxx

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...