Failed to start Foreman after ubgrade dist-

hi all,

after upgrade ubuntu 18.04 to ubuntu 20.04 I cannot start foreman anymore.
installed version on 18.04 was 2.5.4 do I have upgrade foreman too ?

thanks in advance

2.5 should work on 20.04, but it’s hard to say without any output and details how you upgraded.

1 Like

thanks for your answer @evgeni ,

some detailes from journalctl -xe:

-- A start job for unit foreman.service has begun execution.
--
-- The job identifier is 2185.
Mar 30 10:25:01 testserver foreman[5806]: /usr/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /usr/share/foreman/Gemfile.lock. (Gem::GemNotFoundException)
Mar 30 10:25:01 testserver foreman[5806]: To update to the latest version installed on your system, run `bundle update --bundler`.
Mar 30 10:25:01 testserver foreman[5806]: To install the missing version, run `gem install bundler:1.16.1`
Mar 30 10:25:01 testserver foreman[5806]:         from /usr/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
Mar 30 10:25:01 testserver foreman[5806]:         from /usr/bin/bundle:23:in `<main>'
Mar 30 10:25:01 testserver systemd[1]: foreman.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit foreman.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Mar 30 10:25:01 testserver systemd[1]: foreman.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit foreman.service has entered the 'failed' state with result 'exit-code'.
Mar 30 10:25:01 testserver systemd[1]: Failed to start Foreman.
-- Subject: A start job for unit foreman.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit foreman.service has finished with a failure.

Could it be that your foreman package is still the one from 18.04? (We don’t provide a good numbering of versions, sadly).

Can you post the output from apt policy foreman?

I think its.

apt policy foreman
foreman:
  Installed: 2.5.4-2
  Candidate: 2.5.4-2
  Version table:
 *** 2.5.4-2 100
        100 /var/lib/dpkg/status

That is lacking any repo information. Interesting.

Do you have a /etc/apt/sources.list.d/foreman.list or similar with something like:

deb http://deb.theforeman.org/ focal 2.5
deb http://deb.theforeman.org/ plugins 2.5

in it?

1 Like

I think I know whts the issue, the upgrade tool from ubuntu commented out the repos in sources:
/etc/apt/sources.list.d/foreman.list, I commented the repos in and run apt update && apt upgrade.

you was faster :smiley: , Ill do that now :slight_smile:

unfortunatily it doesnt work, after update and upgrade. Im trying to start forman I get same above errors in journalct.

when I try to run bundler:

bundler
Could not locate Gemfile

Can you post the output of apt policy foreman once more? And an ls -alh /usr/share/foreman?

1 Like
apt policy foreman
foreman:
  Installed: 2.5.4-2
  Candidate: 2.5.4-2
  Version table:
 *** 2.5.4-2 500
        500 http://deb.theforeman.org focal/2.5 amd64 Packages
        100 /var/lib/dpkg/status
     2.5.4-1 500
        500 http://deb.theforeman.org focal/2.5 amd64 Packages
     2.5.3-1 500
        500 http://deb.theforeman.org focal/2.5 amd64 Packages
     2.5.2-1 500
        500 http://deb.theforeman.org focal/2.5 amd64 Packages
     2.5.1-1 500
        500 http://deb.theforeman.org focal/2.5 amd64 Packages
     2.5.0-1 500
        500 http://deb.theforeman.org focal/2.5 amd64 Packages
     2.5.0~rc3-1 500
        500 http://deb.theforeman.org focal/2.5 amd64 Packages
     2.5.0~rc2-1 500
        500 http://deb.theforeman.org focal/2.5 amd64 Packages
     2.5.0~rc1-1 500
        500 http://deb.theforeman.org focal/2.5 amd64 Packages

ls -alh /usr/share/foreman
total 84K
drwxr-xr-x  13 foreman foreman 4.0K Mar 30 10:58 .
drwxr-xr-x 146 root    root    4.0K Mar 29 19:51 ..
drwxr-xr-x  15 foreman foreman 4.0K Sep  2  2021 app
drwxr-xr-x   2 foreman foreman 4.0K Mar 29 13:51 bin
drwxr-xr-x   2 foreman foreman 4.0K Sep  2  2021 .bundle
drwxr-xr-x   2 foreman foreman 4.0K Mar 29 13:51 bundler.d
drwxr-xr-x   7 foreman foreman 4.0K Mar 29 13:51 config
-rw-r--r--   1 foreman foreman  383 Oct 19 14:36 config.ru
lrwxrwxrwx   1 foreman foreman   19 Aug 27  2021 db -> /var/lib/foreman/db
drwxr-xr-x   3 foreman foreman 4.0K Mar 29 13:51 extras
-rwxr-xr-x   1 foreman foreman 1.3K Oct 20 09:54 foreman-plugin.mk
-rw-r--r--   1 foreman foreman 1.9K Oct 20 09:54 Gemfile
-rw-r--r--   1 foreman foreman 8.6K Mar 29 13:53 Gemfile.lock
drwxr-xr-x   7 foreman foreman 4.0K Mar 29 13:51 lib
drwxr-xr-x  20 foreman foreman 4.0K Mar 29 13:51 locale
lrwxrwxrwx   1 foreman foreman   16 Aug 27  2021 log -> /var/log/foreman
lrwxrwxrwx   1 foreman foreman   23 Aug 27  2021 public -> /var/lib/foreman/public
-rw-r--r--   1 foreman foreman  198 Oct 19 14:36 Rakefile
drwxr-xr-x   5 foreman foreman 4.0K Mar 29 13:51 script
drwx------   2 foreman foreman 4.0K Aug 27  2021 .ssh
lrwxrwxrwx   1 foreman foreman   18 Aug 27  2021 tmp -> /var/cache/foreman
drwxr-xr-x   5 foreman foreman 4.0K Sep  2  2021 vendor
-rw-r--r--   1 foreman foreman    6 Oct 19 14:36 VERSION

The error should be different now tho, as on focal we use /usr/bin/bundle2.7 not /usr/bin/bundle. Can you paste the exact error from after the upgrade?

here is the error:

 systemctl status foreman
● foreman.service - Foreman
     Loaded: loaded (/lib/systemd/system/foreman.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/foreman.service.d
             └─installer.conf
     Active: failed (Result: exit-code) since Wed 2022-03-30 11:19:57 CEST; 6s ago
TriggeredBy: ● foreman.socket
       Docs: https://theforeman.org
    Process: 11419 ExecStart=/usr/bin/bundle exec --keep-file-descriptors /usr/share/foreman/bin/rails server --environment $FOREMAN_ENV (code=exited, status=1/FAILURE)
   Main PID: 11419 (code=exited, status=1/FAILURE)

Mar 30 11:19:57 atlas79 systemd[1]: Starting Foreman...
Mar 30 11:19:57 atlas79 foreman[11419]: /usr/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /usr/share/foreman/Gemfile.lock. (Gem::GemNotFoundException)
Mar 30 11:19:57 atlas79 foreman[11419]: To update to the latest version installed on your system, run `bundle update --bundler`.
Mar 30 11:19:57 atlas79 foreman[11419]: To install the missing version, run `gem install bundler:1.16.1`
Mar 30 11:19:57 atlas79 foreman[11419]:         from /usr/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
Mar 30 11:19:57 atlas79 foreman[11419]:         from /usr/bin/bundle:23:in `<main>'
Mar 30 11:19:57 atlas79 systemd[1]: foreman.service: Main process exited, code=exited, status=1/FAILURE
Mar 30 11:19:57 atlas79 systemd[1]: foreman.service: Failed with result 'exit-code'.
Mar 30 11:19:57 atlas79 systemd[1]: Failed to start Foreman.


when I run bundle update --bundler

 bundle update --bundler
Could not locate Gemfile

@evgeni after install

gem install bundler:1.16.1
systemctl status foreman
● foreman.service - Foreman
     Loaded: loaded (/lib/systemd/system/foreman.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/foreman.service.d
             └─installer.conf
     Active: failed (Result: exit-code) since Wed 2022-03-30 11:24:05 CEST; 2s ago
TriggeredBy: ● foreman.socket
       Docs: https://theforeman.org
    Process: 11568 ExecStart=/usr/bin/bundle exec --keep-file-descriptors /usr/share/foreman/bin/rails server --environment $FOREMAN_ENV (code=exited, status=1/FAILURE)
   Main PID: 11568 (code=exited, status=1/FAILURE)

Mar 30 11:24:05 atlas79 foreman[11568]:         from /var/lib/gems/2.7.0/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs'
Mar 30 11:24:05 atlas79 foreman[11568]:         from /var/lib/gems/2.7.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method'
Mar 30 11:24:05 atlas79 foreman[11568]:         from /var/lib/gems/2.7.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup'
Mar 30 11:24:05 atlas79 foreman[11568]:         from /var/lib/gems/2.7.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
Mar 30 11:24:05 atlas79 foreman[11568]:         from /var/lib/gems/2.7.0/gems/bundler-1.16.1/lib/bundler/setup.rb:20:in `<top (required)>'
Mar 30 11:24:05 atlas79 foreman[11568]:         from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
Mar 30 11:24:05 atlas79 foreman[11568]:         from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
Mar 30 11:24:05 atlas79 systemd[1]: foreman.service: Main process exited, code=exited, status=1/FAILURE
Mar 30 11:24:05 atlas79 systemd[1]: foreman.service: Failed with result 'exit-code'.
Mar 30 11:24:05 atlas79 systemd[1]: Failed to start Foreman

Please don’t run gem install, this will break your system.

oh ok thanks

Once you have cleaned this up, can you please run DEBUG=1 /var/lib/dpkg/info/foreman.postinst and post all output here please?

it works now! I could not post the output because I run the command in “screen”, after it finish I start the foreman and it works!

Should I run the command again and save the output to file ?

No, on a new run the output will be different.

If it works, cool.

For some reason, the package upgrade didn’t trigger a run of this script (but it should).

1 Like

you are right, but I will go to backup and do that again in next days, if you want I can do that next time ?

maybe if I send you the output you can fix that in next versions

And thank you so much @evgeni