Can I set nohang to autostart?

I had this issue where my system used to hang with only muse still moving, and we reached a conclusion that my memory was full and i needed to use nohang.
However every time I reboot, I have to manually type "systemctl start nohang"
i tried "systemctl autostart nohang" and it showed "Unknown command verb autostart"
is there a different command for this or is it not possible?

i tried using kde connect to just start it when i think it might hang but it needs password to launch, and i dont think i will be able to input password when the system freezes.

inxi -Faz

System:    Kernel: 5.13.12-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0  
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen root=UUID=cf8bfd82-2ed5-4d37-9551-1f15f1966218 rw  
[email protected] quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
systemd.unified_cgroup_hierarchy=1 loglevel=3
Desktop: KDE Plasma 5.22.4 tk: Qt 5.15.2 info: latte-dock wm: kwin_x11 vt: 1 dm: SDDM  
Distro: Garuda Linux base: Arch Linux  
Machine:   Type: Laptop System: Acer product: Aspire A715-75G v: V2.03 serial: <filter>  
Mobo: CFL model: Azalea_FMS v: V2.03 serial: <filter> UEFI: Insyde v: 2.03 date: 04/08/2021  
Battery:   ID-1: BAT1 charge: 37.9 Wh (79.5%) condition: 47.7/47.9 Wh (99.5%) volts: 12.3 min: 11.4  
model: Murata AP18C4K type: Li-ion serial: <filter> status: Unknown  
CPU:       Info: Quad Core model: Intel Core i5-9300H bits: 64 type: MT MCP arch: Kaby Lake note: check family: 6  
model-id: 9E (158) stepping: A (10) microcode: EA cache: L2: 8 MiB  
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 38400  
Speed: 4000 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 4000 2: 4000 3: 4000 4: 3884 5: 3989  
6: 3879 7: 3999 8: 3880  
Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled  
Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable  
Type: mds mitigation: Clear CPU buffers; SMT vulnerable  
Type: meltdown mitigation: PTI  
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp  
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization  
Type: spectre_v2  
mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling  
Type: srbds mitigation: Microcode  
Type: tsx_async_abort status: Not affected  
Graphics:  Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] vendor: Acer Incorporated ALI driver: i915  
v: kernel bus-ID: 00:02.0 chip-ID: 8086:3e9b class-ID: 0300  
Device-2: NVIDIA TU117M vendor: Acer Incorporated ALI driver: nvidia v: 470.63.01  
alternate: nouveau,nvidia_drm bus-ID: 01:00.0 chip-ID: 10de:1f99 class-ID: 0300  
Device-3: Chicony HD User Facing type: USB driver: uvcvideo bus-ID: 1-5:3 chip-ID: 04f2:b64f  
class-ID: 0e02 serial: <filter>  
Display: x11 server: X.Org 1.20.13 compositor: kwin_x11 driver: loaded: modesetting,nvidia  
display-ID: :0 screens: 1  
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") s-diag: 582mm (22.9")  
Monitor-1: eDP-1 res: 1920x1080 hz: 60 dpi: 142 size: 344x194mm (13.5x7.6") diag: 395mm (15.5")  
OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 21.2.1 direct render: Yes  
Audio:     Device-1: Intel Cannon Lake PCH cAVS vendor: Acer Incorporated ALI driver: snd_hda_intel v: kernel  
alternate: snd_soc_skl,snd_sof_pci_intel_cnl bus-ID: 00:1f.3 chip-ID: 8086:a348 class-ID: 0403  
Sound Server-1: ALSA v: k5.13.12-zen1-1-zen running: yes  
Sound Server-2: JACK v: 1.9.19 running: no  
Sound Server-3: PulseAudio v: 15.0 running: no  
Sound Server-4: PipeWire v: 0.3.33 running: yes  
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Acer Incorporated ALI  
driver: r8169 v: kernel port: 3000 bus-ID: 07:00.0 chip-ID: 10ec:8168 class-ID: 0200  
IF: enp7s0 state: down mac: <filter>  
Device-2: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel port: 3000 bus-ID: 08:00.0 chip-ID: 8086:2723  
class-ID: 0280  
IF: wlp8s0 state: up mac: <filter>  
Bluetooth: Device-1: Intel AX200 Bluetooth type: USB driver: btusb v: 0.8 bus-ID: 1-14:5 chip-ID: 8087:0029  
class-ID: e001  
Report: bt-adapter ID: hci0 rfk-id: 2 state: up address: <filter>
Drives:    Local Storage: total: 476.94 GiB used: 21.89 GiB (4.6%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SK Hynix model: HFM512GDJTNG-8310A size: 476.94 GiB
block-size: physical: 512 B logical: 512 B speed: 15.8 Gb/s lanes: 2 type: SSD serial: <filter>
rev: 80002C00 temp: 39.9 C scheme: GPT
Partition: ID-1: / raw-size: 47.03 GiB size: 47.03 GiB (100.00%) used: 21.83 GiB (46.4%) fs: btrfs
dev: /dev/nvme0n1p5 maj-min: 259:5
ID-2: /boot/efi raw-size: 100 MiB size: 96 MiB (96.00%) used: 60.2 MiB (62.7%) fs: vfat
dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 47.03 GiB size: 47.03 GiB (100.00%) used: 21.83 GiB (46.4%) fs: btrfs
dev: /dev/nvme0n1p5 maj-min: 259:5
ID-4: /var/log raw-size: 47.03 GiB size: 47.03 GiB (100.00%) used: 21.83 GiB (46.4%) fs: btrfs
dev: /dev/nvme0n1p5 maj-min: 259:5
ID-5: /var/tmp raw-size: 47.03 GiB size: 47.03 GiB (100.00%) used: 21.83 GiB (46.4%) fs: btrfs
dev: /dev/nvme0n1p5 maj-min: 259:5
Swap:      Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 7.6 GiB used: 0 KiB (0.0%) priority: 100 dev: /dev/zram0
Sensors:   System Temperatures: cpu: 56.0 C mobo: N/A
Fan Speeds (RPM): N/A
Info:      Processes: 302 Uptime: 11m wakeups: 1 Memory: 7.6 GiB used: 3.56 GiB (46.8%) Init: systemd v: 249
tool: systemctl Compilers: gcc: 11.1.0 clang: 12.0.1 Packages: pacman: 1407 lib: 348 Shell: fish
v: 3.3.1 default: Bash v: 5.1.8 running-in: konsole inxi: 3.3.06

Any suggestions or redirections to link will be very helpful.
Thanks

sudo systemctl enable --now nohang.service

I would suggest nohang-desktop service though.
As stated at there github,

  • nohang-desktop.conf provides default settings optimized for desktop usage.

If you want to use nohang-desktop then use,

sudo systemctl enable --now nohang-desktop.service
2 Likes

nohang-desktop is by default enabled on Garuda installations. To me it seems like you would have 2 services running at the same time, please verify if thats the case.

3 Likes

Is the graphics card in use? bcz system is freezing?
:thinking:

i m using laptop

is it optimised for laptops too?

when i run "systemctl status nohang" just after boot , it says inactive

nope i rarely use my graphics in linux. maybe while using brave browser but seldom otherwise

But you read what I wrote?

1 Like

I think my service starts but is inactive. i rebooted my system and ran

systemctl status nohang
○ nohang.service - Sophisticated low memory handler
Loaded: loaded (/usr/lib/systemd/system/nohang.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:nohang(8)
https://github.com/hakavlad/nohang

this is what i get
and when i manually start nohang with the command
"systemctl start nohang" and then run status, it shows

● nohang.service - Sophisticated low memory handler
Loaded: loaded (/usr/lib/systemd/system/nohang.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-09-01 21:29:59 IST; 2s ago
Docs: man:nohang(8)
https://github.com/hakavlad/nohang
Main PID: 9309 (python3)
Tasks: 1 (limit: 25)
Memory: 12.4M (max: 100.0M swap max: 100.0M available: 87.5M)
CPU: 161ms
CGroup: /hostcritical.slice/nohang.service
└─9309 python3 /usr/bin/nohang --monitor --config /etc/nohang/nohang.conf

Sep 01 21:29:59 Chris-Aspire7 systemd[1]: Started Sophisticated low memory handler.
Sep 01 21:29:59 Chris-Aspire7 nohang[9309]: Starting nohang with config /etc/nohang/nohang.conf
Sep 01 21:29:59 Chris-Aspire7 nohang[9309]: Monitoring has started!

I just want to make it so that i dont have to manually do this everytime

just extra info if it may help
i m running zen kernel

There is a difference between nohang and nohang-desktop. The right thing to do wouldve been checking systemctl status nohang-desktop.

1 Like

IMO nohang is kinda annoying when it quits java.

you were right, i ran systemctl status nohang-desktop and i got

○ nohang-desktop.service - Sophisticated low memory handler
Loaded: loaded (/usr/lib/systemd/system/nohang-desktop.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Wed 2021-09-01 21:29:59 IST; 11h ago
Docs: man:nohang(8)
https://github.com/hakavlad/nohang
Process: 501 ExecStart=/usr/bin/nohang --monitor --config /etc/nohang/nohang-desktop.conf (code=exited, status=0/SUCCESS)
Main PID: 501 (code=exited, status=0/SUCCESS)
CPU: 207ms

Sep 01 21:27:13 Chris-Aspire7 systemd[1]: Started Sophisticated low memory handler.
Sep 01 21:27:13 Chris-Aspire7 nohang-desktop[501]: Starting nohang with config /etc/nohang/nohang-desktop.conf
Sep 01 21:27:13 Chris-Aspire7 nohang-desktop[501]: Monitoring has started!
Sep 01 21:29:59 Chris-Aspire7 systemd[1]: Stopping Sophisticated low memory handler...
Sep 01 21:29:59 Chris-Aspire7 nohang-desktop[501]: Got the SIGTERM signal
Sep 01 21:29:59 Chris-Aspire7 nohang-desktop[501]: No corrective actions applied in the last 2min 45s
Sep 01 21:29:59 Chris-Aspire7 nohang-desktop[501]: Process time: 0.18s (average: 0.11%); exit.
Sep 01 21:29:59 Chris-Aspire7 systemd[1]: nohang-desktop.service: Deactivated successfully.
Sep 01 21:29:59 Chris-Aspire7 systemd[1]: Stopped Sophisticated low memory handler.

can i set it to autostart?

It autostarts already :eyes:
I was suspecting it being disabled once you enabled nohang but it all happened quite quickly - did you enable it right after booting?

1 Like

i didn't really do anything
i just ran the command "systemctl status nohang-desktop" after i rebooted

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.