DB migration failure installing remote execution plugin


Installing the Remote Execution plugin (Foreman :: Plugin Manuals) fails with:

root@foreman:/tmp# foreman-installer --enable-foreman-plugin-remote-execution --enable-foreman-proxy-plugin-remote-execution-script
2023-03-23 21:12:55 [NOTICE] [root] Loading installer configuration. This will take some time.
2023-03-23 21:12:57 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2023-03-23 21:12:57 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2023-03-23 21:12:58 [NOTICE] [configure] Starting system configuration.
2023-03-23 21:13:03 [NOTICE] [configure] 250 configuration steps out of 1324 steps complete.
2023-03-23 21:13:03 [NOTICE] [configure] 500 configuration steps out of 1328 steps complete.
2023-03-23 21:13:13 [NOTICE] [configure] 750 configuration steps out of 1457 steps complete.             
2023-03-23 21:13:26 [ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2023-03-23 21:13:26 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: change from 'notrun' to ['0'] failed: '/usr/sbin/foreman-rake db:migrate' 
returned 1 instead of one of [0]                                                                         
2023-03-23 21:13:32 [NOTICE] [configure] 1000 configuration steps out of 1457 steps complete.            
2023-03-23 21:13:33 [NOTICE] [configure] 1250 configuration steps out of 1457 steps complete.            
2023-03-23 21:13:38 [NOTICE] [configure] System configuration has finished.                                                                                                                                        
                                                                                                                                                                                                                     There were errors detected during install.  
  Please address the errors and re-run the installer to ensure the system is properly configured.        
  Failing to do so is likely to result in broken functionality.                                          
  The full log is at /var/log/foreman-installer/foreman.log

Relevant log output:

2023-03-23 21:13:26 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: == 20180110104432 RenameTemplateInvocationPermission: migrating ===============
2023-03-23 21:13:26 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: == 20180110104432 RenameTemplateInvocationPermission: migrated (0.0008s) ======rake aborted!
2023-03-23 21:13:26 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: StandardError: An error has occurred, this and all later migrations canceled:
2023-03-23 21:13:26 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns:
2023-03-23 21:13:26 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: PG::UndefinedColumn: ERROR:  column settings.category does not exist
2023-03-23 21:13:26 [INFO  ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: LINE 1: ... IN (SELECT "settings"."id" FROM "settings" WHERE "settings"...

Expected outcome:

As a new user, I just set up a new Foreman instance and wanted to make it possible to trigger puppet runs immediately. According to Dropping "Run puppet" button with a replacement using remote execution plugin, the remote execution plugin is the way to go. I followed Foreman :: Plugin Manuals - which did not work - but according to Foreman Remote Execution Plugin Documentation the manual is wrong, and I used the fix suggested there. This led to the error which can be seen above. Figuring that there may be an error, I ran foreman-installer -i and disabled both foreman-plugin-remote-execution foreman-proxy-plugin-remote-execution-script again, and confirmed, leading to yet another error:

73. Save and run
74. Cancel run without Saving
Choose an option from the menu... 73
2023-03-23 21:17:38 [NOTICE] [configure] Starting system configuration.
2023-03-23 21:17:43 [NOTICE] [configure] 250 configuration steps out of 1239 steps complete.
2023-03-23 21:17:44 [NOTICE] [configure] 750 configuration steps out of 1372 steps complete.
2023-03-23 21:17:55 [ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2023-03-23 21:17:55 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: change from 'notrun' to ['0'] failed: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
2023-03-23 21:18:00 [NOTICE] [configure] 1000 configuration steps out of 1372 steps complete.
2023-03-23 21:18:00 [NOTICE] [configure] 1250 configuration steps out of 1372 steps complete.
2023-03-23 21:18:02 [NOTICE] [configure] System configuration has finished.

So now my questions are:

  • How do I recover from this broken install? Deselecting the plugins doesn’t seem to help.
  • How do I install the remote execution plugins correctly?
  • If installing them is not possible, which alternatives do I have to trigger puppet runs immediately?

To be honest, this is quite a rocky start trying to use Foreman.

Foreman version:


Distribution and version:

Debian 11.6

I did find Bug #36016: Migration error "column settings.category does not exist" - Templates - Foreman which seems to be a similar bug report which has an associated merged PR in Github, but I don’t know how I can go from here. Apparently, this fix was not released yet? Does that mean the entire plugin is non-functional at the moment for everyone? My questions from the original post still stand

I found Fixes #36003 - Migration error 'column settings.category does not exist' by stejskalleos · Pull Request #778 · theforeman/foreman_remote_execution · GitHub which should be the PR that fixes your problem.
From what I see, this has only been part of remote-execution plugin release 9.1, but Foreman 3.6 only ships 9.0 as of now.
9.1 seems to only currently be in nightly repos.
You could try and install 9.1 from nightly manually, though I am not very firm with deb basted distros and don’t know if or how that actually works.
I am not entirely sure if 3.6 is still in release-candidate stage or not, but I will link your post in Foreman 3.6 release candidate feedback to raise some eyes on this so it can be properly fixed.

Thank you for the insight! As for the foreman version, I followed the instruction for the latest version at Foreman :: Manual - I did not consciously choose an RC, so I would assume that’s a stable version. This means it’s probably broken for everyone trying to set up a new Foreman instance at the moment.

Do you have any recommendation on how I can fix my current installation?

Yes I am getting the same issues trying to run foreman 3.6 installer with any plugin or proxy i try adding - same error message.
I noticed doing from the manual or quickstart for Foreman 3.6 it points you to the nightly stuff - I reimaged my server then reinstall and changed the link pointing to 3.6 instead of nightly which gave me 3.7 - install was good but when trying to add a plugin etc i.e re-running the foreman-installer I get that error and have to backout or to start foreman again.
Any workaround for this?

i am thinking I may need to revert to foreman 3.5 which was working before I blew away everything and did a fresh install of 3.6

At least for remote execution, there should be updates available in the repos soon:

The PRs to update remote-execution in 3.6 were just merged, so updates should be available soon in the repositories.

@canglin If you have other plugins that are failing due to this error, you should ideally report those to.errors to the respective plugins, eithere via GitHub issues (where those are used) or at projects.theforeman.org, or you could make a separate forum post for the plugins you experience failures with to maybe get the right eyes on it. Reporting in the above-linked 3.6 RC feedback topic is also an option.
The is no workaround for this problem, since plugin need to be patched to be compatible with 3.6.

@areyus, Thanks for the info. I went ahead and opened a topic " Foreman 3.6 Plugin error" Hopefully that provided enough information to assist.