Nut-scanner points towards incorrect lib symlinks

# nut-scanner throws the following errors:

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 AVAHI library (libavahi-client.so) : file not found. AVAHI search disabled.
Cannot load NUT library (libupsclient.so) : file not found. NUT search disabled.
No start IP, skipping NUT bus (old connect method)

# ls -la /usr/lib/libusb* shows the following symlink:

/usr/lib/libusb-1.0.so.0 -> libusb-1.0.so.0.4.0
/usr/lib/libusb-1.0.so.0.4.0

The workaround by manually creating a symlink from libusb-1.0.so.0.4.0 to libusb-1.0.so results in a working nut-scanner.

So libusb was updated from 1.0.26 to 1.0.27 in August 2024 back in Core Update 188 and this updated the libusb library from 1.0.so.0.3.0 to 1.0.so.0.4.0

It is now clear that nut has a dependency on libusb but it was not shipped after libusb was updated as that dependency was not recognised or know about.

Clearly not many people have been using nut with Core Updates after CU188 as your finding is the first notification of this issue.

New CU installations after CU188 would work fine with nut, it is only updated versions from CU188 or earlier that will have the problem.

When I am back at home I will do a patch submission to ship nut so the library linkage gets updated.

Bug has been raised for this so that it is recorded and not forgotten about.

https://bugzilla.ipfire.org/show_bug.cgi?id=13840

Not sure but nut-scanner appears to not be working on 2.29 core 203.

Had to do the link fix to get it to sort of working (only interested in the USB bit)

In /usr/lib

ln -s libusb-1.0.so.0.6.0 libusb-1.0.so

ls -la libusb*
lrwxrwxrwx 1 root root 19 Aug 7 14:30 libusb-1.0.so → libusb-1.0.so.0.6.0
lrwxrwxrwx 1 root root 19 Jul 14 13:53 libusb-1.0.so.0 → libusb-1.0.so.0.6.0
-rwxr-xr-x 1 root root 134328 Jul 14 16:13 libusb-1.0.so.0.6.0

Why do you think that. What error messages did you get?

I just installed nut onto a vm CU203 system and then via the console command line I ran the command

nut-scanner -D

and here are the lines extracted from that output related to libusb

   0.001083	[D1] Looking for lib libusb-1.0.so.0.6.0, found /usr/lib/libusb-1.0.so.0.6.0
   0.001086	[D1] nutscan_init: get_libname() resolved '/usr/lib/libusb-1.0.so.0.6.0' for LibUSB, loading it
   0.001400	[D1] nutscan_init: succeeded to load the library for LibUSB

It quite happily found libusb-1.0.so.0.6.0 with my library symlinks being

ls -hal /usr/lib/libusb*
lrwxrwxrwx 1 root root   19 Jul 14 13:53 /usr/lib/libusb-1.0.so.0 -> libusb-1.0.so.0.6.0
-rwxr-xr-x 1 root root 132K Jul 14 16:13 /usr/lib/libusb-1.0.so.0.6.0

So it didn’t need to have the libusb-1.0.so link, so the fix that nut put in place in version 2.8.3 still appears to be working.

Can you remove that symlink that you created and then run the command

nut-scanner -D and show the lines related to libusb

Without the symlink libusb-1.0.so I put in, running nut-scanner -D gives

nut-scanner -D
0.000002 [D1] Run-time loadable library search paths used by this build of NUT:
0.000081 [D1] NOTE: Reporting raw built-in paths:
0.000100 [D1] Built-in: /usr/lib
0.000137 [D1] Built-in: /usr/usr/lib
0.000166 [D1] Built-in: /usr/local/usr/lib
0.000186 [D1] Built-in: /usr/lib/64
0.000207 [D1] Built-in: /usr/lib64
0.000228 [D1] Built-in: /usr/lib
0.000256 [D1] Built-in: /lib/64
0.000278 [D1] Built-in: /lib64
0.000298 [D1] Built-in: /lib
0.000318 [D1] Built-in: /usr/local/lib/64
0.000343 [D1] Built-in: /usr/local/lib64
0.000365 [D1] Built-in: /usr/local/lib
0.000381 [D1] Built-in: /usr/lib/x86_64-linux-gnu
0.000402 [D1] Built-in: /usr/lib/gcc/x86_64-linux-gnu
0.000422 [D1] Built-in: /usr/lib/x86_64-pc-linux-gnu
0.000443 [D1] Built-in: /usr/lib/gcc/x86_64-pc-linux-gnu
0.000474 [D1] nutscan_init: Parallel scan support: max_threads=512
0.001661 [D1] Looking for lib libusb-1.0.so.0.5.0, found (null)
0.002551 [D1] Got no strong candidate path for lib libusb-1.0.so in /usr/lib, but saw seemingly related names (are you missing a symbolic link, perhaps?) e.g.: libusb-1.0.so.0.6.0
0.002710 [D1] Looking for lib libusb-1.0.so, found (null)
0.003725 [D1] Looking for lib /usr/lib/libusb-1.0.so.0.5.0, found (null)
0.004708 [D1] Looking for lib libusb.so, found (null)
0.004734 [D1] nutscan_init: get_libname() did not resolve libname for LibUSB, trying to load it with libtool default resolver
0.005076 Cannot load USB library (libusb-1.0.so.0.5.0) : file not found. USB search disabled.
0.005144 [D1] nutscan_init: failed to load the library for LibUSB
0.006131 [D1] Looking for lib libnetsnmp.so.40.2.0, found (null)
0.007095 [D1] Looking for lib libnetsnmp.so, found (null)
0.008100 [D1] Looking for lib /usr/lib/libnetsnmp.so.40.2.0, found (null)
0.008152 [D1] nutscan_init: get_libname() did not resolve libname for LibSNMP, trying to load it with libtool default resolver
0.008311 Cannot load SNMP library (libnetsnmp.so.40.2.0) : file not found. SNMP search disabled.
0.008346 [D1] nutscan_init: failed to load the library for LibSNMP
0.008368 [D1] nutscan_init: skipped loading the library for LibNeon: was absent during NUT build
0.009358 [D1] Looking for lib libavahi-client.so.3.2.9, found (null)
0.010313 [D1] Looking for lib libavahi-client.so, found (null)
0.011148 [D1] Looking for lib /usr/lib/libavahi-client.so.3.2.9, found (null)
0.011168 [D1] nutscan_init: get_libname() did not resolve libname for LibAvahi, trying to load it with libtool default resolver
0.011281 Cannot load AVAHI library (libavahi-client.so.3.2.9) : file not found. AVAHI search disabled.
0.011304 [D1] nutscan_init: failed to load the library for LibAvahi
0.011320 [D1] nutscan_init: skipped loading the library for LibFreeIPMI: was absent during NUT build
0.011920 [D1] Looking for lib libupsclient.so.7, found /usr/lib/libupsclient.so.7.0.0
0.011939 [D1] nutscan_init: get_libname() resolved ‘/usr/lib/libupsclient.so.7.0.0’ for NUT Client library, loading it
0.012238 [D1] nutscan_init: succeeded to load the library for NUT Client library
0.012259 [D1] Parallel scan support: HAVE_PTHREAD && HAVE_PTHREAD_TRYJOIN && HAVE_SEMAPHORE_UNNAMED
0.012278 [D1] Parallel scan support: max_threads=512
0.012294 [D1] USB SCAN: not requested or supported, SKIPPED
0.012305 [D1] SNMP SCAN: not requested or supported, SKIPPED
0.012318 [D1] XML/HTTP SCAN: not requested or supported, SKIPPED
0.012329 No IP range(s) requested, skipping NUT bus (old libupsclient connect method)
0.012343 Scanning NUT simulation devices.
0.012357 [D1] NUT simulation devices SCAN: starting pthread_create with run_nut_simulation…
0.012507 [D1] NUT bus (avahi) SCAN: not requested or supported, SKIPPED
0.012525 [D1] IPMI SCAN: not requested or supported, SKIPPED
0.012536 [D1] SERIAL SCAN: not requested or supported, SKIPPED
0.012549 [D1] NUT simulation devices SCAN: join back the pthread
0.012624 [D1] Scanning: /etc/nut
0.012779 [D1] SCANS DONE: display results
0.012793 [D1] SCANS DONE: display results: USB
0.012808 [D1] SCANS DONE: free resources: USB
0.012822 [D1] SCANS DONE: display results: SNMP
0.012835 [D1] SCANS DONE: free resources: SNMP
0.012847 [D1] SCANS DONE: display results: XML/HTTP
0.012862 [D1] SCANS DONE: free resources: XML/HTTP
0.012873 [D1] SCANS DONE: display results: NUT bus (old)
0.012883 [D1] SCANS DONE: free resources: NUT bus (old)
0.012892 [D1] SCANS DONE: display results: NUT simulation devices
0.012902 [D1] SCANS DONE: free resources: NUT simulation devices
0.012917 [D1] SCANS DONE: display results: NUT bus (avahi)
0.012928 [D1] SCANS DONE: free resources: NUT bus (avahi)
0.012938 [D1] SCANS DONE: display results: IPMI
0.012948 [D1] SCANS DONE: free resources: IPMI
0.012958 [D1] SCANS DONE: display results: SERIAL
0.012967 [D1] SCANS DONE: free resources: SERIAL
0.012980 [D1] SCANS DONE: free common scanner resources
0.013002 [D1] nutscan_unload_library: Asked to unload a module 0xa41f6b0 for /usr/lib/libupsclient.so.7.0.0 but our flag says it is not loaded
0.013020 [D1] nutscan_unload_library: unloading module /usr/lib/libupsclient.so.7.0.0
0.013139 [D1] SCANS DONE: EXIT_SUCCESS

This is the appropriate part and for some reason your nut is trying to find libusb-1.0.so.0.5.0 while libusb-1.0.so.0.6.0 is installed so hence it doesn’t find it.

In another post on nut you mentioned that your version was nut-2.8.4-15 on CU203.
That was the same version I tested out on my vm system

Was your CU203 system an upgrade from CU202 or was it a fresh install?

Just checked the iso file - ipfire-2.29-core202x86_64-2026-07-17-1134 so 202
After getting 202 running I did see an update so just hit update - latest should be the greatest :-),
I can’t remember if the update was done before or after installing NUT though

I think I have found what the problem is.

Back in 2025, I identified that nut had become dependent on libusb and this had been missed with the libusb update to version 1.0.29

I added a line to the libusb lfs file to flag up that nut was dependent on libusb and had to be re-shipped when libusb was updated.

That line got added but was then reverted as it was believed that a regression in nut had been fixed and so shipping it was no longer required.

Going through some of the issues in nut related to libusb, it looks like nut looks for an explicit version of libusb based on the version when it was built. So if libusb is updated but nut is not re-shipped then nut stays looking for the old libraries.

Making the link to libusb-1.0.so works because nut still has a fallback that if looking for the explicit version, it fails to find it then it will llok for that library but normally that is only provided if you have the development sources for a package, which IPFire and most distros don’t have unless you explicitly install them.

I think if you

  1. Remove the symlink you created between libusb-1.0.so and libusb-1.0.so.0.6.0
  2. uninstall nut
  3. remove the cached version of nut from the directory /opt/pakfire/cache/
  4. install nut again

you should then get the latest built version based on libusb-1.0.30 which should then use the correct library. Let us know if this fixes it for you. :crossed_fingers: Not totally sure.

My test vm system was a fresh install of CU203, not an update from CU202 to CU203, so it automatically had the updated version of nut installed.

Yep that worked - sorry to cause you work :roll_eyes:

nut-scanner -D
0.000003 [D1] Run-time loadable library search paths used by this build of NUT:
0.000082 [D1] NOTE: Reporting raw built-in paths:
0.000101 [D1] Built-in: /usr/lib
0.000118 [D1] Built-in: /usr/usr/lib
0.000148 [D1] Built-in: /usr/local/usr/lib
0.000170 [D1] Built-in: /usr/lib/64
0.000195 [D1] Built-in: /usr/lib64
0.000216 [D1] Built-in: /usr/lib
0.000235 [D1] Built-in: /lib/64
0.000256 [D1] Built-in: /lib64
0.000294 [D1] Built-in: /lib
0.000313 [D1] Built-in: /usr/local/lib/64
0.000332 [D1] Built-in: /usr/local/lib64
0.000357 [D1] Built-in: /usr/local/lib
0.000377 [D1] Built-in: /usr/lib/x86_64-linux-gnu
0.000399 [D1] Built-in: /usr/lib/gcc/x86_64-linux-gnu
0.000420 [D1] Built-in: /usr/lib/x86_64-pc-linux-gnu
0.000451 [D1] Built-in: /usr/lib/gcc/x86_64-pc-linux-gnu
0.000473 [D1] nutscan_init: Parallel scan support: max_threads=512
0.001481 [D1] Looking for lib libusb-1.0.so.0.6.0, found /usr/lib/libusb-1.0.so.0.6.0
0.001508 [D1] nutscan_init: get_libname() resolved ‘/usr/lib/libusb-1.0.so.0.6.0’ for LibUSB, loading it
0.003122 [D1] nutscan_init: succeeded to load the library for LibUSB
0.004058 [D1] Looking for lib libnetsnmp.so.40.2.0, found (null)
0.004878 [D1] Looking for lib libnetsnmp.so, found (null)
0.005511 [D1] Looking for lib /usr/lib/libnetsnmp.so.40.2.0, found (null)
0.005527 [D1] nutscan_init: get_libname() did not resolve libname for LibSNMP, trying to load it with libtool default resolver
0.005699 Cannot load SNMP library (libnetsnmp.so.40.2.0) : file not found. SNMP search disabled.
0.005719 [D1] nutscan_init: failed to load the library for LibSNMP
0.005732 [D1] nutscan_init: skipped loading the library for LibNeon: was absent during NUT build
0.006252 [D1] Looking for lib libavahi-client.so.3.2.9, found (null)
0.006735 [D1] Looking for lib libavahi-client.so, found (null)
0.007175 [D1] Looking for lib /usr/lib/libavahi-client.so.3.2.9, found (null)
0.007188 [D1] nutscan_init: get_libname() did not resolve libname for LibAvahi, trying to load it with libtool default resolver
0.007256 Cannot load AVAHI library (libavahi-client.so.3.2.9) : file not found. AVAHI search disabled.
0.007269 [D1] nutscan_init: failed to load the library for LibAvahi
0.007277 [D1] nutscan_init: skipped loading the library for LibFreeIPMI: was absent during NUT build
0.007631 [D1] Looking for lib libupsclient.so.7, found /usr/lib/libupsclient.so.7.0.0
0.007643 [D1] nutscan_init: get_libname() resolved ‘/usr/lib/libupsclient.so.7.0.0’ for NUT Client library, loading it
0.007836 [D1] nutscan_init: succeeded to load the library for NUT Client library
0.007854 [D1] Parallel scan support: HAVE_PTHREAD && HAVE_PTHREAD_TRYJOIN && HAVE_SEMAPHORE_UNNAMED
0.007868 [D1] Parallel scan support: max_threads=512
0.007879 Scanning USB bus.
0.008001 [D1] SNMP SCAN: not requested or supported, SKIPPED
0.008013 [D1] XML/HTTP SCAN: not requested or supported, SKIPPED
0.008021 No IP range(s) requested, skipping NUT bus (old libupsclient connect method)
0.008029 Scanning NUT simulation devices.
0.008036 [D1] NUT simulation devices SCAN: starting pthread_create with run_nut_simulation…
0.008150 [D1] NUT bus (avahi) SCAN: not requested or supported, SKIPPED
0.008164 [D1] IPMI SCAN: not requested or supported, SKIPPED
0.008178 [D1] SERIAL SCAN: not requested or supported, SKIPPED
0.008190 [D1] USB SCAN: join back the pthread
0.008261 [D1] Scanning: /etc/nut
0.033018 [D1] NUT simulation devices SCAN: join back the pthread
0.033045 [D1] SCANS DONE: display results
0.033054 [D1] SCANS DONE: display results: USB
[nutdev-usb1]
driver = “usbhid-ups”
port = “auto”
vendorid = “051D”
productid = “0002”
product = “Back-UPS XS 1400U FW:926.T2 .I USB FW:T2”
serial = “3B1651X00698”
vendor = “American Power Conversion”

bus = “002”

device = “003”

busport = “002”

0.033140 [D1] SCANS DONE: free resources: USB
0.033155 [D1] SCANS DONE: display results: SNMP
0.033164 [D1] SCANS DONE: free resources: SNMP
0.033173 [D1] SCANS DONE: display results: XML/HTTP
0.033182 [D1] SCANS DONE: free resources: XML/HTTP
0.033190 [D1] SCANS DONE: display results: NUT bus (old)
0.033200 [D1] SCANS DONE: free resources: NUT bus (old)
0.033209 [D1] SCANS DONE: display results: NUT simulation devices
0.033218 [D1] SCANS DONE: free resources: NUT simulation devices
0.033227 [D1] SCANS DONE: display results: NUT bus (avahi)
0.033237 [D1] SCANS DONE: free resources: NUT bus (avahi)
0.033246 [D1] SCANS DONE: display results: IPMI
0.033254 [D1] SCANS DONE: free resources: IPMI
0.033263 [D1] SCANS DONE: display results: SERIAL
0.033272 [D1] SCANS DONE: free resources: SERIAL
0.033282 [D1] SCANS DONE: free common scanner resources
0.033296 [D1] nutscan_unload_library: unloading module /usr/lib/libusb-1.0.so.0.6.0
0.033516 [D1] nutscan_unload_library: Asked to unload a module 0x2ec02b50 for /usr/lib/libupsclient.so.7.0.0 but our flag says it is not loaded
0.033531 [D1] nutscan_unload_library: unloading module /usr/lib/libupsclient.so.7.0.0
0.033595 [D1] SCANS DONE: EXIT_SUCCESS

That is good news.

No problem with the work. Good to have it highlighted so it could be fixed.

I will aim to make sure we remember that nut has to be shipped when libusb is updated in the future.

Had the same problem. Solution from Adolf worked for me, too (delete symlink and so on).

But additionally I had to create the symlink afterward, otherwise there would be no connection possible (upsc USV says: Error: Driver not connected)

Therefore you need: ln -s /usr/lib/libusb-1.0.so.0.6.0 /usr/lib/libusb-1.0.so.0

(IPFire 2.29 (x86_64) - Core-Update 203)