4

I'm writing a kernel module and I was hoping to get the beautiful Kernel Panic screen with all the details when I call panic(), but my machine just freezes without displaying anything.

I know kpanic is not displayed in X11 GUI mode, but my code switches to text-mode before calling panic().

So the scenario looks like this:

switch_to_text_mode();    /* switch to text-mode (i.e. CTRL-ALT-F1) */

sleep(5);                 /* to make sure text-mode is running */

panic("useful stuff");    /* kpanic */

My kernel version is 5.3.0

Any ideas?

4
  • What is the output of cat /proc/sys/kernel/panic? See man proc for information.
    – JamesL
    Commented Jan 30, 2020 at 20:19
  • @Sman865 The output is 0. I tried setting it to 60 as recommended here, but no luck.
    – CAGYL
    Commented Jan 30, 2020 at 20:36
  • Darn, I was hoping that would be it. What about setting panic_on_oops to 1?
    – JamesL
    Commented Jan 30, 2020 at 20:46
  • Nothing, unfortunately :/ I noticed that documentation for panic_print is titled: Bitmask for printing system info when panic happens . It was set to 0 (bit 0: print all tasks info). I tried all combinations from the documentation (the link I posted above), but nothing works.
    – CAGYL
    Commented Jan 30, 2020 at 21:15

1 Answer 1

0

For panic_print to work, you may need a serial console, as other console may not work properly in the panic context.

1
  • 3
    This seems like it might be helpful for OP, can you add some more details for how they can set this up? Putting the most relevant parts in your answer and providing a link to the source will make this a more useful answer. Commented Apr 9, 2020 at 4:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .