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

NUT doesn't support "inhibitor interface" #1070

Closed
Callisos opened this issue Aug 2, 2021 · 3 comments · Fixed by #2597
Closed

NUT doesn't support "inhibitor interface" #1070

Callisos opened this issue Aug 2, 2021 · 3 comments · Fixed by #2597
Labels
service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug systemd
Milestone

Comments

@Callisos
Copy link

Callisos commented Aug 2, 2021

I would like NUT to hibernate my PC instead of shutting it down when ONBATT event is registered. So I've put:
SHUTDOWNCMD "systemctl hibernate" to /etc/ups/upsmon.conf.

But this works only once, unless there's a hack in /usr/lib/systemd/system-sleep/ which stops nut-server.service during hibernation and starts it during wake up, there also needs to be starting of nut-monitor.service specified. Otherwise nut-monitor.service reports to be "inactive (dead)" after waking up so no ONBATT event is registered and thus no hibernation takes place. In openSUSE's NUT package, currently there's a hack /usr/lib/systemd/system-sleep/nut.sh for it and is broken so it needs to be fixed manually.

After checking "man systemd-sleep", it states that scripts in /usr/lib/systemd/system-sleep/ are considered hacks for applications not using the so called "inhibitor interface".

If NUT would use inhibitor interface, there wouldn't be a need for /usr/lib/systemd/system-sleep/ hacks implemented by individual distros and my PC could be hibernated by NUT without problem.

Tested in OS: openSUSE Leap 15.3. with NUT v.2.7.4.
Related mailing list discussion
And continuation

@jimklimov jimklimov added systemd service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug labels Dec 4, 2023
@jimklimov jimklimov added this to the 2.8.3 milestone Dec 4, 2023
@jimklimov
Copy link
Member

Seems related to #1833

@jimklimov
Copy link
Member

jimklimov commented Aug 15, 2024

jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
…NHIBITOR availability for default installation of nut-sleep.service [networkupstools#1833, networkupstools#1070, networkupstools#2596]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
…kupstools#1070]

Snow-ball several libsystemd pseudo-code and real code examples.

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
…f a call() failed, and auto-close it on exit [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
…uce Uninhibit() and isPreparingForSleep() methods [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
…etworkupstools#1070]

This commit adds support to process the systemd (later potentially equivalent)
framework signals about going to sleep or waking up, to grab and release the
locks which can hold up the actual start of sleep mode. Later work would focus
on not shutting down because of the time jump when we wake up :)

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
…and stress that older hacks for the purpose may be obsolete now [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
@jimklimov
Copy link
Member

@Callisos : Cheers, FWIW, a PR with implementation attempt is posted, practical testing would be welcome :)

jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
…ith_description() for better journal logging [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 21, 2024
…setting clocks on UPS readings [networkupstools#1070]

Also make sure it is treated as a reload and not initial load!

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 21, 2024
…her isInhibitSupported/isPreparingForSleepSupported [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 21, 2024
…eepSupported to avoid needless decisions and logs on some deployments [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 21, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 21, 2024
…ging, add notes that we mark methods unsupported at run-time [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 21, 2024
…tion, report also if we can monitor changes of sleep/wake state [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 21, 2024
…e a value from an aborted older loop cycle, make sure it is up to date now just before we handle it [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 21, 2024
…too long [networkupstools#1070]

Treat *any* clock jump same as OS sleep (act to avoid stale UPS info),
even if it was not a suspend/hibernate event but e.g. summer/winter
time change or just upsmon suspended by a debugger or blocked stdio.

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 21, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 22, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Aug 22, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Dec 5, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Dec 5, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Dec 5, 2024
…tor_status also if exit_flag gets raised (e.g. Ctrl+C during the wait) [networkupstools#1070]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Dec 5, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Dec 5, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Dec 5, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Dec 6, 2024
…ID that originally opened it [networkupstools#1070]"

This reverts commit a6496a6:
close from a child process does not seem to impact parent,
but a non-close is a memory leak when such child exits.
jimklimov added a commit to jimklimov/nut that referenced this issue Dec 6, 2024
…ID that originally opened it [networkupstools#1070]"

This reverts commit a6496a6:
close from a child process does not seem to impact parent,
but a non-close is a memory leak when such child exits.

Signed-off-by: Jim Klimov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug systemd
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants