Building Opennebula for Alpine Linux, hook_exe error

Hello!

I have a rather strange case - build Opennebula from sources for Alpine Linux 3.15.

At the end of the deployment, when I try to run oned, I get an error:

Wed Jun  8 23:18:46 2022 [Z0][ACL][I]: ACL Manager started.
Wed Jun  8 23:18:48 2022 [Z0][HKM][I]: Loading Hook Manager driver.
Wed Jun  8 23:18:48 2022 [Z0][DrM][I]: Loading driver: hook_exe
Wed Jun  8 23:18:48 2022 [Z0][DrM][I]: 	Driver loaded: hook_exe
Wed Jun  8 23:18:48 2022 [Z0][HKM][I]: 	Hook Manager loaded
Wed Jun  8 23:18:48 2022 [Z0][DrM][E]: Unable to start driver 'hook_exe': Driver initialization failed

Wed Jun  8 23:18:48 2022 [Z0][HKM][E]: Driver initialization failed

I found an issue in this community with a similar error - this one.
Unfortunately, the solution given in that issue doesn’t work for my case.

My deployment algorithm is the following:

  1. Create user:
adduser oneadmin
  1. Adding packages:
apk add libvncserver-dev libvncserver \
gnutls gnutls-dev libnsl libnsl-dev \
alpine-sdk linux-headers openssl-dev \
make bower npm ronn sqlite-dev \
mariadb-dev mariadb-server-utils mariadb-client \
ruby-dev libxml2 libxml2-dev libxml2 libxml2-dev \
xmlrpc-c xmlrpc-c-dev g++ scons bash
apk add ruby-nokogiri py3-ipaddress ruby-rexml \
ruby-xmlrpc ruby-bundler ruby-pg ruby-augeas augeas-dev \
libpg_query curl-dev libpq-dev
  1. Downloading sources:
git clone https://github.com/OpenNebula/one.git
cd one
  1. Making changes in src/svncterm_server/genfont.c file (due musl):
vim src/svncterm_server/genfont.c
#include <stdint.h>

typedef uint16_t u_int16_t;
  1. Compiling:
scons -j2 new_xmlrpc=yes
  1. Running some build scripts:
cd /root/one/share/man/
./build.sh

cd ~/one/src/fireedge/
./build.sh
  1. Installing Opennebula:
cd ~/one
./install.sh -u oneadmin -g oneadmin
  1. Intall Gems (!):
bundler install --gemfile /usr/share/one/Gemfile
  1. Additional actions:
apk add shadow

usermod -m -d /var/lib/one oneadmin

mkdir -p /var/lib/one/.one/
echo 'oneadmin:oneadm1n' >> /var/lib/one/.one/one_auth

chown oneadmin:oneadmin -R /var/log/one /var/lib/one /run/one /run/lock/one
  1. Aaaaaand starting Opennebula from oneadmin user:
fumoffu-test-node:~$ oned -f
Aborted
fumoffu-test-node:~$ 

Please tell me where I could make a mistake when deploying?
I think that something could screw up with gems.

Thanks in advance for your answers!

Hi @santic,

So if you try to start de hook driver manually, as explained in the issue you linked. Does it starts properly? or are you seeing any error?

Hi, @cgonzalez ,

After launching hook_manager (under oneadmin user) nothing happens, unfortunately:

Thu Jun  9 20:17:30 2022 [Z0][ACL][I]: ACL Manager started.
Thu Jun  9 20:17:30 2022 [Z0][HKM][I]: Loading Hook Manager driver.
Thu Jun  9 20:17:30 2022 [Z0][DrM][I]: Loading driver: hook_exe
Thu Jun  9 20:17:30 2022 [Z0][DrM][I]: 	Driver loaded: hook_exe
Thu Jun  9 20:17:30 2022 [Z0][HKM][I]: 	Hook Manager loaded
Thu Jun  9 20:17:30 2022 [Z0][DrM][E]: Unable to start driver 'hook_exe': Driver initialization failed

Thu Jun  9 20:17:30 2022 [Z0][HKM][E]: Driver initialization failed

fumoffu-test-node:~$ /usr/lib/one/mads/one_hm 
fumoffu-test-node:~$ /usr/lib/one/mads/one_hm -p 2101 -l 2102 -b 127.0.0.1    
fumoffu-test-node:~$ 

I tried to build OpenNebula from sources in Debian

Thu Jun  9 20:52:10 2022 [Z0][ACL][I]: Starting ACL Manager...
Thu Jun  9 20:52:10 2022 [Z0][ACL][I]: ACL Manager started.
Thu Jun  9 20:52:12 2022 [Z0][HKM][I]: Loading Hook Manager driver.
Thu Jun  9 20:52:12 2022 [Z0][DrM][I]: Loading driver: hook_exe
Thu Jun  9 20:52:12 2022 [Z0][DrM][I]: 	Driver loaded: hook_exe
Thu Jun  9 20:52:12 2022 [Z0][HKM][I]: 	Hook Manager loaded
Thu Jun  9 20:52:12 2022 [Z0][DrM][E]: Unable to start driver 'hook_exe': Driver initialization failed

Thu Jun  9 20:52:12 2022 [Z0][HKM][E]: Driver initialization failed

oneadmin@debian:~$ /usr/lib/one/mads/one_hm -p 2101 -l 2102 -b 127.0.0.1  
oneadmin@debian:~$ /usr/lib/one/mads/one_hm -p 2101 -l 2102 -b 127.0.0.1  
oneadmin@debian:~$ 

I tried to build OpenNebula from sources in Debian and install opennebula-rubygems from deb package:

oneadmin@debian:/usr/share/one/gems-dist/specifications$ rm /var/lock/one/one 
oneadmin@debian:/usr/share/one/gems-dist/specifications$ /usr/lib/one/mads/one_hm -p 2101 -l 2102 -b 127.0.0.1  
oneadmin@debian:/usr/share/one/gems-dist/specifications$ oned -f
Aborted
oneadmin@debian:/usr/share/one/gems-dist/specifications$ tail -n10 /var/log/one/oned.log 
Thu Jun  9 21:14:05 2022 [Z0][ACL][I]: Starting ACL Manager...
Thu Jun  9 21:14:05 2022 [Z0][ACL][I]: ACL Manager started.
Thu Jun  9 21:14:05 2022 [Z0][HKM][I]: Loading Hook Manager driver.
Thu Jun  9 21:14:05 2022 [Z0][DrM][I]: Loading driver: hook_exe
Thu Jun  9 21:14:05 2022 [Z0][DrM][I]: 	Driver loaded: hook_exe
Thu Jun  9 21:14:05 2022 [Z0][HKM][I]: 	Hook Manager loaded
Thu Jun  9 21:14:05 2022 [Z0][DrM][E]: Unable to start driver 'hook_exe': Driver initialization failed

Thu Jun  9 21:14:05 2022 [Z0][HKM][E]: Driver initialization failed

oneadmin@debian:/usr/share/one/gems-dist/specifications$ 

I’ll try to understand deb-files.

Enable debug mode:

vim /etc/one/defaultrc

ONE_MAD_DEBUG=1

Started /usr/lib/one/mads/one_hm manualy
and looked in /var/log/one/one_hm.log

Summary
Unable to load this gem. The libzmq library (or DLL) could not be found.
If this is a Windows platform, make sure libzmq.dll is on the PATH.
If the DLL was built with mingw, make sure the other two dependent DLLs,
libgcc_s_sjlj-1.dll and libstdc++6.dll, are also on the PATH.
For non-Windows platforms, make sure libzmq is located in this search path:
["/usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core/../../ext/libzmq.so", "/usr/local/sbin/libzmq.so", "/usr/local/bin/libzmq.so", "/usr/sbin/libzmq.so", "/usr/bin/libzmq.so", "/sbin/libzmq.so", "/bin/libzmq.so", "/usr/lib/libzmq.so", "/usr/local/lib/libzmq.so", "/opt/local/lib/libzmq.so", "/usr/lib64/libzmq.so"]
/usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core/libzmq.rb:67:in `rescue in <module:LibZMQ>': The libzmq library (or DLL) could not be loaded (LoadError)
	from /usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core/libzmq.rb:10:in `<module:LibZMQ>'
	from /usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core/libzmq.rb:7:in `<top (required)>'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	from /usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core.rb:3:in `<top (required)>'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	from /usr/share/one/gems-dist/gems/ffi-rzmq-2.0.7/lib/ffi-rzmq.rb:66:in `<top (required)>'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `require'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `rescue in require'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:147:in `require'
	from /usr/lib/one/mads/one_hm.rb:56:in `<main>'
/usr/share/one/gems-dist/gems/ffi-1.15.5/lib/ffi/library.rb:145:in `block in ffi_lib': Could not open library '/usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core/../../ext/libzmq.so': /usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core/../../ext/libzmq.so: cannot open shared object file: No such file or directory. (LoadError)
Could not open library '/usr/local/sbin/libzmq.so': /usr/local/sbin/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library '/usr/local/bin/libzmq.so': /usr/local/bin/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library '/usr/sbin/libzmq.so': /usr/sbin/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library '/usr/bin/libzmq.so': /usr/bin/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library '/sbin/libzmq.so': /sbin/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library '/bin/libzmq.so': /bin/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library '/usr/lib/libzmq.so': /usr/lib/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library '/usr/local/lib/libzmq.so': /usr/local/lib/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library '/opt/local/lib/libzmq.so': /opt/local/lib/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library '/usr/lib64/libzmq.so': /usr/lib64/libzmq.so: cannot open shared object file: No such file or directory.
Could not open library 'libzmq': libzmq: cannot open shared object file: No such file or directory.
Could not open library 'libzmq.so': libzmq.so: cannot open shared object file: No such file or directory
	from /usr/share/one/gems-dist/gems/ffi-1.15.5/lib/ffi/library.rb:99:in `map'
	from /usr/share/one/gems-dist/gems/ffi-1.15.5/lib/ffi/library.rb:99:in `ffi_lib'
	from /usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core/libzmq.rb:44:in `<module:LibZMQ>'
	from /usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core/libzmq.rb:7:in `<top (required)>'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	from /usr/share/one/gems-dist/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core.rb:3:in `<top (required)>'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	from /usr/share/one/gems-dist/gems/ffi-rzmq-2.0.7/lib/ffi-rzmq.rb:66:in `<top (required)>'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `require'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:158:in `rescue in require'
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:147:in `require'
	from /usr/lib/one/mads/one_hm.rb:56:in `<main>'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- ffi-rzmq (LoadError)
	from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
	from /usr/lib/one/mads/one_hm.rb:56:in `<main>'

I will dig further :slight_smile:

Installed czmq-dev and oned started.

Thanks everyone! I will try build the package :slight_smile:

1 Like

Hi @santic there used to be opennebula packages for alpine in -testing but i think they had been removed at some point.

did you manage to create a new package? do you want some help?
I had this on my to-do list since at least 4 years and it became more important last year.
since you did actually start on the work, i can at least try to help.

1 Like

Hello, @darkfader !
I wrote an apkbuild file and tried to build the package on the latest version of Alpine Linux… Unfortunately, I have to deal with the deployment again, because there are errors during assembly.

My personal repo with Opennebula APKBUILD.