Currently having a load error when requiring guestfs require 'guestfs' LoadError: cannot load such file -- _guestfs Anyone that encountered this?
On Thu, Mar 06, 2025 at 12:34:43PM -0000, DJ B wrote:
Currently having a load error when requiring guestfs
require 'guestfs'
LoadError: cannot load such file -- _guestfs
Anyone that encountered this?
Not much information here. How did you obtain libguestfs, what version, how are you running the Ruby program, etc etc? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Hi! I installed libguestfs using apt-get through the dockerfile currently installed: libguestfs-tools 1:1.36.13-1ubuntu3 ruby version: ruby 2.3.8p459 at first, the file was not in the load path so I added where the file guestfs.rb is at, but then it had the error inside guestfs.rb LoadError: cannot load such file -- _guestfs Thanks,
On Mon, Mar 10, 2025 at 05:01:35AM -0000, DJ B wrote:
Hi! I installed libguestfs using apt-get through the dockerfile
currently installed: libguestfs-tools 1:1.36.13-1ubuntu3 ruby version: ruby 2.3.8p459
at first, the file was not in the load path so I added where the file guestfs.rb is at, but then it had the error inside guestfs.rb LoadError: cannot load such file -- _guestfs
I don't exactly know why it can't find it. It's likely to be a packaging problem with Ubuntu. The file it's looking for is called something like '/usr/lib64/ruby/vendor_ruby/_guestfs.so' (perhaps with a different path). If you can find that file, you could set $RUBYLIB to point to the directory. In Fedora it works fine, after installing the ruby-libguestfs package, without any need to set environment variables: $ irb irb(main):001> require 'guestfs' => true irb(main):002> g = Guestfs::Guestfs.new() => #<Guestfs::Guestfs:0x00007f217ca65550> Also if you build from source you can use the ./run script which sets up the environment variables correctly for Ruby: https://github.com/libguestfs/libguestfs/blob/01909c51ff54c7f3f31c566f6cc3a3... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
I found a file "_guestfs.so" inside /var/lib/docker/overlay2. Looks like this is docker related as I'm installing it through a dockerfile
On Mon, Mar 10, 2025 at 04:13:28PM -0000, DJ B wrote:
I found a file "_guestfs.so" inside /var/lib/docker/overlay2. Looks like this is docker related as I'm installing it through a dockerfile
It's a weird location for it, but it seems like that would be the compiled part of the Ruby bindings. Try setting RUBYLIB to point to that directory and see what happens? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
As I investigate further by sudoing inside the docker container, I've found the file under '/usr/lib/x86_64-linux-gnu' and was able to overcome the cannot find error. I got LoadError: incompatible library version now, what version of libguestfs would be compatible with the ruby version I'm running? Thanks
I retried my setup: apt-get install libguestfs-tools -y Couldn't find the guestfs.rb and _guestfs.so files. Figured out the files were from ruby-guestfs apt-get install ruby-guestfs Was able to find those files, added it in the load path require "guestfs"
LoadError: incompatible library version - /usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/2.5.0/_guestfs.so
On Tue, Mar 11, 2025 at 07:05:57AM -0000, DJ B wrote:
I retried my setup:
apt-get install libguestfs-tools -y
Couldn't find the guestfs.rb and _guestfs.so files. Figured out the files were from ruby-guestfs
apt-get install ruby-guestfs
Was able to find those files, added it in the load path
require "guestfs"
LoadError: incompatible library version - /usr/lib/x86_64-linux-gnu/ruby/vendor_ruby/2.5.0/_guestfs.so
"LoadError: incompatible library version" is a Ruby error. It means the version of the Ruby interpreter is incompatible / not the same as the version for which the extension was compiled. See: https://github.com/ruby/ruby/blob/47c3ae6962900434b6ffd486decd639b76f3d54d/d... Again, this is likely because of some packaging problem in Ubuntu, or some docker / container problem. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Looks like the ruby bindings does need a ruby version >= 2.5.0, and I was using 2.3.8p
participants (2)
-
DJ B -
Richard W.M. Jones