-
-
Notifications
You must be signed in to change notification settings - Fork 361
Building NUT on FreeBSD
Im not sure if this is the perfect way to compile NUT on FreeBSD, but this one worked for me! To compile NUT on FreeBSD without changes, just do:
cd /usr/ports/sysutils/nut/ && make install
Otherwise if you need to modify the sourcecode, follow step 3 to 8.
Based on Issue #736 and #737 i had to recompile the apcupsd-usb driver for FreeBSD/FreeNAS 11.1 .
- Download FreeBSD 11.1 iso (the right equivalent to FreeNAS 11.1)
- Install it in VirtualBox/VMWare or some other virtualization software. --- check if the network mode is bridge.
- Boot VM and enable ssh as root:
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config /etc/rc.d/sshd restart
- login with ssh into the VM to make the next steps easier: (
ifconfig
or similar to get the IPv4 of the VM )
ssh root@192.168.0.50 <--- REPLACE IP WITH YOUR VM IP
- jump into the nut folder provided by FreeBSD and compile it once. This will download the sources and all the dependencies it needs. This will take some time ....
cd /usr/ports/sysutils/nut/ && make
- Modify the sourcecode if needed: In my case i modiefied a driver.
cd /usr/ports/sysutils/nut/work/nut-2.7.4/drivers/ nano apcupsd-ups.h
replace
{ "MBATTCHG", "battery.charge.low", ST_FLAG_RW, 1, "%.0f", DU_FLAG_NONE, NULL },
with
{ "MBATTCHG", "battery.charge.low", ST_FLAG_RW, 1, "%.0f", DU_FLAG_INIT, NULL },
7.a) recompile the drivers:
cd /usr/ports/sysutils/nut/work/nut-2.7.4/drivers/ && make
7.b) or if you modified not only the drivers:
cd /usr/ports/sysutils/nut/work/nut-2.7.4/ && make
8.a) now you will find the new apcupsd-ups
in
/usr/ports/sysutils/nut/work/nut-2.7.4/drivers/
8.b) the modiefied compiled files should be in /usr/ports/sysutils/nut/work/nut-2.7.4/
with the sourcode.
to install it into the right place just type
make install
-
Copy the compiled from the VM via SSH FTP or whatever to your FreeNas instance in my case this was only the
/usr/local/libexec/nut/apcupsd-ups
driver. -
set permissions and restart nut
chmod 0555 apcupsd-ups service nut restart
Done!
Welcome to the Network UPS Tools (NUT) project Wiki, and feel free to contribute tricks and insights.
While there are several good entries in the menu, ones referenced most frequently in issue discussions include:
- Building NUT for in-place upgrades or non-disruptive tests and Using NIT (NUT Integration Test suite) sandbox
- Technicalities: Customizing (NUT) config files and scripts delivered by packaging
- Links to distribution packaging recipes and repository sections
- Troubleshooting
upsdrvctl
drivers not starting ("insufficient permissions on everything" or "Can't claim USB device [VVVV:PPPP]@0/0: Entity not found") possibly due to nut-driver-enumerator (NDE) services having been there before you with NUT 2.8.x, and "insufficient permissions" when starting USB drivers for a different PoV on this; see also an example unit deployment detailed in NUT systemd service units page - Changing NUT daemon debug verbosity
- Building NUT integration for Home Assistant
- Running NUT in an LXC container
- Troubleshooting eventual disconnections (Data stale) and CyberPower Systems (CPS) know-how
- NUT for Windows
- NUT HCL and DDL
- Code contributions, PRs, PGP and DCO
- NUT CI farm
Also keep in mind the documentation links from NUT website and the FAQ in particular.