Friday, March 6, 2015

windows 7 - How can I repair or install startup repair/system recovery after BCD corruption?


How should I go about repairing startup repair?


Installing startup repair onto the hard drive, as if it was not originally there, would also fix this.


In the hope that someone at a Windows-specific forum may have an idea, I've also posted this over at Microsoft Answers: http://answers.microsoft.com/en-us/windows/forum/windows_7-system/install-system-repairfix-system-repair-boot-entry/6424eada-40b7-440e-9759-e2cc67aa3e3a


Startup repair is actually a tool running under the system recovery environment. The system recovery environment is what needs to be fixed, but I'll call it startup repair because that's what it's called in the boot menu.


Summary at bottom.




Problem


When attempting to use Startup Repair, I get a screen with the status code 0xc000000e and the error message:



The boot selection failed because a required device is inaccessible.



If I rebuild the BCD (I have a backup of the semi-broken one), I no longer have a Startup Repair option.




History


I accidentally started my computer (two hard drives in RAID 1) in IDE mode. This caused Windows to crash on startup, obviously. The BCD store was corrupted, giving the same startup message as above, but for normal boot. In an attempt to fix this, I booted off the installation disc, getting a whole lot of errors when trying to use bootrec /rebuildbcd command:



The requested system device cannot be found



More specifically, there were no entries on the screen to choose an OS. I eventually got around this by manually opening the BCD store (bcdedit /store C:\Boot\BCD) and correcting the device entries on {bootmgr} and {default} and the osdevice on {default}, to partition=C: for {bootmgr} (System Reserved) and partition=D: for {default}. They were listed as unknown, probably due to the failed boot attempt on IDE mode.


Now, at least, I can successfully boot... partway... into Windows. The main purpose of this question is to ask how I can restore the Startup Repair boot option, which throws an error trying to find the boot device: the same one the main boot was throwing. There is no entry in the BCD store. On my first restart into the DVD recovery environment after manual recovery, it offered to recover the on-disk recovery environment, which was reported as successful (and obviously was not).




Problems with normal boot (now fixed)


Now, the other major problem is booting partway. Specifically, chkdsk starts every boot. After running and completing the first time, it rebooted and repeated. The drive itself is still readable, as evidenced by the partial boot and my ability to read it through the DVD based recovery environment. Safe Mode freezes on loading CLASSPNP.sys and the keyboard is unresponsive during the chkdsk countdown, which points to possible file/driver corruption. Is there anything I can/should do?


sfc running in offline mode reported



Windows Resource Protection did not find any integrity violations



My main question remains on how I can get startup repair working again. I'm hopeful that once that works I can run a system restore which may (or may not) restore possibly corrupted system binaries.


Eventually the DVD version of startup repair fixed whatever the problem was with the normal Windows boot. Unfortunately, something has changed a drive GUID or something somewhere, which means System Restore has no restore points for my current C: and D: partitions, but it does have quite a few for a C: (Missing) and D: (Missing). For a recovery tool to break when drive GUIDs change is... well, utterly useless. I wonder who designed this.


The installed version of Startup Repair remains broken.




I'm quite skilled at creating walls of text. Here's the summary:



  • BCD was corrupted

  • BCD was manually repaired by fixing the device and osdevice entries

  • Startup repair now reports it cannot find the startup device, the same error normal boot gave when the BCD was corrupted

  • Normal startup runs chkdsk every boot and reboots as soon as its done

  • Safe mode hangs at CLASSPNP.sys

  • Keyboard is unresponsive during the chkdsk press any key countdown


If it makes any difference, my specific OS is Windows 7 x64 Professional.




And of course, the majority of online resources deal with one of the following:



  • Use of startup repair to repair failure to boot

  • Fixing failure to boot

  • Disabling startup repair


Answer



Aha! Fixed it!


As I noted in the thread on Microsoft Answers I linked to, there was no entry for the Recovery Environment from bcdedit. There also wasn't one visible from EasyBCD. I did note they were in the registry, but they're shown by GUIDs there - not very navigable.


Thanks to this answer's suggestion of Visual BCD Editor, I was able to see the Recovery Environment entries in a friendly view.




Finally seeing the problem!


Thanks to the multiple runs of Startup Repair and manual repairing of the primary boot option, I had one working primary boot option and two Recovery Environment boot options. The (recovered) one, as seen in the screenshot below, was created during the Startup Repairs.


Screenshot of (recovered) RE
Click for full size


As seen in the screenshot below, the RecoverySequence GUID of the primary boot option did not match the GUID of the recovered Recovery Environment (that's a mouthful!). Instead, it pointed to the corrupted Recovery Environment entry. Rather than attempting to link it to the (recovered) entry, I just fixed the original one and deleted the (recovered) one - especially since the (recovered) one has different GUIDs and inheritance settings.


Screenshot of mismatching GUIDs
Click for full size




Fixing the problem!


Before attempting manual repairs, backup the BCD file. This can be done under Store > Backup Store.



  1. I linked ApplicationDevice and OSDevice in the original Recovery Environment option to the C: partition. This is where the \Recovery\b9c42ebd-946e-11e0-8a47-f688fd0bc489\Winre.wim file resides, and happens to be my primary OS partition. I've heard it's in a different place on some OEM machines: HP (and possibly others) create their own recovery partition that should be used. Note for anyone else following this: the GUIDs you see will be different.


    Screenshot showing step
    Click for full size


  2. I had to fix the Ramdisk Options (linked to the GUID of the original Recovery Environment) entry: SdiDevice had to be set to type PartitionDevice, 'Drive' C:, blank Path. To be honest, this was based off the DeviceOptions created by Startup Repair and linked to the (recovered) Recovery Environment.


    Screenshot showing step
    Click for full size


  3. I then deleted the DeviceOptions and Windows Recovery Environment (recovered) entries.


    Screenshot showing step
    Click for full size


  4. Reboot, test, enjoy! This fixes Startup Repair on failed startup and Repair Your Computer in the advanced boot options menu (F8 on startup).





Unfortunately, I haven't figured out how to add a Recovery Environment to a clean BCD store. I assume it would be just adding similar options, as seen in the screenshot.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...