After upgrading Ruby, I got the following weird error when running bundler:
/usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:96:in `gsub': invalid byte sequence in UTF-8 (ArgumentError)
<<-EOS.gsub(/^ {8}/, "")
^^^^^^^^^^^
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:96:in `serialized_exception_for'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:88:in `exception_message'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:68:in `request_issue_report_for'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:50:in `log_error'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:123:in `rescue in with_friendly_errors'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:115:in `with_friendly_errors'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/exe/bundle:29:in `<top (required)>'
from /usr/bin/bundle:9:in `load'
from /usr/bin/bundle:9:in `<main>'
<internal:/usr/lib64/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:149:in `require': linked to incompatible �,ome/xhire/.gem/ruby/3.2.0/gems/date-3.4.1/lib/date_core.so (LoadError)
from <internal:/usr/lib64/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
from /home/xhire/.gem/ruby/3.2.0/gems/date-3.4.1/lib/date.rb:4:in `<top (required)>'
from <internal:/usr/lib64/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
from <internal:/usr/lib64/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
from /home/xhire/.gem/ruby/3.2.0/gems/psych-5.2.2/lib/psych.rb:2:in `<top (required)>'
from <internal:/usr/lib64/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
from <internal:/usr/lib64/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems.rb:609:in `load_yaml'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems/package.rb:556:in `read_checksums'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems/package.rb:618:in `block (2 levels) in verify'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems/package/tar_reader.rb:23:in `new'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems/package.rb:617:in `block in verify'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems/package/file_source.rb:30:in `open'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems/package/file_source.rb:30:in `with_read_io'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems/package.rb:616:in `verify'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems/package.rb:597:in `spec'
from /usr/lib64/ruby/site_ruby/3.2.0/rubygems/installer.rb:288:in `spec'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/rubygems_gem_installer.rb:101:in `spec'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/source/rubygems.rb:186:in `install'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/installer/gem_installer.rb:54:in `install'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/installer/parallel_installer.rb:130:in `do_install'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/installer/parallel_installer.rb:121:in `block in worker_pool'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/worker.rb:62:in `apply_func'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/worker.rb:57:in `block in process_queue'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/worker.rb:54:in `loop'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/worker.rb:54:in `process_queue'
from /usr/lib64/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'
Obviously, I went on and checked all my environment variables, etc., but nothing seemed wrong. So I tried again and got the same error again, but this one line differed:
<internal:/usr/lib64/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:149:in `require': linked to incompatible ��l#p - /home/xhire/.gem/ruby/3.2.0/gems/date-3.4.1/lib/date_core.so (LoadError)
That made me suspicious, so I checked that library file:
$ ldd /home/xhire/.gem/ruby/3.2.0/gems/date-3.4.1/lib/date_core.so
linux-vdso.so.1 (0x00007ffef87e6000)
libruby31.so.3.1 => /usr/lib64/libruby31.so.3.1 (0x00007fea16b79000)
libm.so.6 => /lib64/libm.so.6 (0x00007fea16a99000)
libc.so.6 => /lib64/libc.so.6 (0x00007fea168b5000)
libz.so.1 => /usr/lib64/libz.so.1 (0x00007fea1689b000)
libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007fea167f4000)
libcrypt.so.2 => /usr/lib64/libcrypt.so.2 (0x00007fea167b9000)
/lib64/ld-linux-x86-64.so.2 (0x00007fea16f38000)
Hah, libruby31.so.3.1
! Turns out I happened to update my GEM_HOME
earlier than I switched to 3.2. Fix?
rm -rf /home/xhire/.gem/ruby/3.2.0/
;·)
Tagged with: Ruby
Written: 2025-01-04