fpm is broken on Alpine 3.8

Created on 31 Jul 2018  路  4Comments  路  Source: jordansissel/fpm

Upgrading to 3.8:

https://github.com/jordansissel/fpm/blob/cad736ee6c952f26540d31bf7b23022d246cf959/Dockerfile#L6

leads to errors:

/ # fpm
Traceback (most recent call last):
        12: from /usr/bin/fpm:23:in `<main>'
        11: from /usr/bin/fpm:23:in `load'
        10: from /usr/lib/ruby/gems/2.5.0/gems/fpm-1.10.2/bin/fpm:4:in `<top (required)>'
         9: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
         8: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
         7: from /usr/lib/ruby/gems/2.5.0/gems/fpm-1.10.2/lib/fpm.rb:13:in `<top (required)>'
         6: from /usr/lib/ruby/gems/2.5.0/gems/backports-3.11.3/lib/backports/std_lib.rb:9:in `require_with_backports'
         5: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
         4: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
         3: from /usr/lib/ruby/gems/2.5.0/gems/fpm-1.10.2/lib/fpm/package/puppet.rb:5:in `<top (required)>'
         2: from /usr/lib/ruby/gems/2.5.0/gems/backports-3.11.3/lib/backports/std_lib.rb:9:in `require_with_backports'
         1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- etc (LoadError)

I am not sure how to interpret the stack trace or what the significance of -- etc is.

Most helpful comment

Another potential solution seem to be to install the ruby-etc Alpine package in the Dockerfile.

I suppose the fact that a separate Alpine package exists suggests that this is not an Alpine bug but rather an intentional exclusion.

So if you ever upgrade the Dockerfile to 3.8, that could be the way to go.

All 4 comments

Explanation of the error is following:

  • puppet.rb module /usr/lib/ruby/gems/2.5.0/gems/fpm-1.10.2/lib/fpm/package/puppet.rb tries to load etc module: require "etc".
  • etc gem should be part of the default ruby gems since ruby 2.5: https://stdgems.org/
  • however, ruby 2.5.1 shipped with alpine 3.8 does not provide the etc gem:
$ docker run -it --rm alpine ash
/ # apk add ruby
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/9) Installing ca-certificates (20171114-r3)
(2/9) Installing gmp (6.1.2-r1)
(3/9) Installing ncurses-terminfo-base (6.1_p20180818-r1)
(4/9) Installing ncurses-terminfo (6.1_p20180818-r1)
(5/9) Installing ncurses-libs (6.1_p20180818-r1)
(6/9) Installing readline (7.0.003-r0)
(7/9) Installing yaml (0.1.7-r0)
(8/9) Installing ruby-libs (2.5.1-r2)
(9/9) Installing ruby (2.5.1-r2)
Executing busybox-1.28.4-r1.trigger
Executing ca-certificates-20171114-r3.trigger
OK: 25 MiB in 22 packages
/ # ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-musl]
/ # gem list

*** LOCAL GEMS ***

cmath (default: 1.0.0)
csv (default: 1.0.0)
date (default: 1.0.0)
fcntl (default: 1.0.0)
fileutils (default: 1.0.2)
ipaddr (default: 1.2.0)
openssl (default: 2.1.0)
psych (default: 3.0.2)
scanf (default: 1.0.0)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
zlib (default: 1.0.0)
  • puppet.rb expects this gems is installed, but it's not

Not sure if this is an alpine's ruby packaging bug (missing default gems) or the wrong assumption of the puppet.rb that all the distributions have etc gem installed as part of the ruby 2.5..

I'd love to help fix this, but I'm not well versed in Alpine's behaviors. Is this a bug in Alpine's ruby package?

Alternately, we could try loading etc and if it fails, we can disable whatever requires it in fpm -- this would at least let you do most of fpm's work in the absence of etc library.

Another potential solution seem to be to install the ruby-etc Alpine package in the Dockerfile.

I suppose the fact that a separate Alpine package exists suggests that this is not an Alpine bug but rather an intentional exclusion.

So if you ever upgrade the Dockerfile to 3.8, that could be the way to go.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FlorinAndrei picture FlorinAndrei  路  7Comments

hellosputnik picture hellosputnik  路  7Comments

weakcamel picture weakcamel  路  6Comments

jameshfisher picture jameshfisher  路  7Comments

jean-christophe-manciot picture jean-christophe-manciot  路  4Comments