System stopping with a BugCheck code 7B (INACCESSIBLE_BOOT_DEVICE)

I'm seeing more and more people that have issues with systems stopping into a 7B (INACCESSIBLE_BOOT_DEVICE) BugCheck code.

The troubleshooting for this is actually quite simple and there are, under normal circumstances, only a few things to check.

Please note that the below do not apply for systems that boot of SAN. This is only for systems booting off local disks.

  1. First thing that we need to do is boot the system in Recovery Mode (either with a Windows DVD or by choosing Repair your computer from the Advanced Boot Options Menu - also known as the F8 menu)
  2. In WINRE open command prompt
  3. If the system has crashed at the first reboot after installing Windows Updates then the first thing that we should do is to revert the pending actions:
    1. dism /Image:C:\ /Cleanup-Image /RevertPendingActions - replace C: with the actual driver letter that WINRE has assigned to your OS drive
    2. Browse to OSdriveLetter:\Windows\WinSxS and check if you have a pending.xml file. If it is present the rename it to pending.xml.old
  4. Check to see if the Boot Configuration Database (BCD) has all the correct entries:
    1. The command for this is bcdedit /enum all If you don't know exactly what to look for you can compare it to a similar system, but we will mainly look at the following:
      1. Under Windows Boot Manager with the identifier {bootmgr} make sure that device and path point to the correct device and boot loader file
      2. Under Windows Boot Loader with the {default} make sure that device, path, osdevice and systemroot point to the correct device/partition, winload file, OS partition/device and OS folder
    2. If any of the information is wrong or missing I would advise that you create a backup of the BCD store... just in case: bcdedit /export C:\temp\bcdbackup - this will create a backup in C:\temp\ called bcdbackup. To restore the backup just use bcdedit /import C:\temp\bcdbackup and all BCD settings will be overwritten with the ones in bcdbackup
    3. After the backup is complete you can use the bcdedit /set {identifier} option value in order to do the changes that you want. For example if the device under {default} is wrong or missing you can use this command to set it: bcdedit /set {default} device partition=C:
    4. If you would like to recreate the BCD altogether (although personally I do not like doing that) or if you get a message that "The boot configuration data store could not be opened. The system could not find the file specified" you can run bootrec /rebuildbcd
  5. If the BCD look OK we need to check that all the drivers that should start at boot time are set as such and are available:
    1. Open the Registry Editor (type regedit in the command prompt)
    2. Select HKEY_LOCAL_MACHINE, go to File->Load Hive, browse to OSdriveLetter:\Windows\System32\config, click on the file called SYSTEM (no extension),click Open and when asked to name the new hive type in OfflineHive
    3. Expand HKEY_LOCAL_MACHINE\OfflineHive and click on the Select key. Check what is the data in the value Default.
    4. If the data in HKEY_LOCAL_MACHINE\OfflineHive\Select\Default is 1 then expand HKEY_LOCAL_MACHINE\OfflineHive\ControlSet001, if it is 2 then expand HKEY_LOCAL_MACHINE\OfflineHive\ControlSet002, etc
    5. Expand Services
    6. Make sure that the following registry keys exist under Services:
      1. ACPI
      2. DISK
      3. VOLMGR
      4. PARTMGR
      5. VOLSNAP
      6. VOLUME
    7. If they exist then check each one and make sure that they have a value named Start and it is set to 0. If it is set to anything else than 0 then change it.
    8. If any of them do not exist then you can try to replace the current registry hive with the one from RegBack:
      1. cd OSdrive:\Windows\System32\config
      2. ren SYSTEM SYSTEM.old
      3. copy OSdrive:\Windows\System32\config\RegBack\SYSTEM OSdrive:\Windows\System32\config\
    9. Check and make sure that that the following .sys files are present in OSdrive:\Windows\System32\drivers:
      1. acpi.sys
      2. disk.sys
      3. volmgr.sys
      4. partmgr.sys
      5. volsnap.sys
      6. volume.sys
    10. If any are missing, copy them over from an identical system with the same patch level

If the system is still not booting after doing all of the above then you can try to do a checkdisk on the OSdrive and also run System File Checker. These are also run from WinRE Command Prompt:

  1. chkdsk /f /r OsDrive:
  2. sfc /scannow /offbootdir=OsDrive:\ /offwindir=OsDrive:\Windows

 

In order to assist with steps 5 through 9 I have created a "small" batch sample script that loads the registry hive offline, checks for pending updates on the system, checks for the presence of the drivers on the disk, checks for the presence of the drivers in registry and it's Start value.

Just copy the below code in a file, rename it to .bat and then run it from WinRE Command Prompt. When it finishes it will create a file called 7blog.txt in the same location where the .bat file is. Look at the log file to see the results.

Please note that the batch file just reports what it finds, it does not fix anything.

DISCLAIMER:
The sample scripts are not supported under any Microsoft standard support program or service.
The sample scripts are provided AS IS without warranty of any kind.
Microsoft and myself further disclaim all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose.
The entire risk arising out of the use or performance of the sample scripts and documentation remains with you.
In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.  

 

 @echo off

REM Disclaimer:                                           
REM The sample scripts are not supported under any Microsoft standard support program or service.
REM The sample scripts are provided AS IS without warranty of any kind.
REM Microsoft further disclaims all implied warranties including, without limitation, any implied 
REM warranties of merchantability or of fitness for a particular purpose.
REM The entire risk arising out of the use or performance of the sample scripts and documentation remains with
REM you.
REM In no event shall Microsoft, its authors, or anyone else involved in the creation, production,
REM or delivery of the scripts be liable for any damages whatsoever
REM (including, without limitation, damages for loss of business profits, business interruption, loss of
REM business information, or other pecuniary loss)
REM arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has
REM been advised of the possibility of such damages.


REM Set global variables
SET bootStart=0x0
SET systemStart=0x1
SET autoStart=0x2
SET manualStart=0x3
SET disabledStart=0x4

REM Ask user for OS drive letter in to format C:
SET /p osdrive="What is the drive letter of the Windows installation: "
ECHO Using Windows path %osdrive%\Windows >> 7bLog.txt

REM Attempt registry mount to HKLM\liveOSSystemHive - exit if error
ECHO Atempting registry mount... >> 7bLog.txt
reg LOAD HKLM\liveOSSystemHive %osdrive%\Windows\system32\config\SYSTEM || ECHO Could not load hive %osdrive%\Windows\system32\config\SYSTEM to HKLM\liveOSSystemHive >> 7bLog.txt
IF ERRORLEVEL 1 EXIT /b

REM Get the control set used by the machine at boot
FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\Select /v Default`) DO (
SET select=%%F
)
FOR %%A IN (%select%) DO SET cs=%%A
SET controlSet=ControlSet%cs:x=0%
ECHO System is booting off %controlSet%... >> 7bLog.txt

REM Check for pending updates

IF EXIST %osdrive%\Windows\WinSxS\pending.xml (
 ECHO WARNING: The system has pending updates >> 7bLog.txt
) ELSE (
 ECHO No pending updates found on the server >> 7bLog.txt
 SET pendingUpdatesResult=0
)

REM Check for drivers

REM Check for ACPI
FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\ACPI`) DO (
SET acpiService=%%F
)
IF "%acpiService%" == "" (
 ECHO ERROR: Could not find the ACPI service in %controlSet%\Services\ACPI >> 7bLog.txt
) ELSE (
 FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\ACPI /v Start`) DO (
 SET acpiServiceStart=%%F
 )
)
IF "%acpiServiceStart%" == "" (
 ECHO ERROR: Could not find the ACPI Start value in %controlSet%\Services\ACPI\Start >> 7bLog.txt
) ELSE (
 FOR %%A IN (%acpiServiceStart%) DO SET acpiStart=%%A
)
IF "%acpiStart%" == "%bootStart%"  ECHO ACPI service start value is set to %acpiStart% ^(Kernel^) >> 7bLog.txt
IF "%acpiStart%" == "%systemStart%" ECHO ERROR: ACPI service start value is set to %acpiStart% ^(SYSTEM^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%acpiStart%" == "%autoStart%" ECHO ERROR: ACPI service start value is set to %acpiStart% ^(AUTO^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%acpiStart%" == "%manualStart%" ECHO ERROR: ACPI service start value is set to %acpiStart% ^(MANUAL^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%acpiStart%" == "%disabledStart%" ECHO ERROR: ACPI service start value is set to %acpiStart% ^(DISABLED^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt

IF EXIST %osdrive%\Windows\system32\drivers\acpi.sys (
 ECHO ACPI driver ^(acpi.sys^) was found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
) ELSE (
 ECHO ERROR: ACPI driver ^(acpi.sys^) was NOT found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
)

REM Check for DISK
FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\disk`) DO (
SET diskService=%%F
)
IF "%diskService%" == "" (
 ECHO Could not find the DISK service in %controlSet%\Services\disk >> 7bLog.txt
) ELSE (
 FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\disk /v Start`) DO (
 SET diskServiceStart=%%F
 )
)
IF "%diskServiceStart%" == "" (
 ECHO Could not find the disk Start value in %controlSet%\Services\disk\Start >> 7bLog.txt
) ELSE (
 FOR %%A IN (%diskServiceStart%) DO SET diskStart=%%A
)
IF "%diskStart%" == "%bootStart%"  ECHO Disk service start value is set to %diskStart% ^(Kernel^) >> 7bLog.txt
IF "%diskStart%" == "%systemStart%" ECHO ERROR: Disk service start value is set to %diskStart% ^(SYSTEM^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%diskStart%" == "%autoStart%" ECHO ERROR: Disk service start value is set to %diskStart% ^(AUTO^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%diskStart%" == "%manualStart%" ECHO ERROR: Disk service start value is set to %diskStart% ^(MANUAL^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%diskStart%" == "%disabledStart%" ECHO ERROR: Disk service start value is set to %diskStart% ^(DISABLED^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt

IF EXIST %osdrive%\Windows\system32\drivers\disk.sys (
 ECHO DISK driver ^(disk.sys^) was found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
) ELSE (
 ECHO ERROR: DISK driver ^(disk.sys^) was NOT found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
)

REM Check for PARTMGR
FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\partmgr`) DO (
SET partService=%%F
)
IF "%partService%" == "" (
 ECHO ERROR: Could not find the PARTMGR service in %controlSet%\Services\partmgr >> 7bLog.txt
) ELSE (
 FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\partmgr /v Start`) DO (
 SET partServiceStart=%%F
 )
)
IF "%partServiceStart%" == "" (
 ECHO ERROR: Could not find the PARTMGR Start value in %controlSet%\Services\partmgr\Start >> 7bLog.txt
) ELSE (
 FOR %%A IN (%partServiceStart%) DO SET partStart=%%A
)
IF "%partStart%" == "%bootStart%"  ECHO PARTMGR service start value is set to %partStart% ^(Kernel^) >> 7bLog.txt
IF "%partStart%" == "%systemStart%" ECHO ERROR: PARTMGR service start value is set to %partStart% ^(SYSTEM^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%partStart%" == "%autoStart%" ECHO ERROR: PARTMGR service start value is set to %partStart% ^(AUTO^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%partStart%" == "%manualStart%" ECHO ERROR: PARTMGR service start value is set to %partStart% ^(MANUAL^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%partStart%" == "%disabledStart%" ECHO ERROR: PARTMGR service start value is set to %partStart% ^(DISABLED^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt

IF EXIST %osdrive%\Windows\system32\drivers\partmgr.sys (
 ECHO PARTMGR driver ^(partmgr.sys^) was found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
) ELSE (
 ECHO ERROR: PARTMGR driver ^(partmgr.sys^) was NOT found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
)

REM Check for VOLMGR
FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\volmgr`) DO (
SET volService=%%F
)
IF "%volService%" == "" (
 ECHO ERROR: Could not find the VOLMGR service in %controlSet%\Services\volmgr >> 7bLog.txt
) ELSE (
 FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\volmgr /v Start`) DO (
 SET volServiceStart=%%F
 )
)
IF "%volServiceStart%" == "" (
 ECHO ERROR: Could not find the VOLMGR Start value in %controlSet%\Services\volmgr\Start >> 7bLog.txt
) ELSE (
 FOR %%A IN (%volServiceStart%) DO SET volStart=%%A
)
IF "%volStart%" == "%bootStart%"  ECHO VOLMGR service start value is set to %volStart% ^(Kernel^) >> 7bLog.txt
IF "%volStart%" == "%systemStart%" ECHO ERROR: VOLMGR service start value is set to %volStart% ^(SYSTEM^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%volStart%" == "%autoStart%" ECHO ERROR: VOLMGR service start value is set to %volStart% ^(AUTO^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%volStart%" == "%manualStart%" ECHO ERROR: VOLMGR service start value is set to %volStart% ^(MANUAL^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%volStart%" == "%disabledStart%" ECHO ERROR: VOLMGR service start value is set to %volStart% ^(DISABLED^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt

IF EXIST %osdrive%\Windows\system32\drivers\volmgr.sys (
 ECHO VOLMGR driver ^(volmgr.sys^) was found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
) ELSE (
 ECHO ERROR: VOLMGR driver ^(volmgr.sys^) was NOT found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
)

REM Check for volsnap
FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\volsnap`) DO (
SET volsnapService=%%F
)
IF "%volsnapService%" == "" (
 ECHO ERROR: Could not find the volsnap service in %controlSet%\Services\volsnap >> 7bLog.txt
) ELSE (
 FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\volsnap /v Start`) DO (
 SET volsnapServiceStart=%%F
 )
)
IF "%volsnapServiceStart%" == "" (
 ECHO ERROR: Could not find the volsnap Start value in %controlSet%\Services\volsnap\Start >> 7bLog.txt
) ELSE (
 FOR %%A IN (%volsnapServiceStart%) DO SET volsnapStart=%%A
)
IF "%volsnapStart%" == "%bootStart%"  ECHO volsnap service start value is set to %volsnapStart% ^(Kernel^) >> 7bLog.txt
IF "%volsnapStart%" == "%systemStart%" ECHO ERROR: volsnap service start value is set to %volsnapStart% ^(SYSTEM^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%volsnapStart%" == "%autoStart%" ECHO ERROR: volsnap service start value is set to %volsnapStart% ^(AUTO^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%volsnapStart%" == "%manualStart%" ECHO ERROR: volsnap service start value is set to %volsnapStart% ^(MANUAL^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%volsnapStart%" == "%disabledStart%" ECHO ERROR: volsnap service start value is set to %volsnapStart% ^(DISABLED^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt

IF EXIST %osdrive%\Windows\system32\drivers\volsnap.sys (
 ECHO volsnap driver ^(volsnap.sys^) was found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
) ELSE (
 ECHO ERROR: volsnap driver ^(volsnap.sys^) was NOT found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
)

REM Check for volume
FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\volume`) DO (
SET volumeService=%%F
)
IF "%volumeService%" == "" (
 ECHO ERROR: Could not find the volume service in %controlSet%\Services\volume >> 7bLog.txt
) ELSE (
 FOR /F "tokens=* USEBACKQ" %%F IN (`REG QUERY HKLM\liveOSSystemHive\%controlSet%\Services\volume /v Start`) DO (
 SET volumeServiceStart=%%F
 )
)
IF "%volumeServiceStart%" == "" (
 ECHO ERROR: Could not find the volume Start value in %controlSet%\Services\volume\Start >> 7bLog.txt
) ELSE (
 FOR %%A IN (%volumeServiceStart%) DO SET volumeStart=%%A
)
IF "%volumeStart%" == "%bootStart%"  ECHO volume service start value is set to %volumeStart% ^(Kernel^) >> 7bLog.txt
IF "%volumeStart%" == "%systemStart%" ECHO ERROR: volume service start value is set to %volumeStart% ^(SYSTEM^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%volumeStart%" == "%autoStart%" ECHO ERROR: volume service start value is set to %volumeStart% ^(AUTO^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%volumeStart%" == "%manualStart%" ECHO ERROR: volume service start value is set to %volumeStart% ^(MANUAL^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt
IF "%volumeStart%" == "%disabledStart%" ECHO ERROR: volume service start value is set to %volumeStart% ^(DISABLED^) - Should be 0x0 ^(Kernel^) >> 7bLog.txt

IF EXIST %osdrive%\Windows\system32\drivers\volume.sys (
 ECHO volume driver ^(volume.sys^) was found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
) ELSE (
 ECHO ERROR: volume driver ^(volume.sys^) was NOT found in %osdrive%\Windows\system32\drivers\ >> 7bLog.txt
)

REM Unload registry Hive
reg UNLOAD HKLM\liveOSSystemHive 
IF ERRORLEVEL 1 (
 ECHO ERROR: Could not unload the registry hive HKLM\liveOSSystemHive >> 7bLog.txt
) ELSE (
  ECHO Registry hive unloaded succesfully >> 7bLog.txt
)