You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Libraries not found (Ubuntu 24.04 Server arm) #2431
Hi all... just tried to install nut on fresh install Ubuntu 24 LTS on raspberry pi, installed fine but running sudo nut-scanner -C results in following:
Cannot load USB library (libusb-1.0.so) : file not found. USB search disabled.
Cannot load SNMP library (libnetsnmp.so) : file not found. SNMP search disabled.
Cannot load XML library (libneon.so) : file not found. XML search disabled.
Cannot load AVAHI library (libavahi-client.so) : file not found. AVAHI search disabled.
Cannot load IPMI library (libfreeipmi.so) : file not found. IPMI search disabled.
Cannot load NUT library (libupsclient.so) : file not found. NUT search disabled.
I switched to Ubuntu because the package in it is closer to current than RPI OS, and I need the tools to connect to identical UPS on one device. I've confirmed libusb-1.0 is installed, but for some reason nut can't find it, do I need to create extra symlinks or something like that?
There would be a huge wall of text about directories it looks into and file names it sees and tries to match there.
I wonder if your system delivers e.g. libusb-1.0.so.1.27.0 and no symlink like libusb-1.0.so which could be in another package.
For context: most of NUT deliverables can be split into packages based on dependencies (e.g. snmp, ipmi, usb etc. drivers) or purpose (client, cgi, ...) However the nut-scanner tool can optionally talk all protocols it can discover, and with usual shared object linking approach it would require all those libraries installed - even if the particular user never needs them (only got USB and has no care and footprint to spare for SNMP or IPMI libs). Instead, shared objects (libraries) are loaded dynamically by the program itself at its discretion - or skipped if the load failed, such as in this case. Why specifically it failed is the root cause to discover here.
Sorry, have been on holidays, looping back to this now. I'm not great with Linux/packages/github, I installed using apt which I believe should be version 2.8.1-3.1ubuntu2.
Have run with higher debug verbosity, the following seem to be the most pertinent lines:
0.001188 [D1] Built-in: /usr/lib/gcc/aarch64-unknown-linux-gnu
0.001239 [D2] Looking for lib libusb-1.0.so in directory #0 : /usr/lib/aarch64-linux-gnu
-- snip --
0.012290 [D5] Comparing lib libusb-1.0.so with dirpath entry libusb-1.0.so.0
0.012298 [D5] Comparing lib libusb-1.0.so with dirpath entry libusb-1.0.so.0.4.0
-- snip --
0.014574 [D1] Looking for lib libusb-1.0.so, found NULL
-- snip --
0.026829 [D1] nutscan_init: get_libname() did not resolve libname for LibUSB, trying to load it with libtool default resolver
Cannot load USB library (libusb-1.0.so) : file not found. USB search disabled.
Am I right in thinking that creating a symlink 'libusb-1.0.so' that points to 'libusb-1.0.so.0' in the same directory should resolve the issue in this case?
Yes, I wonder why one was not created in the first place (maybe devel packages deliver such a link, or some distro conventions had changed?) :\
At least, not directly a NUT problem, or not sure quickly how to address such distro specifics in common codebase, short of adding a nut-scanner config file/options about such paths.
Wondering how nobody stumbled on that before. Did everyone have a larger system footprint installed (e.g. did other packagings of NUT depend on *-dev packages of other stuff)?..
At least, this does seem like something NUT codebase can address - beside the idea above for direct run-time modifiable configuration of file names/paths to use, it may be possible to add the name(s) of the library seen at configuration/build time (e.g. libusb-1.0.so.0 or resolved through all the symlinks to "real file" at libusb-1.0.so.0.3.0) to the built-in search list.
I would be wary of just allowing random suffixes to be accepted in the search method; to that end, get_libname_in_dir() explicitly has checks to avoid "*.dll.a", ".so.1.2.3" etc. and only pick the specified file name exactly (notably, not all such names can even be shared objects that we would be able to dynamically load). Although that is still a clumsy option... "If we found nothing exactly, try again with random suffixes allowed and check by dlload()" but that IMHO is an attack waiting to happen :)
A practical search on a test system does use realpath() (where available) and practically use the ultimate file name when it looks at a symlink (which does exist):
0.002097 [D5] Comparing lib libusb-1.0.so with dirpath entry libusb-1.0.so
0.002108 [D2] Candidate path for lib libusb-1.0.so is /usr/lib/x86_64-linux-gnu/libusb-1.0.so (realpath /usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0)
0.002119 [D1] Looking for lib libusb-1.0.so, found /usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0
0.002121 [D1] nutscan_init: get_libname() resolved '/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0' for LibUSB, loading it
0.002324 [D1] nutscan_init: succeeded to load the library for LibUSB
Looking at code, I see that for each library of interest, nut-scanner tries one or more patterns via get_libname() and if any of those fails to find an exact filename match in searched directories, it falls back to the likes of nutscan_load_usb_library() (half a dozen of those for different libs) which would try to lt_dlopen() the specified pattern(s) in hopes that the OS resolver would take care of locating the library in some location unexpected by NUT (and maybe under a slightly different name - up to the OS not NUT at this point). This is the part seen in your log too, as:
0.026829 [D1] nutscan_init: get_libname() did not resolve libname for LibUSB, trying to load it with libtool default resolver
Running some experiments with another lib that is easier to fiddle with (NUT only built in this system, not installed into common paths, so its own libupsclient is not resolved via OS paths):
...
Error loading Neon library required for DMF: libneon.so not found by dynamic loader; please verify it is in your /usr/lib or some otherwise searched dynamic-library path, under this exact name (maybe you just need a symlink?)
Error loading Neon library required for DMF: libneon-gnutls.so not found by dynamic loader; please verify it is in your /usr/lib or some otherwise searched dynamic-library path, under this exact name (maybe you just need a symlink?)
=== DMF-Test: Error parsing data: -1
@jimklimov : i just did a checkout from git and ran:
./autogen.sh
./configure --with-user=nut --with-group=nut
make install-as-root
during the configure i see
checking for real path to -lusb-1.0 (re-parsed as libusb-1.0.so likely file name / -lusb-1.0 linker arg)... initially '/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libusb-1.0.so'
checking for "real path" of '/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libusb-1.0.so'... '/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0' (differs from input)
/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0
nut-scanner shows me this:
XXX@YYYY:/tmp/nut# tools/nut-scanner/nut-scanner -U
Network UPS Tools nut-scanner 2.8.3.464-464+g2dce981ef (development iteration after 2.8.3)
NUT utility for detection of available power devices.
OPTIONS:
-C, --complete_scan: Scan all available devices except serial ports (default).
* Options for USB devices scan not enabled: library not detected.
* Options for SNMP devices scan not enabled: library not detected.
* Options for XML/HTTP devices scan not enabled: library not detected.
-O, --oldnut_scan: Scan NUT devices (old method via libupsclient).
* Options for NUT devices (new avahi method) scan not enabled: library not detected.
-n, --nut_simulation_scan: Scan for NUT simulated devices (.dev files in $CONFPATH).
* Options for IPMI devices scan not enabled: library not detected.
-E, --eaton_serial <serial ports list>: Scan serial Eaton devices (XCP, SHUT and Q1).
-T, --thread <max number of threads>: Limit the amount of scanning threads running simultaneously (default: 512).
...
The symbolic links did not fix it for my installation.
note:
I'm new to nut and trying to get it to work on my proxmox instance with a new UPS that requires 2.8.3
@x-MrFloppy-x : What do other lines near the libusb detection say? Does the final report of configure script confirm it would use libusb? e.g. * build USB drivers: yes (libusb-1.0)?
And just in case, what does/did ls -la /usr/lib/x86_64-linux-gnu/libusb-1.0.so* show - just the /usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0 file and no symlinks (*.so, *.so.0)?
In the help text it should report the library search paths it would explicitly look into, e.g.
Note: many scanning options depend on further loadable libraries.
Run-time loadable library search paths used by this build of NUT:
Via LD_LIBRARY_PATH: /usr/src/nut-pve/tools/nut-scanner/.libs
NOTE: Reporting filtered (existing unique) built-in paths:
Built-in: /usr/local/ups/lib
Built-in: /usr/lib/x86_64-linux-gnu
Built-in: /usr/lib64
Built-in: /usr/lib
Built-in: /usr/local/lib
Built-in: /usr/lib/gcc/x86_64-linux-gnu
@jimklimov :
you are right i missed the last occurence in the configure output: * build USB drivers: yes (libusb-1.0)
XXX@YYYY:/tmp/nut# cat configure.log |grep usb
checking for libusb-1.0 version via pkg-config... 1.0.26 found
checking for libusb(-0.1) version via pkg-config... none found
checking for libusb-config... no
checking for libusb preferred version... 1.0.26 (libusb-1.0)
checking for libusb cflags... -I/usr/include/libusb-1.0
checking for libusb ldflags... -lusb-1.0
checking for libusb.h... yes
checking for libusb_init... yes
checking for libusb_strerror... yes
checking for libusb_kernel_driver_active... yes
checking for libusb_set_auto_detach_kernel_driver... yes
checking for libusb_detach_kernel_driver... yes
checking for libusb_detach_kernel_driver_np... no
checking for usb_detach_kernel_driver_np... no
checking for libusb_get_port_number... yes
checking for real path to -lusb-1.0 (re-parsed as libusb-1.0.so likely file name / -lusb-1.0 linker arg)... initially '/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libusb-1.0.so'
checking for "real path" of '/usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libusb-1.0.so'... '/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0' (differs from input)
/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0
checking whether to build USB drivers... yes (libusb-1.0)
checking whether to generate scripts/udev/nut-usbups.rules... yes
checking whether to generate scripts/devd/nut-usb.conf... yes
config.status: creating scripts/udev/nut-usbups.rules
config.status: creating scripts/devd/nut-usb.conf
* build USB drivers: yes (libusb-1.0)
From your comment i understood that it should find, and actualy does find, the librarys in /usr/lib/x86_64-linux-gnu/
but i'm also puzzled why the nut-scanner reports * Options for USB devices scan not enabled: library not detected..
So as i'm running proxmox on intel i might not be related to this issue here.
If you run nut-scanner with high debug verbosity it would print many screenfuls of information about the search for libraries before it does anything else (scan, show help, etc.)
You can try e.g. nut-scanner -DDDDDD -U 2>&1 | less to keep those messages in the standard viewer, where it would be easier for you to search for mentions of libusb. It is possible it looked at valid candidates and discarded them for some reason (would say why), or did not look into the correct directory, etc.
Proxmox should not be the problem, I have NUT running on PVE 7 and 8 - it is just Debian (or similar) as far as programs and packaging in the host-OS are concerned.
Thanks @jimklimov, that pointet me into the right direction, although not sure if this is expected behavior on pve.
TLDR: an "apt install libusb-1.0-0-dev" solved my problems and i was able to build it and see my USB UPS with nut-scanner.
My Error:
I did fidle around a bit to much yesterday and it was obviously way beyond my bedtime ;-).
I must have missed to make install-as-root after i saw the * build USB drivers: yes (libusb-1.0) output in the configure.
discovered behavior on which i'm unsure if i should expected it:
with the libusb-1.0-0-dev removed from the system i do get the following during the configure:
XXX@YYYY:/tmp/nut# cat configure.log |grep libusb
checking for libusb-1.0 version via pkg-config... none found
checking for libusb(-0.1) version via pkg-config... none found
checking for libusb-config... no
checking for libusb preferred version... none
checking for libusb cflags...
checking for libusb ldflags... -lusb
so aperently i got the same behavior as this post above: (#2431 (comment))
With absent *-dev packages this is expected - they deliver the pkg-config metadata files and/or equivalent legacy modulename-config scripts, and headers, and shorter symlinks. While we try to not rely on the latter (since relatively recent fixes for this issue), we can't build without at least headers (the rest can be passed in other configure options).
However your later post indicates pkg-config data for libusb-1.0 and headers were seen. Or was this after you installed *-dev?
Adding a related comment in case it helps someone in the future.
Just tried installing nut on a Raspberry Pi 3B with the bone stock Raspberry Pi OS Lite, 64-bit trixie, 2025-10-01 build. The current nut packge for this is 2.8.1-5. Was able to see my USB attached UPS just fine but didn't like I was getting the following errors with nut-scanner:
Cannot load SNMP library (libnetsnmp.so.40) : file not found. SNMP search disabled.
Cannot load XML library (libneon.so.27) : file not found. XML search disabled.
Cannot load AVAHI library (libavahi-client.so.3) : file not found. AVAHI search disabled.
Cannot load IPMI library (libfreeipmi.so.17) : file not found. IPMI search disabled.
Yeah, I could just use nut-scanner -U since my devices are all USB based but I still wanted to understand this. Following on clues from the thread I installed the related dev libraries:
This now allows the run of nut-scanner to execute without errors. So while I didn't have to do this for my setup (at least not at this time) I think having this answer here can still be useful to the community depending on what keywords a user is searching for. I guess once the Raspberry Pi OS packages get updated to nut 2.8.3 or higher this will all be moot.
Thanks for the heads-up. Technically, nut-scanner is built this way to not depend on packages with those libraries so the required installation footprint is smaller, and the needed profile depends on the use-case (so drivers using those libs would be programs that require them; if you don't have say an SNMP UPS and so no need for that driver, you don't have to pull in the library to scan for your serial or USB UPS).
Activity
jimklimov commentedon May 3, 2024
Please retry with higher debug verbosity, e.g.:
There would be a huge wall of text about directories it looks into and file names it sees and tries to match there.
I wonder if your system delivers e.g.
libusb-1.0.so.1.27.0and no symlink likelibusb-1.0.sowhich could be in another package.For context: most of NUT deliverables can be split into packages based on dependencies (e.g. snmp, ipmi, usb etc. drivers) or purpose (client, cgi, ...) However the
nut-scannertool can optionally talk all protocols it can discover, and with usual shared object linking approach it would require all those libraries installed - even if the particular user never needs them (only got USB and has no care and footprint to spare for SNMP or IPMI libs). Instead, shared objects (libraries) are loaded dynamically by the program itself at its discretion - or skipped if the load failed, such as in this case. Why specifically it failed is the root cause to discover here.jimklimov commentedon May 3, 2024
Also, just in case: how did you install NUT (packages? custom build?) and which version?
danmrossi commentedon May 7, 2024
Must be the OS that NUT was compiled on, I’ve just compiled and installed on Ubuntu 24.04 no issues.
sccfit commentedon May 17, 2024
Sorry, have been on holidays, looping back to this now. I'm not great with Linux/packages/github, I installed using apt which I believe should be version 2.8.1-3.1ubuntu2.
Have run with higher debug verbosity, the following seem to be the most pertinent lines:
Am I right in thinking that creating a symlink 'libusb-1.0.so' that points to 'libusb-1.0.so.0' in the same directory should resolve the issue in this case?
jimklimov commentedon May 17, 2024
Yes, I wonder why one was not created in the first place (maybe devel packages deliver such a link, or some distro conventions had changed?) :\
At least, not directly a NUT problem, or not sure quickly how to address such distro specifics in common codebase, short of adding a
nut-scannerconfig file/options about such paths.jimklimov commentedon May 17, 2024
Hm, yeah, the name without trailing numbers seems to come from development packages:
Wondering how nobody stumbled on that before. Did everyone have a larger system footprint installed (e.g. did other packagings of NUT depend on *-dev packages of other stuff)?..
At least, this does seem like something NUT codebase can address - beside the idea above for direct run-time modifiable configuration of file names/paths to use, it may be possible to add the name(s) of the library seen at configuration/build time (e.g.
libusb-1.0.so.0or resolved through all the symlinks to "real file" atlibusb-1.0.so.0.3.0) to the built-in search list.I would be wary of just allowing random suffixes to be accepted in the search method; to that end,
get_libname_in_dir()explicitly has checks toavoid "*.dll.a", ".so.1.2.3" etc.and only pick the specified file name exactly (notably, not all such names can even be shared objects that we would be able to dynamically load). Although that is still a clumsy option... "If we found nothing exactly, try again with random suffixes allowed and check bydlload()" but that IMHO is an attack waiting to happen :)jimklimov commentedon May 17, 2024
A practical search on a test system does use
realpath()(where available) and practically use the ultimate file name when it looks at a symlink (which does exist):Looking at code, I see that for each library of interest,
nut-scannertries one or more patterns viaget_libname()and if any of those fails to find an exact filename match in searched directories, it falls back to the likes ofnutscan_load_usb_library()(half a dozen of those for different libs) which would try tolt_dlopen()the specified pattern(s) in hopes that the OS resolver would take care of locating the library in some location unexpected by NUT (and maybe under a slightly different name - up to the OS not NUT at this point). This is the part seen in your log too, as:jimklimov commentedon May 17, 2024
Running some experiments with another lib that is easier to fiddle with (NUT only built in this system, not installed into common paths, so its own
libupsclientis not resolved via OS paths):With the local build in the library path, it is seen:
Removing the
.sosymlink out of the way:So it even recognizes that file, just not as a "strong" candidate.
jimklimov commentedon Jun 15, 2024
As a side note, this may also be a concern for DMF effort (currently awaiting its destiny in another branch):
60 remaining items
hanwin commentedon Jun 14, 2025
This solved the problem for me
x-MrFloppy-x commentedon Jun 18, 2025
@jimklimov : i just did a checkout from git and ran:
during the configure i see
nut-scanner shows me this:
The symbolic links did not fix it for my installation.
note:
I'm new to nut and trying to get it to work on my proxmox instance with a new UPS that requires 2.8.3
jimklimov commentedon Jun 19, 2025
@x-MrFloppy-x : What do other lines near the libusb detection say? Does the final report of
configurescript confirm it would use libusb? e.g.* build USB drivers: yes (libusb-1.0)?And just in case, what does/did
ls -la /usr/lib/x86_64-linux-gnu/libusb-1.0.so*show - just the/usr/lib/x86_64-linux-gnu/libusb-1.0.so.0.3.0file and no symlinks (*.so,*.so.0)?In the help text it should report the library search paths it would explicitly look into, e.g.
Does yours include
/usr/lib/x86_64-linux-gnu?x-MrFloppy-x commentedon Jun 19, 2025
@jimklimov :
you are right i missed the last occurence in the configure output:
* build USB drivers: yes (libusb-1.0)my /usr/lib/x86_64-linux-gnu/ looks like this:
From your comment i understood that it should find, and actualy does find, the librarys in
/usr/lib/x86_64-linux-gnu/but i'm also puzzled why the nut-scanner reports
* Options for USB devices scan not enabled: library not detected..So as i'm running proxmox on intel i might not be related to this issue here.
jimklimov commentedon Jun 19, 2025
If you run
nut-scannerwith high debug verbosity it would print many screenfuls of information about the search for libraries before it does anything else (scan, show help, etc.)You can try e.g.
nut-scanner -DDDDDD -U 2>&1 | lessto keep those messages in the standard viewer, where it would be easier for you to search for mentions oflibusb. It is possible it looked at valid candidates and discarded them for some reason (would say why), or did not look into the correct directory, etc.Proxmox should not be the problem, I have NUT running on PVE 7 and 8 - it is just Debian (or similar) as far as programs and packaging in the host-OS are concerned.
jimklimov commentedon Jun 19, 2025
Example from a PVE here:
so here it had a direct hit for the name resolved during build. Otherwise it would have retried with some other names (e.g.
libusb.so), etc.x-MrFloppy-x commentedon Jun 19, 2025
Thanks @jimklimov, that pointet me into the right direction, although not sure if this is expected behavior on pve.
TLDR: an "
apt install libusb-1.0-0-dev" solved my problems and i was able to build it and see my USB UPS with nut-scanner.My Error:
I did fidle around a bit to much yesterday and it was obviously way beyond my bedtime ;-).
I must have missed to
make install-as-rootafter i saw the* build USB drivers: yes (libusb-1.0)output in the configure.discovered behavior on which i'm unsure if i should expected it:
with the libusb-1.0-0-dev removed from the system i do get the following during the configure:
so aperently i got the same behavior as this post above: (#2431 (comment))
jimklimov commentedon Jun 19, 2025
With absent
*-devpackages this is expected - they deliver the pkg-config metadata files and/or equivalent legacy modulename-config scripts, and headers, and shorter symlinks. While we try to not rely on the latter (since relatively recent fixes for this issue), we can't build without at least headers (the rest can be passed in other configure options).However your later post indicates pkg-config data for libusb-1.0 and headers were seen. Or was this after you installed *-dev?
x-MrFloppy-x commentedon Jun 19, 2025
@jimklimov
Must be after installed the *-dev!
I just retested 2 times and without *-dev the configure does not find the usblib!
Thanls for your answers and the right questions!
Craig-Powell commentedon Oct 22, 2025
Adding a related comment in case it helps someone in the future.
Just tried installing nut on a Raspberry Pi 3B with the bone stock Raspberry Pi OS Lite, 64-bit trixie, 2025-10-01 build. The current nut packge for this is 2.8.1-5. Was able to see my USB attached UPS just fine but didn't like I was getting the following errors with nut-scanner:
Yeah, I could just use
nut-scanner -Usince my devices are all USB based but I still wanted to understand this. Following on clues from the thread I installed the related dev libraries:sudo apt install libsnmp-dev libneon27-dev libavahi-client-dev libfreeipmi-devThis now allows the run of nut-scanner to execute without errors. So while I didn't have to do this for my setup (at least not at this time) I think having this answer here can still be useful to the community depending on what keywords a user is searching for. I guess once the Raspberry Pi OS packages get updated to nut 2.8.3 or higher this will all be moot.
jimklimov commentedon Oct 22, 2025
Thanks for the heads-up. Technically,
nut-scanneris built this way to not depend on packages with those libraries so the required installation footprint is smaller, and the needed profile depends on the use-case (so drivers using those libs would be programs that require them; if you don't have say an SNMP UPS and so no need for that driver, you don't have to pull in the library to scan for your serial or USB UPS).hurricup commentedon Nov 11, 2025
solved mine missingn usb library with
sudo apt install libusb-1.0-0-devm4/ax_realpath_lib.m4: refactor with LIBRARY_PATH; clean up after our…
m4/ax_realpath_lib.m4: retry by calling linker or compiler with the l…
m4/ax_realpath_lib.m4, NEWS.adoc, docs/nut.dict: retry by calling lin…