nohang(8)
β¨ nohang(8) β¨
okay bestie, gather round, because we're about to talk about the Linux System Administrator's Manual entry for nohang and honestly? she's iconic.
π NAME π
nohang β a sophisticated low memory handler. yes. sophisticated. she has layers. π
πΈ SYNOPSIS πΈ
nohang [OPTION]...
that's it. that's the whole summoning ritual. π
π¦ DESCRIPTION π¦
so nohang is a highly configurable daemon for Linux, and what she does is correctly prevent out of memory (OOM) and keep your system's responsiveness alive when memory gets low. like, she's not out here panicking when things get tight β she's the friend who stays calm and fixes everything while everyone else is screaming. main character energy fr. π
π«Ά REQUIREMENTS π«Ά
for basic usage (the bare minimum, the essentials, the vibe check):
- Linux (
>= 3.14, because that's whenMemAvailableshowed up in/proc/meminfo) - Python (
>= 3.3)
to respond to PSI metrics (optional, but make it fancy):
- Linux (
>= 4.20) withCONFIG_PSI=y
to show GUI notifications (optional, the aesthetic tier):
- a notification server (most desktop environments use their own implementations)
libnotify(on Arch Linux, Fedora, openSUSE) orlibnotify-bin(on Debian GNU/Linux, Ubuntu)sudoifnohangwas started withUID=0
β COMMAND-LINE OPTIONS β
okay this is the part where you actually learn the buttons, pay attention bestie:
-h,--helpβ show this help message and dip. πͺ-v,--versionβ show the version of the installed package and exit-m,--memloadβ consume memory until40 MiB(MemAvailable + SwapFree) remain free, then terminate the process. yes she will eat your RAM on purpose, that's the point, it's a test π-c CONFIG,--config CONFIGβ path to the config file. this should only be used with one of the following options:--monitor,--tasks,--check--checkβ check and show the configuration, then exit. this should only be used with the-c/--config CONFIGoption--monitorβ start monitoring. this should only be used with the-c/--config CONFIGoption--tasksβ show tasks state and exit. this should only be used with the-c/--config CONFIGoption
π FILES π
:SYSCONFDIR:/nohang/nohang.confβ path to the vanillanohangconfiguration file:SYSCONFDIR:/nohang/nohang-desktop.confβ path to the configuration file with settings optimized for desktop usage:DATADIR:/nohang/nohang.confβ path to the file with defaultnohang.confvalues:DATADIR:/nohang/nohang-desktop.confβ path to the file with defaultnohang-desktop.confvalues/var/log/nohang/nohang.logβ optional log file that stores entries ifseparate_log=Truein the config/etc/logrotate.d/nohangβ logrotate config file that controls rotation in/var/log/nohang/
π nohang.conf vs nohang-desktop.conf π
it's giving sibling rivalry, but make it config files:
nohang.confgives you vanilla default settings β no PSI checking enabled, no badness correction, and no GUI notifications enabled. minimal. clean. raw. πnohang-desktop.confgives you default settings optimized for desktop usage. she's dressed up, she's ready to go out. β¨
π PROBLEMS π
ngl bestie, these next problems can happen with out-of-tree kernels and modules. read carefully.
- The ZFS ARC cache is memory-reclaimable, like the Linux buffer cache. However, in contrast to the buffer cache, it currently does not count toward
MemAvailable[1]. See also [2] and [3]. - Linux kernels without
CONFIG_CGROUP_CPUACCT=y(linux-ck, for example) provide incorrect PSI metrics, see this thread [4].
π HOW TO CONFIGURE π
you configure the program by editing the config file. the configuration includes the following sections:
- Memory levels to respond to as an OOM threat
- Response on PSI memory metrics
- The frequency of checking the level of available memory (and CPU usage)
- The prevention of killing innocent victims π (protect the innocent!!)
- Impact on the badness of processes via matching their names, cmdlines and UIDs with regular expressions
- The execution of a specific command or sending any signal instead of sending the
SIGTERMsignal - GUI notifications:
- notifications of corrective actions taken
- low memory warnings
- Verbosity
- Misc
Just read the description of the parameters and edit the values. Then restart the daemon to apply the changes. no cap, the restart is not optional. π
π CHECK CONFIG π
check the config for errors, like so:
$ nohang --check --config /path/to/config
π§ͺ HOW TO TEST π§ͺ
The safest way is to run nohang --memload. This causes memory consumption, and the process will exit before OOM occurs. π
Another way is to run tail /dev/zero. This causes fast memory consumption and causes OOM at the end. π
If testing occurs while nohang is running, these processes should be terminated before OOM occurs.
π LOGGING π
To view the latest entries in the log (for systemd users):
$ sudo journalctl -eu nohang.service
or
$ sudo journalctl -eu nohang-desktop.service
You can also enable separate_log in the config to log into /var/log/nohang/nohang.log. π
π¨ SIGNALS π¨
Sending SIGTERM, SIGINT, SIGQUIT or SIGHUP signals to the nohang process causes it to display corrective action stats and exit. so basically, she'll show you the receipts on her way out. π
π REPORTING BUGS π
Please ask any questions and report bugs at https://github.com/hakavlad/nohang/issues. don't be shy, they don't bite π«Ά
π AUTHOR π
Written by Alexey Avramov <hakavlad@gmail.com>.
π HOMEPAGE π
Homepage is https://github.com/hakavlad/nohang.
π¦ SEE ALSO π¦
oom-sort(1), psi-top(1), psi2log(1)
π NOTES π
https://github.com/openzfs/zfs/issues/10255https://github.com/rfjakob/earlyoom/pull/191#issuecomment-622314296https://github.com/hakavlad/nohang/issues/89https://github.com/hakavlad/nohang/issues/25#issuecomment-521390412
and that's the whole page bestie!! πΈ this one lives in the Linux System Administrator's Manual as nohang(8), and she's been serving since... well, the footer doesn't say a date, so let's just say she's timeless. β¨ mwah, go protect your RAM. πππ¦
π¦ where this page comes from
- ubuntu resolute: nohang 0.3.0-3 Β· MIT
- ubuntu stonking: nohang 0.3.0-3 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms