**Problem:** Foreman-Installer - ruby spawn (Errno::ENOENT)

Hello,

I tried to install Foreman on a test VM running with Ubuntu 20.04. I added the Foreman 3.7 repository.

Actually i get following error if i want to install the Foreman-Installer. As seen the Problem is Ruby related but i already installed a needed packages.
*/usr/lib/ruby/2.7.0/open3.rb:213:in `spawn’: No such file or directory - facter (Errno::ENOENT)

Do i miss something or something need to be changed ?

foreman-installer (3.7.0-1+ubuntu2004) wird eingerichtet …
Traceback (most recent call last):
20: from /usr/sbin/foreman-installer:8:in <main>' 19: from /usr/lib/ruby/vendor_ruby/kafo/kafo_configure.rb:50:in run’
18: from /usr/share/rubygems-integration/all/gems/clamp-1.3.2/lib/clamp/command.rb:140:in run' 17: from /usr/share/rubygems-integration/all/gems/clamp-1.3.2/lib/clamp/command.rb:140:in new’
16: from /usr/lib/ruby/vendor_ruby/kafo/kafo_configure.rb:115:in initialize' 15: from /usr/lib/ruby/vendor_ruby/kafo/configuration.rb:325:in run_migrations’
14: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:35:in run' 13: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:35:in each’
12: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:38:in block in run' 11: from /usr/lib/ruby/vendor_ruby/kafo/migration_context.rb:10:in execute’
10: from /usr/lib/ruby/vendor_ruby/kafo/migration_context.rb:10:in instance_eval' 9: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:25:in block (2 levels) in load_migrations’
8: from /usr/lib/ruby/vendor_ruby/kafo/migrations.rb:25:in instance_eval' 7: from /etc/foreman-installer/scenarios.d/foreman.migrations/20200909151007_manage_acls_on_debian.rb:1:in block (2 levels) in load_migrations’
6: from /usr/lib/ruby/vendor_ruby/kafo/base_context.rb:6:in facts' 5: from /usr/lib/ruby/vendor_ruby/kafo/base_context.rb:29:in facts’
4: from /usr/lib/ruby/vendor_ruby/kafo/base_context.rb:39:in run_command' 3: from /usr/lib/ruby/2.7.0/open3.rb:281:in capture3’
2: from /usr/lib/ruby/2.7.0/open3.rb:101:in popen3' 1: from /usr/lib/ruby/2.7.0/open3.rb:213:in popen_run’
/usr/lib/ruby/2.7.0/open3.rb:213:in `spawn’: No such file or directory - facter (Errno::ENOENT)
dpkg: Fehler beim Bearbeiten des Paketes foreman-installer (–configure):
»installiertes foreman-installer-Skript des Paketes post-installation«-Unterprozess gab den Fehlerwert 1 zurück
Trigger für man-db (2.9.1-1) werden verarbeitet …
Fehler traten auf beim Bearbeiten von:
foreman-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

Thanks,
Henrik

For info,
I have a similar issue with redhat8, and it is difficult to understand what is missing here.

Exécution du scriptlet: foreman-installer-1:3.7.0-1.el8.noarch 25/25
/usr/share/ruby/open3.rb:213:in spawn': No such file or directory - facter (Errno::ENOENT) from /usr/share/ruby/open3.rb:213:in popen_run’
from /usr/share/ruby/open3.rb:101:in popen3' from /usr/share/ruby/open3.rb:281:in capture3’
from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/base_context.rb:39:in run_command' from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/base_context.rb:29:in facts’
from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/base_context.rb:6:in facts' from /etc/foreman-installer/scenarios.d/foreman.migrations/20200909151007_manage_acls_on_debian.rb:1:in block (2 levels) in load_migrations’
from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/migrations.rb:25:in instance_eval' from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/migrations.rb:25:in block (2 levels) in load_migrations’
from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/migration_context.rb:10:in instance_eval' from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/migration_context.rb:10:in execute’
from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/migrations.rb:38:in block in run' from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/migrations.rb:35:in each’
from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/migrations.rb:35:in run' from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/configuration.rb:325:in run_migrations’
from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/kafo_configure.rb:115:in initialize' from /usr/share/gems/gems/clamp-1.3.2/lib/clamp/command.rb:140:in new’
from /usr/share/gems/gems/clamp-1.3.2/lib/clamp/command.rb:140:in run' from /usr/share/gems/gems/kafo-7.0.0/lib/kafo/kafo_configure.rb:50:in run’
from /sbin/foreman-installer:8:in `’
attention : %post(foreman-installer-1:3.7.0-1.el8.noarch) scriptlet échoué, état de sortie 1

Error in POSTIN scriptlet in rpm package foreman-installer

Please, could you help to troubleshoot here

I encountered the same issue with hardened Red Hat 8.9.
/usr/share/ruby/open3.rb:213:in spawn’: No such file or directory - facter (Errno::ENOENT)`
when trying to install foreman-installer.
The issue was in mounting /opt/puppetlabs with noexec option which blocks ruby to execute spawn.
Noexec option is added to /opt/puppetlabs /var/tmp and /tmp when I installed Red Hat with DISA STIG or CIS Benchmark for Server Level 2 security profiles.
Finally I removed noexec from /opt/puppetlabs, /var/tmp, /tmp and rebooted the server.
After this Foreman installation and foreman itself works as intended (noexec under /var/tmp and /tmp blocked Remote Execution).

Thanks for that information @tiga. I’ve submitted Check if /opt/puppetlabs is mounted noexec by ekohl · Pull Request #920 · theforeman/foreman-installer · GitHub to prevent the installer from getting to that point and fail with an actionable error.