Roger Price
2013-Aug-10 21:43 UTC
[Nut-upsuser] NUT on openSUSE 12.3 requires additional systemd service unit
OpenSUSE 12.3 has fully embraced systemd, but to get NUT working correctly now requires some further systemd engineering in addition to the usual NUT configuration files. A new systemd service unit is needed to power off the UPS. The service unit consists of a new file /etc/systemd/system/ups-delayed-shutdown.service [Unit] Description=Initiate delayed UPS shutdown Before=umount.target DefaultDependencies=no [Service] Type=oneshot ExecStart=/usr/lib/ups/driver/upsdrvctl shutdown [Install] WantedBy=poweroff.target This service unit should be enabled with root command systemctl --system reenable /etc/systemd/system/ups-delayed-shutdown.service I have tested this setup with 64 bit openSUSE 12.3 and NUT 2.6.5 using an Eaton Ellipse ASR 1500 USBS. 9 seconds after server poweroff, the UPS powers off. When wall power returns the server restarts correctly. Roger
Charles Lepple
2013-Aug-10 22:05 UTC
[Nut-upsuser] NUT on openSUSE 12.3 requires additional systemd service unit
On Aug 10, 2013, at 5:43 PM, Roger Price wrote:> OpenSUSE 12.3 has fully embraced systemd, but to get NUT working correctly now requires some further systemd engineering in addition to the usual NUT configuration files. A new systemd service unit is needed to power off the UPS. > > The service unit consists of a new file /etc/systemd/system/ups-delayed-shutdown.service > > [Unit] > Description=Initiate delayed UPS shutdown > Before=umount.target > DefaultDependencies=no > > [Service] > Type=oneshot > ExecStart=/usr/lib/ups/driver/upsdrvctl shutdown > > [Install] > WantedBy=poweroff.target > > This service unit should be enabled with root command > > systemctl --system reenable /etc/systemd/system/ups-delayed-shutdown.service > > I have tested this setup with 64 bit openSUSE 12.3 and NUT 2.6.5 using an Eaton Ellipse ASR 1500 USBS. 9 seconds after server poweroff, the UPS powers off. When wall power returns the server restarts correctly.I still haven't messed with systemd yet, so I am in over my head here. Is this similar to what Kjell posted about? Or is it in addition to that? http://www.kepstin.ca/blog/networkupstoolsnutandsystemd/ -- Charles Lepple clepple at gmail
Roger Price
2013-Aug-11 09:19 UTC
[Nut-upsuser] NUT on openSUSE 12.3 requires additional systemd service unit
On Sat, 10 Aug 2013, Charles Lepple wrote:> I still haven't messed with systemd yet, so I am in over my head here. > Is this similar to what Kjell posted about? Or is it in addition to > that? http://www.kepstin.ca/blog/networkupstoolsnutandsystemd/Calvin Walton (kepstin) discusses a complete management of all the NUT processes using systemd and in doing so fixes a timing conflict in the minimalist systemd support provided by Fedora; whereas my post addresses the much narrower "bug fix" question of getting NUT to work on just one version of openSUSE. I do not address the question of full systemd management of NUT processes. systemd is gaining ground in the Linux world [See http://en.wikipedia.org/wiki/Systemd "Adoption"] and looks as if it is here to stay. The Linux distributions will slowly, one by one, get around to probably minimalist systemd support for NUT. But the BSD world has not accepted systemd, and this poses a problem for the management of projects such as NUT which cater for Unix as well as Linux. [http://lwn.net/Articles/452865/ "Debian debates systemd"] It seems to me that although there is no immediate urgency, some experimentation might be helpful in forming a clearer view of what is needed for NUT. Roger
Michal Hlavinka
2013-Aug-14 14:05 UTC
[Nut-upsuser] NUT on openSUSE 12.3 requires additional systemd service unit
On 08/10/2013 11:43 PM, Roger Price wrote:> OpenSUSE 12.3 has fully embraced systemd, but to get NUT working > correctly now requires some further systemd engineering in addition to > the usual NUT configuration files. A new systemd service unit is needed > to power off the UPS. > > The service unit consists of a new file > /etc/systemd/system/ups-delayed-shutdown.service > > [Unit] > Description=Initiate delayed UPS shutdown > Before=umount.target > DefaultDependencies=no > > [Service] > Type=oneshot > ExecStart=/usr/lib/ups/driver/upsdrvctl shutdown > > [Install] > WantedBy=poweroff.target > > This service unit should be enabled with root command > > systemctl --system reenable > /etc/systemd/system/ups-delayed-shutdown.service > > I have tested this setup with 64 bit openSUSE 12.3 and NUT 2.6.5 using > an Eaton Ellipse ASR 1500 USBS. 9 seconds after server poweroff, the > UPS powers off. When wall power returns the server restarts correctly.What exactly is this supposed to do? When system is shutting down because of power failure (and low battery) ups should be powered off with /lib/systemd/system-shutdown/nutshutdown script. That's also the correct location for ups shutdown script. It's executed after everything else. Using Before=umount.target is especially bad bad idea. It's not guaranteed that umount sync can finish in time, so you can have power down during filesystem sync with all the consequences. Michal
Roger Price
2013-Aug-15 20:02 UTC
[Nut-upsuser] NUT on openSUSE 12.3 requires additional systemd service unit
On Wed, 14 Aug 2013, Michal Hlavinka wrote:>> The service unit consists of a new file >> /etc/systemd/system/ups-delayed-shutdown.service > > What exactly is this supposed to do?The proposed service unit fixes an openSUSE 12.3 problem, in which the UPS is not powered off on system shutdown.> When system is shutting down because of power failure (and low battery) > ups should be powered off with /lib/systemd/system-shutdown/nutshutdown > script.In openSUSE 12.3 there is no directory /lib/systemd/system-shutdown, and no script "nutshutdown". I am guessing that you use Fedora.> That's also the correct location for ups shutdown script.My original script was in /lib/systemd and I was told in the systemd-devel mailing list that home-brew scripts such as mine should not be placed there, but in /etc/systemd/system.> It's executed after everything else. Using Before=umount.target is > especially bad bad idea. It's not guaranteed that umount sync can finish > in time,Perhaps I misunderstand your comment, but I'm not worried about umount.target running late. That's not a problem. Finishing early would be a problem, but that's what the "Before" and the "Type=oneshot" is intended to handle. Quote from man systemd.service: Behavior of oneshot is similar to simple, however it is expected that the process has to exit before systemd starts follow-up units. By the way, "Before=umount.target" didn't seem to shock the systemd guys.> so you can have power down during filesystem sync with all the > consequences.Agreed - systemd executes my openSUSE ups-delayed-shutdown.service at the very beginning of the shutdown sequence, and there is a very real possibility of the UPS shutdown with its default 20 sec delay occuring before the system shutdown. That is why I have the options offdelay = 30 ondelay = 40 in file /etc/ups/ups.conf. Roger
Possibly Parallel Threads
- NUT on openSUSE 12.3 requires additional systemd service unit
- NUT on openSUSE 12.3 requires additional systemd service unit
- NUT on openSUSE 12.3 requires additional systemd service unit
- NUT on openSUSE 12.3 requires additional systemd service unit
- Fw: [Nut-upsdev] POWERCOM-UPS-USB : UPS Shutdown