Search code examples
windowsdebuggingkernelwindbgboot

How to turn off Windows kernel debugging at boot time?


I have a Vista 32 bit machine which I wanted to enable local kernel debugging on. In WinDbg I selected File/Kernel Debug and selected the Local tab and clicked ok. I got the following message.

The system does not support local kernel debugging. ... Local kernel debugging is disabled by default in Windows Vista, you must run 'bcdedit -debug on' and reboot to enable it.

I naively followed the instructions and opened an elevated command prompt and typed 'bcdedit -debug on' and the rebooted.

However, on reboot the system hangs when it gets to the logon screen - or just after I type in my username and password.

I suspect what is happening is that because a debugger is enabled, user mode exceptions are being triggered in the kernel debugger process and it is waiting for me to enter some input from an attached debugger??

I was hoping to debug on the actual target machine.

My problem is that every time I boot - whatever F8 boot option I choose - it always either hangs or gets so far and then reboots - and then hangs.

Booting in Safe Mode - gets close to the logon screen and then reboots. Same applies for the command line and network boot options. Last known good config - hangs too.

Is there any way to change the boot option before Windows loads so that I can turn off kernel debugging. I have only the one boot config which was, in hindsight, my problem - I should have created a copy of the first boot config for my debug boot option.

Unfortunately the system doesn't have a serial port so I can't attempt to debug through that.

The only option I can think of now is to attempt to connect a debugger from a different machine through a USB port. However, don't I need to configure the target PC to accept a debugger on a USB port or will this just work if I get a proper debug USB cable?


Solution

  • Worked out how to get the machine running again.

    Pressing F8 during reboot gives the Repair option. Selecting Repair and gives a number of other options including Restoring to a previous restore point and also opening a command prompt.

    I had tried the following...

    Opening a command prompt and typing "bcdedit -debug off" which was accepted but didn't seem to help. I then tried restoring to a restore point of a couple of days previous. Again I got a hang on reload.

    The reason,.... neither of these actually turned off the debug option for the boot config.

    What I needed to do was: in the Repair menu - open a command prompt. Then type bcdedit /enum to list the boot configs. Then call

    bcdedit /set {default} debug off
    

    I guess my initial attempts to call bcdedit -debug off were turning it off on the (which it already was) on the boot manager config because I didn't specify a particular config name.