Can't run any hammer commands

Problem: I can’t invoke any hammer commands without getting an error. Everything else about Foreman appears to be working correctly. See logs below.

Foreman and Proxy versions: 1.21.0

Command Output:

<foreman host> # hammer 
Traceback (most recent call last):
	17: from /usr/bin/hammer:23:in `<main>'
	16: from /usr/bin/hammer:23:in `load'
	15: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.16.0/bin/hammer:124:in `<top (required)>'
	14: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
	13: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
	12: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.16.0/lib/hammer_cli.rb:16:in `<top (required)>'
	11: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
	10: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
	 9: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.16.0/lib/hammer_cli/abstract.rb:12:in `<top (required)>'
	 8: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
	 7: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
	 6: from /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.16.0/lib/hammer_cli/help/builder.rb:1:in `<top (required)>'
	 5: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
	 4: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
	 3: from /opt/theforeman/tfm/root/usr/share/gems/gems/unicode-0.4.4.1/lib/unicode.rb:1:in `<top (required)>'
	 2: from /opt/theforeman/tfm/root/usr/share/gems/gems/unicode-0.4.4.1/lib/unicode.rb:5:in `rescue in <top (required)>'
	 1: from /opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
/opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require': libruby.so.2.4: cannot open shared object file: No such file or directory - /opt/theforeman/tfm/root/usr/lib64/gems/ruby/unicode-0.4.4.1/unicode/unicode_native.so (LoadError)

I am using RHEL 7.6 and the Ruby packages are being installed from the Software Collections. It would appear that both Ruby 2.4 and 2.5 are installed.

That doesn’t look quite right since everything should be using Ruby 2.5. Does yum update tfm-rubygem* change anything? If so, does it fix it?

No, running the update doesn’t change anything.

Also, I checked into what would happen if I tried to remove rh-ruby24-ruby. It actually tries to remove Foreman since it claims that the package I am removing is a dependency. The same thing happens when I try to remove rh-ruby25-ruby.

Can you share the output of yum list installed tfm*?

Attached as requested.
installed_tfm_packages.log (13.2 KB)

You are mixing Satellite RPMs with Foreman RPMs. This is not supported. I’d advise on choosing one on a system.

Gotcha. I’m not sure why it would have installed them from that source instead of Foreman, but I’ll work on cleaning this up and let you know what happens.

Those packages were installed during the kickstart process; the provided Satellite Tools packages are necessary for our environment. To work around the issue, I disabled the Satellite Tools repository and then reinstalled all of the packages from the correct Foreman repositories. Everything seems to be working as intended now.

Thanks for the help!

What packages does it provide that you lack? You can probably use yum’s option to exclude all but those packages from the Satellite repository.

We need the katello-agent and related packages. I too was thinking that we may just need to use an exclude of some sort to avoid this if we need to rebuild our Foreman host.

We ship katello-agent in the foreman client repo (starting 1.20). That should be compatible with the latest Foreman and might support features not (yet) in Satellite. I’d advise using that.

Hello guys I have the same issue of mixed rpms how can I get the official rpms in order to update my katello package to 3.9?? Right now after I upgrade from the foreman repos to 1.20 I have this error “/opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require’: libruby.so.2.4: cannot open shared object file: No such file or directory - /opt/theforeman/tfm/root/usr/lib64/gems/ruby/unicode-0.4.4.1/unicode/unicode_native.so”
I have disable the Satellite Tools repos and reinstalled them without success, thanks for the help.