I routinely have at least 20 tabs open in Chrome, 10 files open in Atom (my editor of choice) and I’m often running virtual machines as well. This means my poor little X1 Carbon often runs out of memory, at which point Ubuntu completely freezes up, preventing me from doing anything at all.
Just a few days ago I had written a long post which I lost completely when my system froze, because Atom doesn’t yet recover documents after crashes.
If this sounds at all familiar to you, I now have a solution! (Although it didn’t save me in this case because it needs to be enabled first – see below.)
The magic SysRq key can run a bunch of kernel-level commands. One of these commands is called
oom_kill. OOM stands for “Out of memory”, so
oom_kill will kill the process taking up the most memory, to free some up. In most cases this should unfreeze Ubuntu.
You can run
oom_kill from the keyboard with the following shortcut:
Except that this is disabled by default on Ubuntu:
And to enable the new config run:
Most laptops don’t have a physical
SysRq key. Instead they offer a keyboard combination to emulate the key. On my Thinkpad, this is
fn + s. However, there’s a quirk that the
SysRq key is only “pressed” when you release.
So to run
oom_kill on a Thinkpad, after enabling it, do the following:
skeys together, then release them (keep holding
This will kill the most expensive process (usually the browser tab running
inbox.google.com in my case), and freeup some memory.
Now, if your computer ever freezes up, you can just do this, and hopefully fix it.
(Also posted on robinwinslow.uk)
Interested in running Ubuntu Desktop in your organisation?
Hands up if you or someone in your team work remotely. I am sure there are many of you out there. One of the biggest growing trends, since I started working in the technology industry 15 years ago, is how common and accessible working from…
Snapcraft squad Report a Snap Last year, a snap was found in the Snap Store using computing resources for bitcoin mining without user consent. This software was retired from the Store after further investigation and highlighted the need…
Updating the design of the Ubuntu Releases website using Vanilla Framework