Bug 88284

Summary: Setting ShutdownWatchdogUSec via D-Bus does nothing
Product: systemd Reporter: Maxim Mikityanskiy <maxtram95>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: maxtram95
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Make org.freedesktop.systemd1.Manager.ShutdownWatchdogUSec work
Make org.freedesktop.systemd1.Manager.ShutdownWatchdogUSec work [2]

Description Maxim Mikityanskiy 2015-01-11 00:43:18 UTC
Created attachment 112081 [details]
Make org.freedesktop.systemd1.Manager.ShutdownWatchdogUSec work

org.freedesktop.systemd1.Manager has a property ShutdownWatchdogUSec. I can change it using the following command:

busctl --system set-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager ShutdownWatchdogUSec t 0

But it seems that this change has no effect, and systemd still uses old value which is read from /etc/systemd/system.conf at startup.

I looked at sources: http://cgit.freedesktop.org/systemd/systemd/tree/src/core/main.c?id=1325ec4280dd3f00f4879c5feadd524f7ba52f7e#n2014

I see that systemd uses arg_shutdown_watchdog value (the one assigned from config file) instead of m->shutdown_watchdog (the one that user could change by D-Bus calls). Really, we can't use m->shutdown_watchdog at that point, because m is freed on line 1827, but we could assign arg_shutdown_watchdog = m->shutdown_watchdog right before manager_free(m).

I suggest attached patch to fix this issue.
Comment 1 Lennart Poettering 2015-01-29 00:41:55 UTC
Patch looks good! Thanks! Applied!

http://cgit.freedesktop.org/systemd/systemd/commit/?id=df6e44c4affced590b0d19c594d9301ffd436591
Comment 2 Kay Sievers 2015-01-30 10:06:33 UTC
Reverted the patch. It causes systemd --version to segfault.
Please fix it and resubmit. Thanks!
Comment 3 Maxim Mikityanskiy 2015-01-30 10:52:39 UTC
Created attachment 112970 [details] [review]
Make org.freedesktop.systemd1.Manager.ShutdownWatchdogUSec work [2]
Comment 4 Maxim Mikityanskiy 2015-01-30 10:53:46 UTC
(In reply to Kay Sievers from comment #2)
> Reverted the patch. It causes systemd --version to segfault.
> Please fix it and resubmit. Thanks!

Sorry about that, I overlooked that m may be NULL. There is a new patch that assigns arg_shutdown_watchdog only if m is not NULL. In the case m == NULL (e.g. when calling systemd --version) we don't need arg_shutdown_watchdog anyway, we only need it on shutdown when m is definitely not NULL.
Comment 5 Zbigniew Jedrzejewski-Szmek 2015-01-30 23:51:19 UTC
(Re-)applied in http://cgit.freedesktop.org/systemd/systemd/commit/?id=81f5fc2d43.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.