When good Vista goes Bad

I’ve not paid much attention to how to fix Vista when it dies.  In fact, I’ve only just this week had to repair the first PC where Vista is truly borked.

It wasn’t until this Christmas that I realised that you can’t do a repair install of Vista by booting from the DVD.  Oh how the Lord Microsoft doth giveth on one hand (the real recovery options finally included on the stock DVD when booting, such as System Restore) and how they doth taketh away (no repair install when booting from the DVD).

I mean, seariously, what were those guys smoking when they thought “Ah, nobody will ever need to do a repair install of Vista”.  In fact, you can do a repair install of Vista, just you have to be able to boot into Vista first.  Hmmm, thats kind of daft Mr Microsoft.  If I could boot into Vista I wouldn’t be doing a repair install (or an In Place Upgrade as they like to call it).

So, when I gullibly tried to move a Vista installation from a PC with a dead motherboard to a PC with a similar but different motherboard last Christmas, you can bet I was laughing out loud.  No, I cannot boot into Vista to run the repair install.  No, I cannot use the old board to delete any drivers.  As it turned out, a repair was narrowly avoided after much fiddling and messing around, a spare IDE drive and a hammer.  The hammer was used to threaten the computer in true Basil Fawlty style.  The IDE drive was temporarily endowed with a copy of what was on the existing SATA drive.  You see, just like XP, trying to use a different SATA controller causes the familiar BSOD on boot.  Put the install on an IDE drive and you can <probably> get into Vista to let it reinstall the drivers.  But wait, there’s more!  You can’t then image it back onto the SATA drive and walk away a happy chap.  Oh no, you need to let vista boot up on the IDE drive, with another SATA drive connected so that it installs the SATA drivers correctly to allow boot from SATA.  THEN you can image your IDE drive back to the SATA drive and Bob’s your uncle, etc.

I didn’t actually mind all that – it actually seemed fairly intuitive to a battle-hardened XP veteran.  I’d guess that on some motherboards you can cheat by putting the SATA controller into IDE emulation mode – this seems a fairly common option now.  However, on my board, this still didn’t work meaning the IDE drive shuffle ensued.  Rather embarrassingly, most of the time for this to be figured out was spent trying to figure out why I couldn’t to a repair install.  I just couldn’t believe they’d do away with that.  But, in a round about way, those guys at Microsoft had been proved right – it was possible to recover the situation without doing a repair install (though one might wonder which would have been easier, or more available to a typical PC user).

That was my first brush with this oddity of Vista and I carried on my merry way for a couple of months doing run of the mill repairs until The Big One.

Here we have a PC that we originally manufactured some three years ago.  Motherboard is dead.  Apparently has been playing up for a while.  A well meaning friend had tried to reinstall Vista before it finally died (oh dear, this sets alarm bells ringing!).

Easy peasy, swap motherboard and off we go.  Except this is a slightly different motherboard.  However, this time Vista boots.  Oh that was easy, job done – off we go home then?  Not quite.  Somehow the well meaning friend has got this machine back to SP0 from SP2 (how on earth did they do that?!)  No problem, I have the standalone installers for SP1 and SP2, so I’ll just put them on one at a time. 

Oops…

All seems well for the SP1 install until the reboot where we get the usual black screen as it works through its list of offline changes.  Except it gets stuck at “!!0xc01a001d Some number/Another Number wcm://schema…”.  It took me a while to realise it was stuck as the HDD light was flashing as if it was doing something.  Rebooted a couple of times in including trying Safe Mode but no joy. 

No problem I thought, usual lazy man approach – stick it in Google and see what comes up.  Interesting… Lots of people complaining about it and no solotion other than “reinstall” (err…) and our old friend System Restore.  Ah yes, System Restore, that’ll do it. 

Oh dear System Restore won’t work – says there are no restore points.  After repair I found out that this is because Windows treated the same drive on a different controller as a different disk so it decided the restore points (that were actually there after all) weren’t applicable.  Grrrr.  I have a poke around and there aren’t the usual registry backups in System Volume Information for me to poach.  Bugger.  Now what?  There is no apparent way to get this Vista installation to start again.  They took away my repair install, they gave me a non-working System Restore.  What’s a guy to do?  Well when I happened to look at %windir%\system32\config I find a folder there called RegBack.  Hmmm, it couldn’t be, could it?  YES!!! Windows is now keeping the last two copies of the registry in here.  Great.  I’ll just copy the set from before the SP1 attempt back into the config folder and off we go. 

Nope.  Now Vista just hangs on loading – the same in any mode.  No amount of coaxing and mental hammer waving would make it load.

The next idea I had (after putting the registry back as it was) was trying to get rid of the pending.xml file.  I remember from long ago that sometimes Vista will get into a loop trying to install updates unless you get rid of the pending.xml file.  So, I try that.

Nope.  Now Vista gets a bit further but I still get a black screen and nothing else.  I’m starting to prepare for the worst now.  I can’t find anything in WindowsUpdate.log to give me a clue and that’s all I know as an XP bod.  I decide to have a look at the pending.xml file and see if I can line that up with the numbers in the error I first saw when it got stuck at the black screen stage.  First problem was finding something to look at the 30MB pending.xml file without grinding to a halt.  Next problem was trying to understand the xml in the raw.  After a brief search I settle on Notepad++ and load it up in there.  Much better!  I now have half-decent formatting and line numbers.  The line numbers are there or there-about the same as the total count – but about 6 thousand out.  Looking through I can see lots of references to wcm://schema and so o.  Trying to figure out which exact line in that massive file was throwing the error turned out to be a two hour waste of time.  Ah stuff it I thought.  After checking the windows\winsxs folder for any files other than pending.xml with a recent modification date I find poqexec.log which seems to tell me the exact part of the pending.xml file that is causing the problem.  So I chop that bit out, save, transfer back to the target PC and boot. 

Bugger.  Still stopping with the same string but different numbers.  I check the poqexec.log file again and it’s not changed.  So, maybe the error I saw was a red-herring?  Getting a bit frustrated by now so I chop the entire wcm://schema section out of the pending.xml file.  This took the 30MB file down to around 9MB !!

Success!  After a bit of fiddling, the SP1 install “completes” and boots back into Vista.  Oh sweet GUI how I missed you!  I check the system properties and Windows *thinks* this is SP1 but I’m well aware that I probably have a PC waiting to fall over any minute here with a half-installed service pack.  OK, now I will try and install SP2 – hopefully this will fix it.  Nope, fails with an error.  OK, how about uninstalling SP1?  No, that quits quite quickly with an error.

Ah, I’ll give my old friend the In Place Upgrade a spin.  First problem I only have a SP2 disk.  It won’t upgrade and tells me to go find a SP1 disk.  Well I find a SP0 disk and try that.  Nope, says you can’t downgrade this way.  FFS are they deliberately trying to make it impossible to do a repair install of Vista?  I manage to acquire a SP1 disk and the repair install trundles along.  I leave it overnight expecting (hoping?) to find a neat SP1 desktop image with “Installation Complete” or some such message waiting for me the next day.

What do we reckon?  No, of course not.  It got about two thirds through and the stopped with an error.  “One or more components could not be configured.”  It then instructs me to restart setup and try again – yeah, like that’s going to work…

This time, it backed off gracefully and restored the PC back to how it was before I tried to do the “upgrade”.  Google didn’t help me too much – my ninja searching skills must be weakening or Google is becoming so filled with crud it’s hard to find the gems any more.  Back to random looking around at the windows directory hierarchy.  I stumble across a folder in Windows called Logs – how interesting!  I thought all the logging was done through the event log these days.  Thankfully not, there’s a little gem in here called CBS.log where CBS stands for Component Based Servicing.  It is very verbose and tells me why the service pack installs and possibly the Upgrade failed.  CBS thinks there are pending transactions that need to be completed before a new transaction can be started (a transaction being the installation of a windows component, update etc.)  A bit of looking on the MS Support site indicates that this could be as simple as changing the startup type of the Trusted Installer service from Manual to Automatic, so that it can change it back to Manual on reboot and round out an open-ended transaction.  Try that but no joy.

Then it dawns on me.  I’d been messing around with the pending.xml file but didn’t change anything in the registry.  I perhaps need to look there.  Indeed there is a reference to the pending.xml and a count of outstanding transactions.  I delete both and try the SP2 install again.

All seems well but after the first reboot it gets stuck while loading.  As before there’s nothing that can be done.  Thankfully I now have a system restore point to use, so I use it.  Maybe I can to the inplace upgrade now though?  Nope, that still gets stuck at the same place.

It seems however much progress I make, this system is still fighting me tooth and nail at every point.  I make preparations for a clean install incase I have to do that – it’s looking increasingly unlikely that I’ll ever get this sorted out.

I can’t remember how, but somehow, while surfing around I come across a mention that complete the upgrade, three Windows components need to be uninstalled:

o Microsoft .NET Framework 3.0\XPS Viewer
o Remote Differential Compression
o Window DFS Replication Service

Ah, Ok I’ll try that.  Arghhhh!!  I can’t uninstall any windows components because the treeview control is totally empty.  Apprently there are no windows components…

So, undeterred I stumble across OCSetup (http://go.microsoft.com/fwlink/?LinkId=91916)  I can seemingly use this to uninstall the necessary packages.  Except I don’t know what their “Windows Name” is.  No problem, this page lists them all : http://technet.microsoft.com/en-us/library/cc722041(WS.10).aspx.

I try the first one but get a rather confusing error.   ‘The component setup program encountered an error: 0xSomeNumber.  No signature was present in the subject.’ 

Oh great, this just gets better and better.  More googling and am told that certain pre-requisite updates must be installed.  That’s no good because updates won’t install…  I do find a little gem, though, CheckSur: http://support.microsoft.com/kb/947821

WOW – it scans through and repairs the problems I’ve been having!  Using TailForWin32 I was able to watch it do it’s magic as it outputted the details to %windir%\logs\cbs\checksur.log.  Once complete, I now had a populated treeview in the Add/Remove Windows Components box, I could remove those three errant componants and finally do the repair install.

And it worked!!!  Thank f.. for that!  Now I can install SP2 – yep, no problems.  Reinstall AVG and we are away.

What a pain this was – and a lot of time wasted.  However I did learn a lot about what’s under the hood in Vista.  I can see how the transactional based updates can create problems with the repair install – I may not like it but I can at least understand why they took the option away from the DVD.

As I’m sure Windows 7 will have a very similar architecture this new learned knowlege will hopefully prove very useful in the future.

In summary, Vista may not go wrong as often as earlier versions, when it does there is a much higher probability of pain.

Disk Read Err r, press Ctrl-Alt-Delete to reboot

I was getting mighty peeved trying to figure out why a hard disk that worked fine on one motherboard should stubbornly came up with the above error when connected to a new motherboard.

 I tried all of the usual things you might do, such as the FixBoot and FixMBR commands from the XP Recovery Console, removing all additional drives, checking/rechecking the BIOS settings.  To be honest I was stumped.

I have seen this issue before but this was when cloning a drive.  The only way I got round that then (after a day of MBR and Track 0 fiddling to no avail) was to zero-wipe the drive and re-clone. 

In this case the solution was simple – if obtuse.  When the OEM had originally partitioned the disk, they’d used all 184GB of space without any padding at the end.  Some BIOSes seem to be picky about partitions ending on sector boundaries.  Firing up Acronis Disk Director and resizing the partition down one click left 7MB free at the end but left the partition size at 184GB. 

 Reboot and bang, straight into Windows XP.

Now why couldn’t that solution have been evident and available 4 hours ago?  Hmmmmm.

Manual System Restore

This is a neat trick that most people who deal with broken XP PCs a lot will probably know in a variation.  Standard disclaimer though, I will not be held responsible for any damage caused by anybody attempting to follow these instructions.  You do so completely at your own risk!

Sometimes a machine will get a corrupt registry and will not boot no matter what you do.  Safe Mode, Last Known Configuration, whatever you select from the startup screen will not work.

You have two options:

  1. Perform a “Repair Install” by booting from the XP CD
  2. Perform a manual system restore of the registry

The first thing to do is run the usual hardware tests.  There’s no point trying to fix windows if you have bad RAM.  If the hard disk drive is suspect, grab an image of it pronto.  Trying to repair windows with a failing hard disk drive will create a mess, real quick.

Anyway, lets look at how to perform option 2. 

For some reason known only to them, Microsoft by default denied access to the “System Volume Information” folder from the recovery console.  This is the folder you will need to access to get at the saved system restore points.  I think it’s for this reason that most folks will do something similar to these instructions but instead they will use the registry from c:\windows\repair.  This is totally missing the point of performing the procedure in my opinion.  The registry will be totally mismatched to the software that has been installed.  What you are doing is putting the registry back to how it was when windows was first installed.  Why not just put the registry back a couple of days?

So, to do it properly, you need to use a trusty boot CD.  My weapon of choice is BartPE.  I start a BartPE live CD, open a command prompt and then do these steps:

If you can’t get a mental picture of what you are doing by reading the following steps, you should probably stop now.  If something is different about your configuration you need to be able to think for yourself rather than blindly typing in commands.  You have been warned!

  1. c:
  2. cd \windows\system32\config
  3. mkdir oldreg
  4. move sam oldreg
  5. move security oldreg
  6. move software oldreg
  7. move default oldreg
  8. move system oldreg
  9. cd “\System Volume Information”
  10. dir
  11. dir /a:h (If you have two different _restore{… folders type the full name of the latter one in step 11 rather than _rest*)
  12. cd _rest*
  13. dir /a:h

Now you need to look at the resore points.  Each restore point has it’s own RPxxx folder.  Look at the dates on the right and select a restore point that’s before the troubles began.  Unless there’s a good reason otherwise, I usually go back at least an extra day from when the problem supposedly appeared.

Now,

  1. Change directory into the restore point, ie cd RP056
  2. cd snapshot
  3. copy _REGISTRY_MACHINE* \windows\system32\config
  4. copy _REGISTRY_USER_.DEFAULT \windows\system32\config
  5. cd \windows\system32\config
  6. ren _REGISTRY_MACHINE_SAM SAM
  7. ren _REGISTRY_MACHINE_SECURITY SECURITY
  8. ren _REGISTRY_MACHINE_SOFTWARE SOFTWARE
  9. ren _REGISTRY_MACHINE_SYSTEM SYSTEM
  10. ren _REGISTRY_USER_.DEFAULT DEFAULT

That’s it.  The registry has been restored to an earlier point.  I give the machine a moment to flush any disk writes and then reboot, usually to a working system. 

Some people prefer to just perform a repair installation anyway.  There are several problems with this.  If the registry is knackered you will not get a working system.  You also will need to re-download all windows updates again.  Some software will require reinstallation.

I prefer to try this method first, if this doesn’t work or there are problems afterwards, I will look at what the cause is, and only then, once I’m happy that there’s nothing physically wrong will I do a repair installation.

There are a couple of other things you can do at the same time, in addition to or instead of the above.  Firstly, you can remove any new drivers from c:\windows\system32\drivers – if you suspect that a rogue driver is causing a problem.  This should really be a last resort though as removing certain drivers will stop the system booting anyway.  You can also recover from a corrupt user profile by copying the _REGISTRY_USER_NTUSER_S… file into c:\documents and settings\[user name]\, renaming ntuser.dat to ntuser.old and then renaming the copied file to ntuser.dat.  You’ll have to figure out which file to copy.  If it’s a single user system then it’ll be easy – the one that’s several MB rather than any of the small ones.

Have fun, but be careful - if you don’t think about what you are doing you can cause more damage than good.

Migrating from Windows XP Professional to Windows Vista Home

Most folks will tell you that it’s not possible to upgrade a machine runnning Windows XP Professional based operating system to a Windows Vista Home based operating system.

Microsoft say that you can only upgrade Windows XP Professional to Windows Vista Business or Windows Vista Ultimate.  Well, they say you can upgrade from Windows XP Professional to Windows Vista Home by performing a “Clean Install”.  Wiping your hard disk drive to reinstall is  definitely not upgrading in my books.  Anyway, this advice is wrong.  It IS possible to upgrade, retaining all of your documents and settings, installed applications etc.  It’s not straight forward, it’s not pretty and it’s not perfect.  But, I’ve done this for a customer and it does work.

Here are the things I needed:

  • A PC running Windows XP Professional Edition that needs to be upgraded to Windows Vista Home (or Home Premium) 
  • Windows XP Home Edition CD
  • Windows XP Home Edition Licesnse Key
  • TweakNT
  • Windows Vista DVD
  • Windows Vista Home or Home Premium License Key

When I did this, I had to move the installation to a new motherboard and CPU at the same time.  So, the first step was to startup the PC as it was and change the IDE Driver to “Standard Dual Channel PCI IDE Controller”.  This will stop you getting a blue screen when starting up on the new motherboard.  As I was moving from an Intel to an AMD based system, I also had to manually remove the file Intelppm.sys from the c:\windows\system32\drivers directory.  Without doing this, Windows would come up with a stop 7B blue screen on booting.  To do this, I used a boot disk with NTFS capability.  Once I had done this, I could start up Windows XP Professional on the new motherboard and CPU.  Once this had loaded, I setup the drivers for the new hardware.

It turns out that the old version of WinZip (6.1) that the user had installed was not compatible with Vista so that too had to go.  Unfortunately the uninstallation program didn’t remove the c:\program files\winzip directory which in this case continued to block the Windows Vista upgrade.  This directory had to be manually deleted too.

Now the fun part.  I had to run TweakNT and change the Windows XP Installation type to Windows XP Home.  The system was rebooted as requested by the program.  Note that doing this will leave your system in a unbootable configuration.  If you try and boot into Windows XP, you will get a license error.  So, you have to boot from your Windows XP Home edition CD and perform a repair installation.  Use the temporary Windows XP Home edition license key (you won’t need to activate before installing Vista).  Once your installation has been repaired and several reboots later you will have a system running Windows XP Home. 

From here, you can now run your Windows Vista CD and perform the upgrade to Windows Vista Home or Home Premium.

Was it worth all the effort?  Well to the customer it was.  For me, the fun was finding the answer to a seemingly impossible scenario :)

Have fun…

P.S.  Backup all important files before attempting to recreate any of the above!

P.P.S. Please do not ask me where to find TweakNT.  It can be found if you look carefully.  It’s easily available via various P2P networks.  YMMV.