RSS



Use your Ubuntu partition to fix a corrupt registry on a Windows XP partition

Wed, Feb 27, 2008

ArsGeek, Linux, Technology, Ubuntu, Windows, howto

Talk about it in our Forums

Here’s the scenario. You have a dual boot machine, Ubuntu on one side, Windows on the other. You’re tooling around, doing your thing and then one day you boot into Windows and get this:

uh-oh.jpg

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

reg.pngThat’s a bummer because it generally means you’ve got a corrupt registry. Thankfully most windows XP installs (unless you’ve manually tweaked it not to) create restore points for you registry from which you can attempt to resurrect your Windows install.

NOTE: You will be digging into your windows system32 folder and mucking about. If this makes you feel queasy, or if you’re not entirely confident that you have a complete backup you may not want to do this. In other words, proceed at your own risk.

Hop on in to your Ubuntu install, and lets install a few tools we’ll need to access your Windows partition. You may have ntfs-3g installed already. Open up a CLI (Applications-> Accessories-> Terminal) and type:

sudo apt-get install ntfs-3g ntfsprogs

Now we have what we’ll need to work in the NTFS partition that contains your Windows install.

Next, we’ll have to determine which partition that is and then mount it so we can work in it.

sudo fdisk -l

That command will list all of the available partitions on your hard drive(s). You’re looking for the one that says NTFS. It may look something like

/dev/sda2 1 9327 74919096 83 NTFS

If you have multiple NTFS partitions it’s a good idea to start with the first one. We’ll go through mounting them and you won’t do any harm in looking around. If you can’t find the directories needed in your first NTFS partition, try the next one. In this tutorial, we’ll use /dev/sda2. Remember to change this to correspond with what actually exists on your system.

So, we know what we want to mount (or have a good idea) so let’s get that partition mounted.

First let’s make a directory where it can sit.

sudo mkdir /media/windows

Now let’s mount it and make it read/write so we can modify it.

sudo mount ntfs-3g -o rw /dev/sda2 /media/windows

Change ‘sda2‘ to reflect your hard drive. If this generates an error message, you may have to force the mount with:

sudo mount nfts-3g -o force,rw /dev/sda2 /media/windows

Now you should be able to change directory into your windows partition.

cd /media/windows

That’s the root of your drive. Lets go to where the files you’ll need to replace are.

cd WINDOWS/system32/config

There are five files you’re going to need to pull from your restore point and plonk down here. First though, let’s back up the original files, even if they’re corrupt. Better safe than sorry.

cp default default.bak
cp SAM SAM.bak
cp system system.bak
cp software software.bak
cp security security.bak

Now you have your backup. Next we’re going to overwrite the corrupted files with ones from your last restore point.

cd ‘/media/windows/WINDOWS/System Volume Information’

Now let’s take a quick look.

ls -las

you should see at least one directory that starts with ‘_restore’ and then some random characters. Change directories into that.

cd _restore*

Now another ls to find the restore point directory with the latest date.

ls -las

Look for the most recent directory that is similar to RP123 – it will be different on your machine. Lets move into that directory

cd RP123

Now into the snapshot directory

cd snapshot

If you want to take a look around, do an ‘ls‘ to see what’s there. We’re going to copy those five files we made backups of back to their appropriate place.

cp _REGISTRY_USER_.DEFAULT /media/windows/WINDOWS/system32/config/default
cp _REGISTRY_MACHINE_SECURITY /media/windows/WINDOWS/system32/config/security
cp _REGISTRY_MACHINE_SOFTWARE /media/windows/WINDOWS/system32/config/software
cp _REGISTRY_MACHINE_SYSTEM /media/windows/WINDOWS/system32/config/system
cp _REGISTRY_MACHINE_SAM /media/windows/WINDOWS/system32/config/SAM

Now that you’ve copied these, let’s tell windows to to force a file system consistency check.

sudo ntfsfix /dev/sda2

It’s time to boot into your Windows partition and see if we’ve fixed the problem. So restart and select Windows from your boot loader menu. When it first starts up, you should get a blue screen telling you that you’ll need to run a file system consistency check. Let it do it, and reboot again. Hopefully you’ll be back into your Windows install!

Technorati Tags: , , , , , ,

Popularity: 7% [?]

Share and Enjoy:
  • Digg
  • del.icio.us
  • MisterWong
  • Reddit
  • Technorati
  • BlinkList
  • Facebook
  • Fark
  • Mixx
  • Slashdot

This post was written by:

arsgeek - who has written 1989 posts on ArsGeek.


Contact the author

23 Comments For This Post

  1. Peter Says:

    Your command:

    cd /WINDOWS/system32/config

    should be:

    cd WINDOWS/system32/config

    It’s a subdirectory under the mount point.

  2. arsgeek Says:

    Ah thanks Peter. Got a little slash happy there. Edited for less slashiness on that line.

  3. Jason Says:

    What about using a registry cleaner like RegCure? I recently bought one from http://www.pc-registry-repair.com but have not used it yet.

  4. Laura Says:

    Your post has been very helpful so far. I’ve managed to access my Windows files from within Kubuntu, but the problem is the the system file within the system32 folder does not exist! All the other files (sam, security, default, and software) are there. Do you have any idea what I can do? I don’t have a Windows installation CD.

  5. Doug Erickson Says:

    Used a Live Ubuntu disk and performed the above scenerio, slightly different in mounting, however this really WORKED and restored the windows xp on a laptop that my daughter uses. THANK YOU!

  6. Tristan Fitzgerald Says:

    Worked flawlessly, and greatest of all I didn’t have to muck around in windows.

    Thanks

  7. xp-error Says:

    i should get a blue screen telling you that you’ll need to run a file system consistency check. Let it do it, and reboot again. Hopefully you’ll be back into your Windows install!

  8. Mr. Registry Says:

    In my opinion (if you allow me) it is ten times easier to use a fix registry software, even is little bit costly. However it makes more sense on a long term, because is not only this the problem with the registry… problems appears all the time… so… is good to have an application like this.

    In this case in particular when you have a dual boot machine, I would strongly recommend this advice for corrupt registries.

  9. Fix Registry Says:

    Also… careful with registry editor. Any mistype could lead to disaster when you fix registry. I hope everybody realise this!

  10. Elmer Eide Says:

    I was looking to buy a laptop computer table for the refurbished laptop computer in my office but I’m finding that I can get significantly cheaper prices online instead of driving down to my local Office Depot, in many instances 50%-70% cheaper. The only bad thing is that I have to wait a few days to get it in my hands.

  11. sombat Says:

    the command

    sudo mount ntfs-3g -o rw /dev/sda2 /media/windows

    shoud have -t infront of ntfs-3g ?

  12. Hank Says:

    Oh thanks a lot for it cause I have a lot of problems on my PC, But how do I install ubuntu partition?

  13. Football tips Says:

    Hmm, be careful if you try this, I once made one small mistake in the registry editor and WHAMO, messed the whole thing up!!

  14. 2 post lift Says:

    In my opinion (if you allow me) it is ten times easier to use a fix registry software, even is little bit costly.

  15. Ted Ferdon Says:

    many thanks for your beneficial posting this informations quite usefull furthermore i highly recommend this site who wants to fix laptop computer self in this website offers variaty of laptop computer fix video tutorials laptoprepairguide.endustriciyiz.net

  16. jolin Says:

    Actually, recently I’ve found another way to speed up my poor PC, the software “tuneup360″. It’s very easy to handle and of course very powerful, my friends and I all use it now, maybe you can have a try.

  17. DaVe Says:

    Great but why not use a registry editor?
    Especially if you’ve no restore point in case of viruses

  18. australia immigration Says:

    Hey – great weblog, just looking around some blogs, appears a quite nice platform you might be utilizing. I’m presently making use of WordPress for several of my websites but looking to alter one of them more than to a platform similar to yours like a trial run. Something in particular you would recommend about it?

  19. Can Says:

    when I typed this command: cp default default.bak
    I encountered an error: reading “default” ?nput/output error.
    how can I solve this? thanks for your help.

  20. Lena Ashman Says:

    You are my inhalation, I possess few blogs and very sporadically run out from post :) .

  21. Robert Says:

    This worked great! Thank you.

  22. Gabriel Johnson Says:

    Great Adult type views and entertainment.-Dating Tips

  23. There are many products today that focus on your registry, but which ones merit a second look and which ones are worth using? Says:

    You’ve got great insights about clean registry, update registry, edit registry, keep up the good work!

3 Trackbacks For This Post

  1. Support this story on Stirrdup Says:

    Use your Ubuntu partition to fix a corrupt registry on a Windows XP partition

    This story has been submitted to Stirrdup. Your support can help it become hot.

  2. Lexpro » Blog Archive » Use Ubuntu to fix corrupt Windows XP Registry Says:

    [...] machine by hopping into your Linux partition and copying a few files around on your Windows drive.read more | digg [...]

  3. Use your Ubuntu partition to fix a corrupt registry on a Windows XP partition | TurboLinux Blog Says:

    [...] Here is a good tutorial show you how to Use your Ubuntu partition to fix a corrupt registry on a Windows XP partition: Here’s the scenario. You have a dual boot machine, Ubuntu on one side, Windows on the other. You’re tooling around, doing your thing and then one day you boot into Windows and get this: [...]

Leave a Reply