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

Windows build is obsolete #1050

Open
LinoBarreca opened this issue Jun 22, 2021 · 10 comments
Open

Windows build is obsolete #1050

LinoBarreca opened this issue Jun 22, 2021 · 10 comments

Comments

@LinoBarreca
Copy link

...and there are no build instructions for windows.
The software works (with the openssl libraries manually copied in the right place) but it lacks the features/fixes of the newer source code.
Any plan to update them or give proper instructions on how to build under windows?

@jimklimov
Copy link
Member

The plan is quite latent and currently lower in priority than many other things to rectify first, for the available team members, sadly... (that said, help and PRs would be welcome!)

There are numerous issues to be found in github history and perhaps some more in mailing lists, but the gist of it is that latest Windows builds were done as a branch from 2.6.5 baseline, and later main-branch releases diverged significantly so that getting a Windows build ability on top of current code would be a new effort at best inspired by comparisons of those branches vs. main-line 2.6.5 release.

I suppose compilers, headers and third-party deps available in Windows have marched on significantly as well. Notably, if the new effort were to concentrate on recent Windows releases and require WSL2 or at least shell tools usable for configure/make logic, it might be easier than a fully-native build with older Windows versions.

@opoplawski
Copy link

It would be really nice to have a windows port of NUT.

@jimklimov
Copy link
Member

jimklimov commented Dec 3, 2021 via email

@kramttocs
Copy link

Agreed this would also be great. I can't get it working on my machine and not many docs out there for troubleshooting.

@jimklimov

This comment was marked as duplicate.

@mrfrenzy
Copy link

mrfrenzy commented Aug 9, 2022

There are a few quirks due to changes done in Windows over the years.

Here is a short writeup how to get NUT-Installer-2.6.5-6 properly working on Windows 11 64-bit:
Make sure the service is stopped
Copy libgcc_s_dw2-1.dll from bin to sbin
Download libeay32.dll and ssleay32.dll to sbin (https://github.com/openssl-net/openssl-net/tree/master/native/windows/x86)
Download ShutdownWithupdates.exe to sbin (https://github.com/dennisbabkin/ShutdownWithUpdates) - this is needed because builtin shutdown.exe installs updates before shutdown which can be catastrophic.

nut.conf
MODE=standalone

ups.conf
set the proper driver here for "myups"
Test it in an admin command line:
cd "\Program Files (x86)\NUT\bin"
genericups.exe -DDD -a myups (for example depending on what driver you choose)
(leave this running)

upsd.users
[upsmon]
password = pass (please change to a good password)
upsmon master

upsd.conf
LISTEN 127.0.0.1 3493 (ipv6 runs out of memory)
Open a new admin prompt and run:
cd "\Program Files (x86)\NUT\sbin"
upsd -DD (you should see connected to UPS and status OL/OB etc)
(leave this running)

upsmon.conf
MONITOR [email protected] 1 upsmon pass master (not localhost)
"c:\Program Files (x86)\NUT\sbin\ShutdownWithUpdates.exe" /s /nu /t 30 (regular shutdown.exe installs updates before shutdown)
NOTIFYCMD "C:\WINDOWS\Sysnative\msg.exe *" (system32 does not work since msg.exe is actually 64-bit)

Change all NOTIFY to EXEC for example:
NOTIFYFLAG ONLINE SYSLOG+EXEC

Open a new admin prompt and run:
cd "\Program Files (x86)\NUT\sbin"
upsmon -D (you should see logged into UPS)

Now test to disconnect line power, you should see messages in all windows and a popup, and after low bat the computer should shut down)

Close all windows and start the service, check event viewer - applications
Test disconnecting power

@jimklimov
Copy link
Member

jimklimov commented Aug 12, 2022

See also #5 that coordinates (sort of) the effort to modernize NUT for Windows support. Might try a build of that branch. Packages not pursued yet, caveats / incomplete code are known (many listed in Project https://github.com/orgs/networkupstools/projects/2/views/1 made just for tracking all that)

See also #455 and #534 for discussion of similar issues (and some solutions)

@jimklimov
Copy link
Member

FYI: To experiment with recent NUT codebase built (not packaged or otherwise integrated so far) for Windows you can try archives from https://ci.appveyor.com/project/nut-travis/nut/build/artifacts

@cableghost
Copy link

There are a few quirks due to changes done in Windows over the years.

I could use some help in following this...

  1. Starting w/ nut.conf.. I'm not understanding where to make the changes?
  2. Is there a means of setting the shutdown process to 'Hibernate' instead?
  3. What if I only want the NUT server to provide access for my Home Assistant to view my UPS as a client, not to actually handle the shutting down process?

@jimklimov
Copy link
Member

jimklimov commented Nov 27, 2023

At the moment I can only elaborate on point (3) generally, as I haven't had practical experience with NUT 2.6.5 based MSI's and what the programs there can do.

Normally NUT has 3 layers - one or more drivers running on a system, a data server (upsd) which represents them all via network protocol, and local or remote clients. One of such clients is upsmon that can handle shutdowns, alerts, etc. Generally any client greater than the read-only upsc needs server-side preparations (see docs on upsd.users config file to set up monitoring users or admins to run commands and set firmware variables).

The setup you seem to describe involves a driver and data server running on Windows (and maybe an upsmon watching for shutdowns of that Windows box, if it is fed by the UPS it monitors), and a separate Home Assistant with which you want to just watch the UPS state but not shut down HA.

So on the Windows side, prepare the driver in ups.conf, and data server via upsd.user as well as LISTEN * (or specific IP) in upsd.conf, and probably allow access to 3493/tcp on your LAN.

On HA side, if it runs NUT upsmon - in its config set MONITOR line for that ups@server as a secondary which feeds 0 PSUs (of the HA box). If it has some other client (graphs etc) - depends on such client; probably it is readonly and needs no logins, like upsc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

6 participants