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

segfault requiring 'mysql2' gem on bionic #7851

mmiller1 opened this Issue Nov 1, 2018 · 4 comments


None yet
3 participants

mmiller1 commented Nov 1, 2018


When attempting to install and require the mysql2 gem for use in a chef recipe, a segmentation fault occurs.

Chef Version

Chef: 14.6.47

Platform Version

Linux 4.15.0-1018-gcp #19-Ubuntu SMP Thu Aug 16 13:38:55 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Replication Case

I reproduced the issue easily using chef-shell & the embedded gem binaries:

/opt/chef/embedded/bin/gem install mysql2
chef-shell -z
> require 'mysql2'
# observe segfault

Client Output

See gist above

I worked around this issue by replacing the libssl & libcrypto libraries with the versions shipped with ubuntu

mv /opt/chef/embedded/lib/ /opt/chef/embedded/lib/
ln -s /usr/lib/x86_64-linux-gnu/ /opt/chef/embedded/lib/
mv /opt/chef/embedded/lib/ /opt/chef/embedded/lib/
ln -s /usr/lib/x86_64-linux-gnu/ /opt/chef/embedded/lib/
/opt/chef/embedded/bin/gem uninstall mysql2
/opt/chef/embedded/bin/gem install mysql2

This comment has been minimized.

wdeviers commented Nov 1, 2018

To add: if you "require 'mysql2'" from inside the IRB shipped with Chef, everything works as expected.


This comment has been minimized.


lamont-granquist commented Nov 2, 2018

/usr/lib/x86_64-linux-gnu/ [0x7f3666ddc708]
/lib/x86_64-linux-gnu/ [0x7f3682d6f827]
/usr/lib/x86_64-linux-gnu/ [0x7f3666ae2839]
/usr/lib/x86_64-linux-gnu/ [0x7f3666ddc8eb]

so i have no idea why this works with the irb shipped inside of chef but you're linking against the libssl in your system, not the one from the openssl that is shipped in embedded which ruby is linked against.

in general in order to do this you need to install the mysql libs into embedded/lib linked against the underlying embedded libs first. then you can install the gem against that mysql library.

that is an old RFC which has never been implemented in order to do that for everyone in omnibus-chef. nokogiri/libxml2/libxslt got done, but pg + mysql never got done.

probably going to wind up closing this because its not a bug in chef-client itself, its just a larger architectural issue inherent to omnibus builds.


This comment has been minimized.

wdeviers commented Nov 6, 2018

I don't want to put words into your mouth, but does that imply we should stop using the omnibus installer on 18.04?


This comment has been minimized.


lamont-granquist commented Nov 7, 2018

no, that'd be worse.

ideally there would be a cookbook that would install it correctly, but looking around the mysql_chef_gem/mysql_chef_gem2 cookbooks it doesn't seem like i can find one that does the necessary magic to correctly install the mysql libs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment