Vagrant failing to start: error while loading shared libraries: libruby.so.2.4:

Hello there, I’ve run into an issue with Vagrant where it does not start and prints the following error:

➜  ~ vagrant
ruby: error while loading shared libraries: libruby.so.2.4: cannot open shared object file: No such file or directory

Not sure what additional information to provide. So please feel free to ask and if possible provide guidance regarding how to gather the required information

Thanks beforehand!
Dippy

❯ pacman -Fx libruby.so
extra/ruby 2.7.1-3
    usr/lib/libruby.so
    usr/lib/libruby.so.2.7
    usr/lib/libruby.so.2.7.1
community/ruby2.6 2.6.6-1
    opt/ruby2.6/lib/libruby.so
    opt/ruby2.6/lib/libruby.so.2.6
    opt/ruby2.6/lib/libruby.so.2.6.6
    usr/lib/libruby.so.2.6

That’s an older library, please make sure you’re up to date:

sudo pacman-mirrors -f5 && sudo pacman -Syyu

Thanks Yochanan, you are correct about the dependency being out of date. Currently my system is fully up to date, but seems like the “vagrant” package has this requirement. Would you advice downgrading ruby for the support of vagrant package, or should I report this to the Packager and the archlinux distro for this bug?

BR,
Dippy

I just installed vagrant and cannot reproduce the issue. It’s something on your end, but what it is I’m not sure.

What version of vagrant do you have installed?

pacman -Qi vagrant will tell you. If it’s lower than 2.2.10-2, you are having mirror issues and should run:

sudo pacman-mirrors -f5 && sudo pacman -Syyu

Hey Strit, here is the output for the version. It is the same as mentioned, last updated 03.09.2020

Name : vagrant
Version : 2.2.10-2
Description : Build and distribute virtualized development environments
Architecture : x86_64
URL : https://vagrantup.com
Licenses : MIT
Groups : None
Provides : None
Depends On : curl libarchive libssh2 libxml2 libxslt rsync ruby xz perl
Optional Deps : None
Required By : None
Optional For : None
Conflicts With : vagrant-substrate
Replaces : vagrant-substrate
Installed Size : 27,39 MiB
Packager : Jonathan Steel jsteel@archlinux.org
Build Date : Thu 03 Sep 2020 09:46:53 PM EEST
Install Date : Wed 23 Sep 2020 06:27:34 PM EEST
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature

Please run

which vagrant

and

/usr/bin/vagrant -h
➜  ~ which vagrant
/usr/bin/vagrant
➜  ~ /usr/bin/vagrant -h         
ruby: error while loading shared libraries: libruby.so.2.4: cannot open shared object file: No such file or directory

P.S. tried reinstalling ruby and removing cached versions of both. Did not fix the issue at hand.
Currently running the following Kernel, as I am not sure if it maybe related to it, since VirtualBox has different setups based on that version:
Kernel: 5.4.64-1

 ~ uname -a
Linux BlackTemple 5.4.64-1-MANJARO #1 SMP PREEMPT Wed Sep 9 18:26:19 UTC 2020 x86_64 GNU/Linux

I may attempt to rollback to previous stable version, to check if this fixes the issue

UPDATE

Kernel 4.19.144-1 (LTS)
Reinstall of vagrant - still no change in the error message

Maybe it is a ruby problem. Does your ruby work?

ruby -e  "puts 'Hello, world!'"

Ruby is working as expected:

ruby -e  "puts 'Hello, world!'"
Hello, world!

Though as previously discussed with @Yochanan, the ruby version in use currently is 2.7.1-3

 ~ pacman -Fx libruby.so
extra/ruby 2.7.1-3 [installed]
    usr/lib/libruby.so
    usr/lib/libruby.so.2.7
    usr/lib/libruby.so.2.7.1
community/ruby2.6 2.6.6-1
    opt/ruby2.6/lib/libruby.so
    opt/ruby2.6/lib/libruby.so.2.6
    opt/ruby2.6/lib/libruby.so.2.6.6
    usr/lib/libruby.so.2.6

Not sure if I can or need ot rollback ruby to previous versions, but as commented by @Yochanan:

I just installed vagrant and cannot reproduce the issue. It’s something on your end, but what it is I’m not sure.

vagrant (2.2.10-2) also works on my system without a problem.

I noticed that /usr/bin/vagrant is just a link to /opt/vagrant/bin/vagrant and most files are installed in /opt/vagrant/

Do you use any plugins or did you use a very special config in ~/.vagrant.d

Also does it happens with a different user?

No plugins installed.
No special configs of any kind

Just tested it with a different user. Sadly same error message :frowning:
Sorry that I don’t bring any good news…

Though I think I managed to fix it. Just need further testing, that will probably do tomorrow or at last this weeked.

I checked the install location for the ruby libraries, where the current libruby.so resides /usr/lib/libruby.so, which is actually a link:

ll /usr/lib/libruby.so    
lrwxrwxrwx 1 root root 16 Aug 22 01:16 /usr/lib/libruby.so -> libruby.so.2.7.1

So what I did is trick vagrant into thinking he is using the “older version” via making a symlink to the current version of libruby.so

sudo ln -s /usr/lib/libruby.so /usr/lib/libruby.so.2.4

Ad the result is:

ll /usr/lib/libruby.so.2.4
lrwxrwxrwx 1 root root 19 Sep 23 23:14 /usr/lib/libruby.so.2.4 -> /usr/lib/libruby.so

This will probably be some kind of temporal fix, as once rubylib updates it’s major version, my vagrant my start breaking up due to deprecated methods etc…

I will keep posted any future changes that may arise on this. But as of today, it has been “patched/fixed”

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.