# Manual kernel panic



## Seeker (Jan 6, 2010)

How do I intentionally make kernel into panicing by using some cmd or key combination as a root? :stud


----------



## crsd (Jan 6, 2010)

```
> sysctl -d debug.kdb.panic
debug.kdb.panic: set to panic the kernel
```

Happy panic'ing.


----------



## aragon (Jan 6, 2010)

I think you need ddb(4) compiled in, and to escape to it possibly Ctrl+Alt+ESC depending on your keymap(5).


----------



## Seeker (Jan 6, 2010)

crsd said:
			
		

> ```
> > sysctl -d debug.kdb.panic
> debug.kdb.panic: set to panic the kernel
> ```



Nothing happens, even after reboot.
I have GENERIC kernel.

Is it true, that I have to compile *ddb* as aragon said?


----------



## Beastie (Jan 6, 2010)

Seeker said:
			
		

> Nothing happens, even after reboot.
> I have GENERIC kernel.
> 
> Is it true, that I have to compile *ddb* as aragon said?


Read ddb(4):


> In order to enable kernel debugging facilities include:
> options KDB
> options DDB



Do you see any of these options in the GENERIC kernel configuration /usr/src/sys/i386/conf/GENERIC?


----------



## crsd (Jan 6, 2010)

Beastie said:
			
		

> Read ddb(4):
> 
> 
> Do you see any of these options in the GENERIC kernel configuration /usr/src/sys/i386/conf/GENERIC?



Yes, I do, on -CURRENT  and always forgetting about them, sorry.


----------



## SirDice (Jan 6, 2010)

AFAIK the ctrl-alt-esc key combination invokes the debugger. This isn't really a panic. If you want a 'real' panic this should probably do:

```
#include <sys/types.h>
#include <sys/systm.h>

main() {
panic("Danger Will Robinson, danger!");
}
```

See panic(9).


----------



## Seeker (Jan 7, 2010)

Hey guys! I just found something. :stud

So... Theory is to do something, at the lowest _layer_ possible and then get rid of all surplus _layers_.

First we need to do:

```
# sysctl machdep.enable_panic_key=1
```

Now we need to create panic keyboard binding, which doesn't exist with default FreeBSD's setup - "us"

To this list:

```
kbdmap -p
```
I need to add *panic*, which is activated (As I have choosen), by pressing Esc + p

So to the current _kbd_ layout, I need to append just this one _*panic* button_

Now, how do I add and where: (I got to run now, so)

```
panic 'esc' ( 'p' )
```

Then panic would be achieved by pressing Esc+p


----------

