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:
Windows could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM.
That’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: windows, ubuntu, technology, registry, corrupt, dual boot, geeks
Popularity: 7% [?]













February 27th, 2008 at 12:48 pm
Your command:
cd /WINDOWS/system32/config
should be:
cd WINDOWS/system32/config
It’s a subdirectory under the mount point.
February 27th, 2008 at 12:50 pm
Ah thanks Peter. Got a little slash happy there. Edited for less slashiness on that line.
March 27th, 2008 at 1:06 pm
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.
January 16th, 2009 at 1:44 am
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.
October 13th, 2009 at 9:23 pm
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!
October 30th, 2009 at 1:07 am
Worked flawlessly, and greatest of all I didn’t have to muck around in windows.
Thanks
January 23rd, 2010 at 12:24 am
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!
March 19th, 2010 at 9:39 am
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.
March 19th, 2010 at 9:45 am
Also… careful with registry editor. Any mistype could lead to disaster when you fix registry. I hope everybody realise this!
May 16th, 2010 at 8:42 pm
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.
June 19th, 2010 at 1:53 am
the command
sudo mount ntfs-3g -o rw /dev/sda2 /media/windows
shoud have -t infront of ntfs-3g ?
June 30th, 2010 at 11:00 am
Oh thanks a lot for it cause I have a lot of problems on my PC, But how do I install ubuntu partition?
July 15th, 2010 at 6:01 am
Hmm, be careful if you try this, I once made one small mistake in the registry editor and WHAMO, messed the whole thing up!!
August 24th, 2010 at 3:15 pm
In my opinion (if you allow me) it is ten times easier to use a fix registry software, even is little bit costly.
November 30th, 2010 at 2:56 pm
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
December 28th, 2010 at 8:51 pm
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.
January 10th, 2011 at 2:54 pm
Great but why not use a registry editor?
Especially if you’ve no restore point in case of viruses
March 14th, 2011 at 1:55 pm
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?
May 13th, 2011 at 2:51 pm
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.
May 17th, 2011 at 12:33 am
You are my inhalation, I possess few blogs and very sporadically run out from post
.
May 23rd, 2011 at 7:07 am
This worked great! Thank you.
June 23rd, 2011 at 1:56 am
Great Adult type views and entertainment.-Dating Tips
July 25th, 2011 at 1:54 pm
You’ve got great insights about clean registry, update registry, edit registry, keep up the good work!