Quick start for kdb using a keyboard connected console

This is a quick example of how to use kdb with a keyboard.

  1. Boot kernel with arguments:

    • kgdboc=kbd

    OR

    Configure kgdboc after the kernel booted:

    • echo kbd > /sys/module/kgdboc/parameters/kgdboc

  2. Enter the kernel debugger manually or by waiting for an oops or fault. There are several ways you can enter the kernel debugger manually; all involve using the sysrq-g, which means you must have enabled CONFIG_MAGIC_SYSRQ=y in your kernel config.

    • When logged in as root or with a super user session you can run:

      echo g > /proc/sysrq-trigger

    • Example using a laptop keyboard

      Press and hold down: Alt

      Press and hold down: Fn

      Press and release the key with the label: SysRq

      Release: Fn

      Press and release: g

      Release: Alt

    • Example using a PS/2 101-key keyboard

      Press and hold down: Alt

      Press and release the key with the label: SysRq

      Press and release: g

      Release: Alt

  3. Now type in a kdb command such as "help", "dmesg", "bt" or "go" to continue kernel execution.