rfjakob / earlyoom

earlyoom - Early OOM Daemon for Linux
MIT License
2.95k stars 157 forks source link

Config file hard to find, so do not know how to exclude app #240

Open slrslr opened 3 years ago

slrslr commented 3 years ago

Hello,

after installing earlyoom 1.6.2 on Manjaro (Arch based) Linux, i have enabled and started the service (systemctl enable earlyoom && systemctl start earlyoom). It then killed some apps i have not wanted to be killed, so i was looking at "earlyoom --help" and a quick look on manual page. I do not see how to exclude app. I do not know how regex should look like so i have tried: earlyoom --avoid appname but that just launches the app, beside the already running earlyoom service(?).

Maybe it can be more intuitive if the command will write to the config file and report the result / or mention config file location on systemctl status and on the bottom of the manual page / relocate conf file to /etc/earlyoom.conf instead of /etc/default/earlyoom

Another whining of the noob would be about not seeing a GUI notification of killing the app, despite i have installed systembus-notify package on my XFCE Manjaro (Arch based) Linux. I have not started systembus-notify as i can not find the service) UPDATE: after reboot, i see it started showing the notifications. Would be nice if reboot not needed.

jayenashar commented 3 years ago

i believe the config file is distribution-dependent. i don't believe earlyoom supports a config file directly. so, your distribution's package maintainer probably has created /etc/default/earlyoom as well as the service (/etc/init.d/earlyoom on my distribution). you probably have better luck asking @mtorromeo

mtorromeo commented 3 years ago

The service arguments are defined in /etc/default/earlyoom just like @jayenashar guessed.

You will find the regular expression to edit for the avoid argument there. You then have to restart the service.

mtorromeo commented 3 years ago

Also systembus-notify should just autostart via the /etc/xdg/autostart/systembus-notify.desktop file (if you installed the package) but that might also depend on your desktop environment.

hakavlad commented 3 years ago

I do not know how regex should look

To decrease badness of the App (full matching with name):

--avoid "^App Name$"

To find names of running processes:

ps -eo pid,comm

Output like follow:

  PID COMMAND
    1 systemd
    2 kthreadd
    3 rcu_gp
    4 rcu_par_gp
    6 kworker/0:0H-kb
    8 mm_percpu_wq
...

COMMAND in this output is actually Name of the process.

Note that one App may start processes with various names. For example,

For example, prefer firefox tabs:

--prefer "^(Web Content|Privileged Cont|file:// Content)$"
hakavlad commented 3 years ago

The earlyoom configuration file in Fedora 32 looked like this:

EARLYOOM_ARGS="-r 0 -m 4 -M 409600 --prefer '^Web Content$' --avoid '^(dnf|packagekitd|gnome-shell|gnome-session-c|gnome-session-b|lightdm|sddm|sddm-helper|gdm|gdm-wayland-ses|gdm-session-wor|gdm-x-session|Xorg|Xwayland|systemd|systemd-logind|dbus-daemon|dbus-broker|cinnamon|cinnamon-sessio|kwin_x11|kwin_wayland|plasmashell|ksmserver|plasma_session|startplasma-way|xfce4-session|mate-session|marco|lxqt-session|openbox)$'"

This config provides protection of various important processes.

arch-user-france1 commented 3 years ago

config file path is in the README / manual