Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fpm install fails on RHEL8 Ruby 2.5.0 due to dotenv #2048

Open
asgeirn opened this issue Feb 14, 2024 · 11 comments
Open

fpm install fails on RHEL8 Ruby 2.5.0 due to dotenv #2048

asgeirn opened this issue Feb 14, 2024 · 11 comments

Comments

@asgeirn
Copy link

asgeirn commented Feb 14, 2024

RUN gem install --no-document --minimal-deps dotenv:2.8.1 fpm
38.64 ERROR:  Error installing fpm:
38.64   dotenv requires Ruby version >= 3.0. The current ruby version is 2.5.0.
38.78 Successfully installed dotenv-2.8.1
38.78 Successfully installed rexml-3.2.6
38.78 Successfully installed stud-0.0.23
38.78 1 gem installed
@Liukke
Copy link

Liukke commented Feb 14, 2024

I'm seeing the same problem as well.

We have RHEL7 systems running system ruby as 2.6. These are now failing to install fpm:

gem install -N fpm
ERROR:  Error installing fpm:
               The last version of dotenv (>= 0) to support your Ruby & RubyGems was 2.8.1. Try installing it with `gem install dotenv -v 2.8.1` and then running the current command again
               dotenv requires Ruby version >= 3.0. The current ruby version is 2.6.10.210.

Trying to pin the version of dotenv like the error suggest doesn't work. If I manually install dotenv 2.8.1 as the error suggest and try to install fpm again, it still fails:

gem install -N dotenv -v 2.8.1
Fetching dotenv-2.8.1.gem
Successfully installed dotenv-2.8.1
1 gem installed

gem install -N fpm
ERROR:  Error installing fpm:
	dotenv requires Ruby version >= 3.0. The current ruby version is 2.6.10.210.

We also have RHEL8 systems running system ruby 2.7 and this is happening on those as well:

gem install -N fpm
ERROR:  Error installing fpm:
	dotenv requires Ruby version >= 3.0. The current ruby version is 2.7.8.225.

It looks like fpm is making dotenv 3.0.0 a hard requirement for some reason:

gem install --explain -N fpm
Gems to install:
  rexml-3.2.6
  stud-0.0.23
  dotenv-3.0.0
  insist-1.0.0
  mustache-0.99.8
  clamp-1.0.1
  cabin-0.9.0
  pleaserun-0.0.32
  arr-pm-0.0.12
  backports-3.24.1
  fpm-1.15.1

@Elvrarin
Copy link

fpm has a dependency on pleaserun. pleaserun is making the newest version of dotenv a hard requirement.

Relevant Issue from pleaserun
jordansissel/pleaserun#153

@asgeirn
Copy link
Author

asgeirn commented Feb 16, 2024

Perhaps pleaserun could be an optional dependency for fpm?

@alucardgt86
Copy link

This also an issue in amazon linux 2 as ruby is 2.6 so would be nice to have dotenv version as 2.8.1 and up.

@DmitryGrayscale
Copy link

DmitryGrayscale commented Feb 23, 2024

fpm has a dependency on pleaserun. pleaserun is making the newest version of dotenv a hard requirement.

causing problems since 2022 as far as I can see..

@asgeirn
Copy link
Author

asgeirn commented Feb 29, 2024

For those interested, I've created forks of pleaserun and fpm to lock the dotenv version to one compatible with Ruby 2.

How to use:

  1. Create legacy GitHub personal access token with packages:read permission
  2. Install fpm using the following:
gem sources --add https://${USERNAME}:${TOKEN}@rubygems.pkg.github.com/asgeirn/
gem install --no-document fpm --version "1.15.1042"

@jordansissel
Copy link
Owner

@asgeirn thanks for providing a workaround!

I’ll look into pleaserun’s dotenv dependency a bit more and see about removing that dependency soon.

@aschlei
Copy link

aschlei commented Mar 1, 2024

Ran into this as well; the behavior is strange as it almost seems like a bug in ruby gems. I can get fpm to install fairly easily on CentOS 7 (ruby 2.0, gem 2.0.14.1) with:

gem install dotenv -v 2.8.1 -N
gem install rexml -v 3.2.4 -N
gem install backports -v 3.21.0 -N
gem install fpm -N

But on Rocky Linux 8 (ruby 2.5, gem 2.7.6.3), even if I install dotenv first, it still tries to install the latest, even if the installed dotenv meets the requirements of pleaserun:

# gem install dotenv -v 2.8.1 -N
Fetching: dotenv-2.8.1.gem (100%)
Successfully installed dotenv-2.8.1
1 gem installed
# gem install fpm -N
Fetching: rexml-3.2.6.gem (100%)
Successfully installed rexml-3.2.6
Fetching: stud-0.0.23.gem (100%)
Successfully installed stud-0.0.23
Fetching: dotenv-3.1.0.gem (100%)
ERROR:  Error installing fpm:
        dotenv requires Ruby version >= 3.0. The current ruby version is 2.5.0.

Even with flags that I thought should explicitly tell it not to upgrade deps that already meet the requirements (though I've never had to use these in the past; that seems to be the default behavior:

# gem install fpm -N --conservative --minimal-deps
ERROR:  Error installing fpm:
        dotenv requires Ruby version >= 3.0. The current ruby version is 2.5.0.

@aschlei
Copy link

aschlei commented Mar 1, 2024

My workaround for installing on EL 8; basically just explicitly install the dependencies of pleaserun and fpm and then install those without any deps:

gem install dotenv -v 2.8.1 -N
gem install clamp -v 1.0.1 -N
gem install mustache -v 0.99.8 -N
gem install cabin insist stud arr-pm backports rexml -N
gem install pleaserun --ignore-dependencies -N
gem install fpm --ignore-dependencies -N

lfittl added a commit to pganalyze/collector that referenced this issue Mar 6, 2024
This contains two different fixes:

- For Debian, pin dotenv version to last one that supports Ruby 2.7
  This is an interim fix until we can upgrade the Ruby version used for
  fpm in the build scripts. That is slightly complicated due to the base
  OS being intentionally old (to keep an older glibc base version).

- For CentOS, use Ruby 3.0 to avoid problems with Ruby 2.7 and fpm
  jordansissel/fpm#2048 (comment)
keiko713 pushed a commit to pganalyze/collector that referenced this issue Mar 6, 2024
This contains two different fixes:

- For Debian, pin dotenv version to last one that supports Ruby 2.7
  This is an interim fix until we can upgrade the Ruby version used for
  fpm in the build scripts. That is slightly complicated due to the base
  OS being intentionally old (to keep an older glibc base version).

- For CentOS, use Ruby 3.0 to avoid problems with Ruby 2.7 and fpm
  jordansissel/fpm#2048 (comment)
lfittl added a commit to pganalyze/collector that referenced this issue Mar 13, 2024
This contains two different fixes:

- For Debian, pin dotenv version to last one that supports Ruby 2.7
  This is an interim fix until we can upgrade the Ruby version used for
  fpm in the build scripts. That is slightly complicated due to the base
  OS being intentionally old (to keep an older glibc base version).

- For CentOS, use Ruby 3.0 to avoid problems with Ruby 2.7 and fpm
  jordansissel/fpm#2048 (comment)
@ninogresenz
Copy link

I got the same error, and I was able to workaround it by using more recent Ubuntu version:

# Base container is used for various release and test things
FROM ubuntu:22.04 as minimal-base

Also ubuntu:24:04 is working fine.

@xanarin
Copy link

xanarin commented Oct 31, 2024

Another workaround for Rocky 8 (and most likely all RHEL 8 variants) is to specify a gems.rb file with the version of dotenv pinned. This forces gem install to use the correct version of dotenv, but allows all other dependencies of fpm to be resolved automatically. This has the advantage of eliminating --ignore-dependencies and any potential breakage that may occur from that.

You can install fpm by running gem install --no-document --file gems.rb with the following gems.rb file:

source 'https://rubygems.org'

gem 'dotenv', '= 2.8.1'
gem 'fpm', '= 1.15.1'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants