- All right, so we need to make sure
that we have full sysrq functionality.
That was in /proc/sys/kernel/sysrq.
And we can see "1", and 1 is exactly what we need.
Next, we need sysrq to trigger a full OOM kill.
I would always advise, before you do that,
use echo h
even if you're sure about what you want to do.
/proc/sysrq-trigger,
and then dmesg
to check what it is telling you.
And there we can see memory-full-oom-kill is f.
The reason you need to check it out
is that these sysrq-triggers can do pretty nasty stuff
on your system.
Like, if by accident you type c,
then you crash your system.
And then it's gone.
So you better be sure that you know
what it is that you are going to do.
So echo f > /proc/sysrq-trigger.
And there we go, and again it is killing the GDM,
GNOME graphical Display Manager.
Right. So now we are back.
Let's have a look at journalctl | grep -A 10 OOM,
which is showing us, right here,
"process of the unit has been killed by the OOM killer."
So we are running out of memory,
and then the essence is
that a process will be killed.
And here you can see the information
that was printed right after it.
I have used -A on my grep, -A for "after."
Maybe you wanna do minus uppercase C for after and before.
There's -A for after, -B for before,
and -C for after and before,
so that you can see exactly what has been going on
and get more information about the process that was killed.
In this case, by the way, that was pretty obvious
because we were kicked out of the graphical Display Manager.
In some other cases it might not be that obvious.
Hey, shall I show you something fun?
Let's get back to this echo h > /proc/sysrq-trigger,
and dmesg.
Because what else can we do?
Well, we can do pretty dramatic stuff,
like echo c > /proc/sysrq-trigger
What is going to happen?
Oh no, my system isn't doing anything anymore.
It crashes.
That's what is going to happen.
Now, you might wonder, why is this useful?
Well, this is useful if you want to test
what your system is doing in specific cases.
Maybe you have configured some high availability,
and you want stuff to be started again automatically.
Then isn't it cool that you can test what is happening
if your system is crashing.
echo c > /proc/sysrq-trigger,
and you got yourself a crash.
And that is how cool, and at the same time, dangerous
the sysrq-triggers can be.