Open MoritzSKB opened 1 month ago
@MoritzSKB , thank you for reporting this issue. Could you check/share the owner and permission of the installed extension (/var/lib/adu/extensions/sources/libkb_tf_1.so) please?
@Nox-MSFT I checked the permissions and even with them being set to the same as the other handler .so files, the error persists.
@MoritzSKB are you able to debug it? I'm wondering if this is a dependency issue. How did you build your extension? Is there any dependency that need to be installed on the device?
(according to this error: "cannot open shared object file: No such file or directory.")
@Nox-MSFT I am not too familiar with the project, so I can only go off the logs I sent here before. I cloned this GitHub project on a local Linux machine, in which I build my extension by adding it to the respective CMake files and the build.sh script, so that it would be included. I did not change any of the scripts/files besides adding my handler as an option to the list of other step_handlers. I don't think it is an issue with dependencies, as we have tested the default script handlers and got a response. And our custom handler does not use any functionality that is not being used by other handlers already.
Expected Behaviour
The custom handler should be found and run normally
Current Behaviour
When running a device update using the custom agent, it almost immediately flips to the failed state. Checking the logs, this is caused by the .so of my custom handler not being found.
Steps to Reproduce
Assuming custom handler structure is the same as other step handlers and found in the same directory:
./scripts/build.sh -t Release --step-handlers kb/tf
AducIotAgent --extension-type updateContentHandler --register-extension /var/lib/adu/extensions/sources/libkb_tf_1.so --extension-id 'kb/tf:1'
Device Information
Logs
Relevant snippet of /var/log/adu/du-agent.20240515-134117.log:
(newlines added for readablity)
Content of /var/log/adu/steps-handler.20240515-141006.log:
Additional Information
I am trying to implement a custom step handler for the AducIotAgent, following this guide, however I cannot seem to get it to work.
When I try to push an update using the Azure Portal, I get an error (found in the steps-handler log file). This error is generated because the function
ADUCPAL_dlopen
, run here, fails to open the handler. This function, found insrc/libaducpal/src/dlfcn.c
seems to use an external function (LoadLibrary()
) defined inwindows.h
to load the library.So I cannot check in further detail where this error arises, and the error message is not clear about what is causing the problem. I have checked multiple times, and the filepath is correct. The hash of the file is also correct, otherwise the program would have responded with a different error. So the agent can verify that the hash of my custom handler is correct, but right afterwards it tells me that 'no such file exists'? I find this contradictory. Did I build the custom handler wrong? Or did I not set some parameters correctly? How do I fix this issue?
I already spoke to Microsoft Support using a support request in the Azure Portal. I was told to open an issue here, with a reference to that support ticket. It's ID is 2404110050002607