How to scroll up after a kernel panic?

Serial port

The serial port is an old and reliable communication protocol hardware that the Linux kernel supports and most emulators emulate.

You can stream the kernel messages to a host file or console through it:

  • VirtualBox: How does one Capture the Entire Kernel Panic on Boot | Stack Overflow

  • QEMU:

    • to console: How to switch to qemu monitor console when running with "-curses" | Stack Overflow
    • to file: Write QEMU booting virtual machine output to a file | Super User

    Here's a minimal setup to reproduce the problem: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/b366bac0c5410ceef7f2b97f96d93d722c4d9ea6/kernel_module/panic.c

  • real hardware: the serial port is not exposed on most modern laptops, which is a shame... but on desktops it looks like this:

    enter image description here

    Source.

    And on the Raspberry Pi:

    More details at: What is the difference between ttys0, ttyUSB0 and ttyAMA0 in Linux?

Serial alternatives

There are even fancier methods mentioned at: Determining cause of Linux kernel panic | Unix & Linux Stack Exchange

  • netdump: sends trace over network.

    Supposes panic didn't break networking, which is more likely than the serial.

    The advantages over serial are:

    • works for systems that don't have serial exposed such as modern laptops

    • serial cables have quite limited maximum wire lengths, which is problematic if you want to have all the boards of your company on a remote room to share resources across developers.

      There are however serial connectors with an Ethernet server which I would recommend instead if your target exposes serial, e.g. this one:

  • kdump: boots a secondary Linux kernel that inspects the panicked kernel. What could possibly go wrong?

Those methods are more flexible, but less reliable.

See also: Scrolling up the failed screen with kernel panic | Super User


What hypervisor are you working with?

Shift + Pg Up is correct for almost all situations but might not work if the virtual machine hangs or does not boot up completely.

In case of a Mac: "Shift+Fn D-pad UP or DOWN on a Macbook will allow you to scroll". This is from How do you scroll up/down on linux server (terminal)? | Stack Overflow