17

While tinkering with a Linux VM I regularly get kernel panics, that push up all the helpful output with stuff I don't understand and that is probably not helpful to me.

The panics mostly occur during the initramfs phase. I'm using VirtualBox.

The normal Shift+Pg Up does not work (in my case).

Is there another way to scroll back up and look at the output of whatever came before?

Minix
  • 5,855
  • Another helpful way to get access to helpful info: you can pass the "break=something kernel parameter (where valid arguments for something are: top, modules, premount, mount, mountroot, bottom, init)" - https://wiki.debian.org/InitramfsDebug – Ben Creasy Oct 24 '18 at 05:45

2 Answers2

11

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:

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

Ciro Santilli OurBigBook.com
  • 18,092
  • 4
  • 117
  • 102
  • That is simply a dumb connector adapter that converts a DB-9 serial port to a RJ-45 form factor, or vice versa. It does not allow you to pass serial traffic in an Ethernet network, but allows you to e.g. repurpose an existing network cable for serial port use. Some network switches and the like may also have a serial port in RJ-45 form simply because a smaller connector is easier to fit in the faceplate of an 1U rack device. – telcoM Dec 17 '18 at 16:03
  • @telcoM OK, let me know if you have a link to a product that does it. What I mean is an IP server that converts to serial. – Ciro Santilli OurBigBook.com Dec 17 '18 at 16:04
  • 1
    You're thinking about serial device servers, also known as port servers or device servers. Many of those are designed for industrial automation purposes, and so might be needlessly rugged/expensive for hobbyist use. Here's the cheapest one I could find quickly. – telcoM Dec 17 '18 at 16:18
  • Any cable manufacturer which uses blue for a serial cable is just confusing people. Blue is for VGA (which has a very similar form factor). – NH. Dec 17 '18 at 16:42
3

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

eegor
  • 41