# Linux Kernel Module Cheat

### 17.6. Kernel panic and oops

To test out kernel panics and oops in controlled circumstances, try out the modules:

    insmod panic.ko
    insmod oops.ko

Source:

- kernel_modules/panic.c

- kernel_modules/oops.c

A panic can also be generated with:

    echo c > /proc/sysrq-trigger

Panic vs oops: https://unix.stackexchange.com/questions/91854/whats-the-difference-between-a-kernel-oops-and-a-kernel-panic

How to generate them:

- https://unix.stackexchange.com/questions/66197/how-to-cause-kernel-panic-with-a-single-command

- https://stackoverflow.com/questions/23484147/generate-kernel-oops-or-crash-in-the-code

When a panic happens, `Shift-PgUp` does not work as it normally does, and it is hard to get the logs if on are on QEMU graphic mode:

- https://superuser.com/questions/848412/scrolling-up-the-failed-screen-with-kernel-panic

- https://superuser.com/questions/269228/write-qemu-booting-virtual-machine-output-to-a-file

- http://www.reactos.org/wiki/QEMU#Redirect_to_a_file

- Kernel panic

- Kernel oops

- dump_stack

- WARN_ON

- not syncing: VFS: Unable to mount root fs on unknown-block(0,0)