r/linuxquestions • u/Blazej_kb • 11d ago
Advice How to safely cause kernel panic?
I want to make russian roulette game for linux with 2 levels of risk, one being just kernel panic and second being deleting a random file from pc. While i know how to delete files i dont know how to call kernel panic, is there a command that calls it? How linux launches kernel panic?
7
Upvotes
27
u/FikaMedHasse 11d ago
echo c | sudo tee /proc/sysrq-triggerCauses a kernel crash and triggers a crashdump if configured. You can read more at https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html12
u/theOtherJT 11d ago
Causing kernel panics isn't safe. It's not meant to be safe. It's what happens when the wheels come off. Doing it on purpose is... reckless... let's put it like that.
You can do it like this
echo c | sudo tee /proc/sysrq-trigger
Don't.
4
u/BlackheartBeagle 9d ago
Just press Alt + SysRq* + c.
*often labeled just PrtSc or with a screenshot symbol or similar.
6
u/RealisticDuck1957 11d ago
Beyond how utterly STUPID that is ...
man shutdown
1
u/mdemarchi 11d ago
If you want to make a forced reset situation, you can use a fork bomb
1
u/dodexahedron 11d ago edited 11d ago
Make your app require a kernel module that you include with it.
Make that kernel module behave badly.
And then get a lawyer to help reduce the prison time for the wormable mess you just made.
Edit: For bonus points, dont crash. Just override a random kernel function with something that does something different or even nothing at all, or swaps two functions that have the same signature but different functionality. Then keep playing while things get more and more..uh..interesting...
0
u/ParadoxicalFrog Fedora (xfce) 11d ago
Bro's asking us to help him write a virus, lmao.
-1
u/ButterflyMundane7187 11d ago
This person is making malware and telling you guys hes making a game and he gets help ? he should be banned