Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec -N script Permission denied #334

Open
apelin20 opened this issue Dec 5, 2024 · 0 comments
Open

exec -N script Permission denied #334

apelin20 opened this issue Dec 5, 2024 · 0 comments

Comments

@apelin20
Copy link

apelin20 commented Dec 5, 2024

Hello,

I am sure I am doing something wrong, but earlyoom complains it can't execute my script.

$ sudo systemctl status earlyoom
\u25cf earlyoom.service - Early OOM Daemon
     Loaded: loaded (/etc/systemd/system/earlyoom.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-12-05 01:51:17 PST; 16min ago
       Docs: man:earlyoom(1)
             https://github.com/rfjakob/earlyoom
   Main PID: 4811 (earlyoom)
      Tasks: 1 (limit: 10)
     Memory: 860.0K (max: 50.0M available: 49.1M)
     CGroup: /system.slice/earlyoom.service
             \u2514\u25004811 /usr/local/bin/earlyoom -r 3600 -m 15 -s 5 -N /home/apelin/programs/earlyoom/log/earlyoom_kill.sh --avoid "(^|/)(init|Xorg|ssh|sshd)\$"

Dec 05 02:00:16 DESKTOP-JOOR9F9 earlyoom[4811]: sending SIGTERM to process 5048 uid 1000 "tail": oom_score 1280, VmRSS 27343 MiB, cmdline "tail /dev/zero"
Dec 05 02:00:17 DESKTOP-JOOR9F9 earlyoom[4811]: kill_release: pid=5048: process_mrelease pidfd=4 success
Dec 05 02:00:17 DESKTOP-JOOR9F9 earlyoom[4811]: process 5048 exited after 0.000 seconds
Dec 05 02:00:17 DESKTOP-JOOR9F9 earlyoom[5155]: notify_ext: exec /home/apelin/programs/earlyoom/log/earlyoom_kill.sh failed: Permission denied
Dec 05 02:07:54 DESKTOP-JOOR9F9 earlyoom[4811]: mem avail:   223 of 27042 MiB ( 0.83%), swap free:  362 of 8192 MiB ( 4.43%)
Dec 05 02:07:54 DESKTOP-JOOR9F9 earlyoom[4811]: low memory! at or below SIGTERM limits: mem 15.00%, swap  5.00%
Dec 05 02:07:55 DESKTOP-JOOR9F9 earlyoom[4811]: sending SIGTERM to process 7316 uid 1000 "tail": oom_score 1280, VmRSS 26759 MiB, cmdline "tail /dev/zero"
Dec 05 02:07:56 DESKTOP-JOOR9F9 earlyoom[4811]: kill_release: pid=7316: process_mrelease pidfd=4 success
Dec 05 02:07:56 DESKTOP-JOOR9F9 earlyoom[4811]: process 7316 exited after 0.000 seconds
Dec 05 02:07:56 DESKTOP-JOOR9F9 earlyoom[7319]: notify_ext: exec /home/apelin/programs/earlyoom/log/earlyoom_kill.sh failed: Permission denied

Script is in my home directory, which likely isn't ideal but I am not sure where to store it. I gave o=rwx permissions:

~/programs/earlyoom/log $ ll
total 16K
drwxrwxr-x 2 apelin apelin 4.0K Dec  5 02:05 .
drwxr-xr-x 6 apelin apelin 4.0K Dec  5 01:43 ..
-rwxrwxrwx 1 apelin apelin  227 Dec  5 02:05 earlyoom_kill.sh
-rw-rw-rwx 1 apelin apelin   88 Dec  5 02:06 log_earlyoom

All the script does is add a line to a log file:

$ cat earlyoom_kill.sh
#!/bin/bash

timestart="$(paste <(date +%F) <(date +%T) | sed 's,\t, ,g')"

echo "Time: ${timestart}; earlyoom event; EARLYOOM_PID ${EARLYOOM_PID}; EARLYOOM_NAME ${EARLYOOM_NAME}; EARLYOOM_UID ${EARLYOOM_UID}" >> log_earlyoom

System is Ubuntu 24.04.1 LTS running as a WSL. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant