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.