At the beginning of the year we talk here on the blog about the Earlyoom utility, which, after a discussion by the Fedora developers, was accepted for using this utility in Fedora 32 as a background process, with which they intend to improve the response of the system to the lack of memory and thereby avoid crashes.
Now several weeks later and After eight months of development, the release of the new version of Earlyoom 1.4 was announced.
For those who are unfamiliar with the project, they should know that this is a background thread that periodically checks the amount of memory available (MemAvailable, SwapFree) and tries to respond to an out of memory condition at an early stage. The project code is written in C and distributed under the MIT license.
If the amount of available memory is less than the specified value, earlyoom will end by force (by sending SIGTERM or SIGKILL) the process of the process that consumes the most memory (which has the highest value / proc / * / oom_score), without system state clearing system buffers and interfering with swap work (OOM (out of memory) driver in kernel fires when low state memory has already reached critical values, and generally at this point the system is no longer responding to user actions).
Earlyoom supports the sending of forced process notifications to the desktop (by sending notifications), and also provides the ability to define rules in which regular expressions can be used to specify the names of processes whose termination is preferred (the "–prefer" option) or stops that should be avoided (–avoid option).
What's new in Earlyoom 1.4?
In this new version some changes are highlighted, of which It is mentioned that I work on cleaning the code and that also due to the delayed loading of the process attributes, the logic of selecting processes to complete is sped up by 50%.
Besides that also root privilege reset was implemented in the drive file "systemd earlyoom.service". This change breaks the ability to receive GUI notifications.
To re-enable GUI notifications, it is proposed to return root rights by uncommenting the line «DynamicUser = true«.
Although disabling root also makes it impossible to get information about memory consumption when mounting / Proc Mode hidepid = 1 or hidepid = 2.
Of the other changes that stand out:
- The UID of the terminated process is reflected in the registry, in addition to the PID and the process name.
- Added light gray debug log highlighting.
- If possible, the declaration of variables local to the blocks was used.
- Configuration added PATH_LEN to override the value of the embedded buffer size in the code.
- Possibility of starting cppcheck if available.
- Performance test "make bench" added.
- Extended test suite (make test).
Finally if you want to know more about it About this release, you can check the details in the following link
How to install earlyoom on Linux?
For those who are interested in being able to try this utility, they can do so by following the instructions that we share below.
Earlyoom is located within the repositories of some of the distributions of popular Linux, so, in the case of Debian, Ubuntu and any derivatives of these, the installation can be done with the following command:
sudo apt install earlyoom
Once this is done, the service must now be enabled with the command:
sudo systemctl enable earlyoom
And it starts with:
sudo systemctl start earlyoom
In the case of Fedora and RHEL 8 with EPEL, it can be installed with the following command:
sudo dnf install earlyoom
And the service is activated with:
sudo systemctl enable --now earlyoom
Finally, in the case of Arch Linux or any other derivative of this, the installation is done with the following command:
sudo pacman -S earlyoom
And the service is activated with:
sudo systemctl enable --now earlyoom
For all other Linux distributions, they can perform the installation by compiling the utility code.
To obtain the code we can do it with the following command:
git clone https://github.com/rfjakob/earlyoom.git
cd earlyoom
We proceed to compile with:
make
And we install (if you have Systemd):
sudo make install
Or for those who don't have Systemd:
sudo make install-initscript
And to use the service you do it with:
./earlyoom
A detail of the title: «memory loss»
Thanks for the observation. Regards! 🙂
I think there is a detail with the installation in Manjaro (derived from Arch). I did not find the package in the normal repositories.
So the installation should be through yaourt.
yaourt earlyoom
Regards!
In Arch, it is inside the community repository which has to be enabled in pacman.conf. In the same way as you mention it is also in AUR.
Thanks for the observation 😀
Hi, I want this service to start in MXLinux every time I turn on the computer without having to put the command in terminal, how can I do it?