E: Package rubygem-foreman_maintain cannot be found

thanks for your answer @evgeni , none of them are installed satellite, satellite-capsule and satellite-installer.

I get for stopping services and starting service an error, should I white list them: --whitelist=“service-stop” I dont know if that have an side effect!

# foreman-maintain backup offline /tmp/backup/
Starting backup: 2023-03-15 09:41:14 +0100
Running preparation steps required to run the next scenarios
================================================================================
Make sure Foreman DB is up:
/ Checking connection to the Foreman DB                               [OK]
--------------------------------------------------------------------------------


Running Backup
================================================================================
Confirm turning off services is allowed:
WARNING: This script will stop your services.

Do you want to proceed?, [y(yes), q(quit)] y
                                                                      [OK]
--------------------------------------------------------------------------------
Prepare backup Directory:
Creating backup folder /tmp/backup/foreman-backup-2023-03-15-09-41-14 [OK]
--------------------------------------------------------------------------------
Check if the directory exists and is writable:                        [OK]
--------------------------------------------------------------------------------
Generate metadata:
- Saving metadata to metadata.yml                                     [OK]
--------------------------------------------------------------------------------
Detect features available in the local proxy:                         [OK]
--------------------------------------------------------------------------------
Add maintenance_mode tables/chain to nftables/iptables:               [OK]
--------------------------------------------------------------------------------
Stop applicable services:

Stopping the following service(s):                                    [FAIL]
No services found matching your parameters
--------------------------------------------------------------------------------
Scenario [Backup] failed.

The following steps ended up in failing state:

  [service-stop]

Resolve the failed steps and rerun the command.
In case the failures are false positives, use
--whitelist="service-stop"



Running Failed backup cleanup
================================================================================
Start applicable services:

Starting the following service(s):                                    [FAIL]
No services found matching your parameters
--------------------------------------------------------------------------------
Remove maintenance mode table/chain from nftables/iptables:           [OK]
--------------------------------------------------------------------------------
Clean up backup directory:                                            [OK]
--------------------------------------------------------------------------------
Scenario [Failed backup cleanup] failed.

The following steps ended up in failing state:

  [service-start]

Resolve the failed steps and rerun the command.
In case the failures are false positives, use
--whitelist="service-start"


Done with backup: 2023-03-15 09:41:24 +0100
Backup didn't finish. Incomplete backup was removed.

taking an offline backup without stopping services is a bad idea (the data will not be consistent)

you can do an online backup, that does not need stopping services

but I still wonder why it doesn’t detect any services to be stopped on your system.

1 Like

Thats exactly what I think about it! and I dont want make “any mistake” on production server.

Here the services are running:


# systemctl | grep running | grep -E "foreman|puppet|postgresql"
  foreman-proxy.service                                                                                                               loaded active running   Foreman Proxy
  foreman.service                                                                                                                     loaded active running   Foreman
  postgresql@10-main.service                                                                                                          loaded active running   PostgreSQL Cluster 10-main
  puppet.service                                                                                                                      loaded active running   Puppet agent
  puppetserver.service                                                                                                                loaded active running   puppetserver Service
  foreman.socket                                                                                                                      loaded active running   Foreman HTTP Server Accept Sockets

can you try running foreman-maintain advanced procedure run foreman-proxy-features and paste me the output (that’s a totally unrelated thing, but I want to see if the feature detection works)

of course here is the output @evgeni :

# foreman-maintain advanced procedure run foreman-proxy-features
Running ForemanMaintain::Scenario
================================================================================
Detect features available in the local proxy:
                                                                      [OK]
--------------------------------------------------------------------------------

but when I run foreman-maintain health check maybe this is helpful

# foreman-maintain health check
Running ForemanMaintain::Scenario::FilteredScenario
================================================================================
Check number of fact names in database:                               [OK]
--------------------------------------------------------------------------------
Check to verify no empty CA cert requests exist:                      [OK]
--------------------------------------------------------------------------------
Check whether all services are running:                               [OK]
--------------------------------------------------------------------------------
Check whether all services are running using the ping call:           [FAIL]
Couldn't connect to the server: SSL_connect returned=1 errno=0 state=error: certificate verify failed (unspecified certificate verification error)
--------------------------------------------------------------------------------
Continue with step [Restart applicable services]?, [y(yes), n(no)]

Can you please create the file /usr/share/rubygems-integration/all/gems/foreman_maintain-1.2.4/definitions/procedures/foreman_maintain_features.rb with the following content:

class Procedures::ForemanMaintainFeatures < ForemanMaintain::Procedure
  metadata do
    description 'List detected Foreman Maintain features' 
  end

  def run
    features = ForemanMaintain.available_features
    puts features.map(&:inspect).join("\n")
  end
end

And then run foreman-maintain advanced procedure run foreman-maintain-features and paste the output?

1 Like

@evgeni here:

root@test-dev:~# cat /usr/share/rubygems-integration/all/gems/foreman_maintain-1.2.4/definitions/procedures/foreman_maintain_features.rb
class Procedures::ForemanMaintainFeatures < ForemanMaintain::Procedure
    metadata do
          description 'List detected Foreman Maintain features'
            end

      def run
            features = ForemanMaintain.available_features
                puts features.map(&:inspect).join("\n")
                  end
end
root@test-dev:~# foreman-maintain advanced procedure run foreman-maintain-features
Running ForemanMaintain::Scenario
================================================================================
List detected Foreman Maintain features:
dynflow_sidekiq<Features::DynflowSidekiq>
foreman_database<Features::ForemanDatabase>
foreman_install<Features::ForemanInstall>
foreman_proxy<Features::ForemanProxy>
foreman_server<ForemanMaintain::Features::ForemanServer>
hammer<Features::Hammer>
installer<Features::Installer>
instance<Features::Instance>
iptables<Features::Iptables>
puppet_server<Features::PuppetServer>
service<Features::Service>
sync_plans<Features::SyncPlans>
tar<Features::Tar>                                                    [OK]
--------------------------------------------------------------------------------

You want :set paste in your vim :wink:

Anyway. The output looks good (and confuses me even more).

FM detects all the relevant features of your installation just fine, and yet it doesn’t detect their respective services…

1 Like

sorry , you are right, here with paste :smiley:



root@test-dev:~# cat /usr/share/rubygems-integration/all/gems/foreman_maintain-1.2.4/definitions/procedures/foreman_maintain_features.rb
class Procedures::ForemanMaintainFeatures < ForemanMaintain::Procedure
  metadata do
    description 'List detected Foreman Maintain features'
  end

  def run
    features = ForemanMaintain.available_features
    puts features.map(&:inspect).join("\n")
  end
end
root@test-dev:~# foreman-maintain advanced procedure run foreman-maintain-features
Running ForemanMaintain::Scenario
================================================================================
List detected Foreman Maintain features:
dynflow_sidekiq<Features::DynflowSidekiq>
foreman_database<Features::ForemanDatabase>
foreman_install<Features::ForemanInstall>
foreman_proxy<Features::ForemanProxy>
foreman_server<ForemanMaintain::Features::ForemanServer>
hammer<Features::Hammer>
installer<Features::Installer>
instance<Features::Instance>
iptables<Features::Iptables>
puppet_server<Features::PuppetServer>
service<Features::Service>
sync_plans<Features::SyncPlans>
tar<Features::Tar>                                                    [OK]
--------------------------------------------------------------------------------

Should I stop all services manually and run the command ?

no.

1 Like

@evgeni if I should test anything else let me know please… and thanks a lot

Well, if I’d know what’s happening there…

Let’s try more debugging.

Create a /usr/share/rubygems-integration/all/gems/foreman_maintain-1.2.4/definitions/procedures/foreman_maintain_services.rb with the following content

class Procedures::ForemanMaintainServices < ForemanMaintain::Procedure
  metadata do
    description 'List detected Foreman Maintain services'
  end

  def run
    feature = feature(:service)
    puts "Existing services"
    puts feature.existing_services.join(", ")
    puts "Filtered services"
    puts feature.filtered_services({ :only => nil, :exclude => nil, :include => nil }).to_s
  end
end

And then run it. (The below is the output on my Debian box, yours very well might be different)

# foreman-maintain advanced procedure run foreman-maintain-services
Running ForemanMaintain::Scenario
================================================================================
List detected Foreman Maintain services: 
Existing services
postgresql, apache2, dynflow-sidekiq@orchestrator, foreman, puppetserver, dynflow-sidekiq@worker-1, foreman-proxy
Filtered services
{10=>[Systemd(postgresql [10])], 30=>[Systemd(apache2 [30]), Systemd(dynflow-sidekiq@orchestrator [30]), Systemd(foreman [30]), Systemd(puppetserver [30])], 31=>[Systemd(dynflow-sidekiq@worker-1 [31])], 40=>[Systemd(foreman-proxy [40])]}
                                                                      [OK]
--------------------------------------------------------------------------------
1 Like

Oh, and the output of ruby -e "puts File.exist?('/usr/bin/systemctl')" please

1 Like

@evgeni thank you so much, here is the output, I hope we can find the problem:


root@test-dev:~# cat /usr/share/rubygems-integration/all/gems/foreman_maintain-1.2.4/definitions/procedures/foreman_maintain_services.rb
class Procedures::ForemanMaintainServices < ForemanMaintain::Procedure
  metadata do
    description 'List detected Foreman Maintain services'
  end

  def run
    feature = feature(:service)
    puts "Existing services"
    puts feature.existing_services.join(", ")
    puts "Filtered services"
    puts feature.filtered_services({ :only => nil, :exclude => nil, :include => nil }).to_s
  end
end
root@test-dev:~# foreman-maintain advanced procedure run foreman-maintain-services
Running ForemanMaintain::Scenario
================================================================================
List detected Foreman Maintain services:
Existing services
postgresql, puppetserver
Filtered services
{10=>[Systemd(postgresql [10])], 30=>[Systemd(puppetserver [30])]}    [OK]
--------------------------------------------------------------------------------

root@test-dev:~# ruby -e "puts File.exist?('/usr/bin/systemctl')"
false

Okay, now we’re getting to the interesting bits.

Are you running systemd as init? You’ve used systemctl above, so I’d assume the answer is yes, but the output above indicates there is no /usr/bin/systemctl on your system? What does which systemctl output?

1 Like

its systemd check below:


root@test-dev:~# ls /usr/bin/systemctl
ls: cannot access '/usr/bin/systemctl': No such file or directory
root@test-dev:~# which systemctl
/bin/systemctl
root@test-dev:~# ps -p 1 -o comm=
systemd
root@test-dev:~# stat /sbin/init
  File: /sbin/init -> /lib/systemd/systemd
  Size: 20              Blocks: 0          IO Block: 4096   symbolic link
Device: 802h/2050d      Inode: 2883730     Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-03-16 09:34:08.444557003 +0100
Modify: 2023-03-02 13:58:02.000000000 +0100
Change: 2023-03-08 06:58:04.679284820 +0100
 Birth: -

in /usr/share/rubygems-integration/all/gems/foreman_maintain-1.2.4/lib/foreman_maintain/concerns/system_helpers.rb line 33 is /usr/bin/systemctl

I change it to /bin/systemctl it show me the services…but im not sure if its the right way! and if yes why its like this!

Yeah… Can you edit that line in /usr/share/rubygems-integration/all/gems/foreman_maintain-1.2.4/lib/foreman_maintain/concerns/system_helpers.rb to read:

File.exist?('/usr/bin/systemctl') || File.exist?('/bin/systemctl')

And then post the output of foreman-maintain advanced procedure run foreman-maintain-services again

1 Like