adrahon / vagrant-kvm

This project is dead, please use vagrant-libvirt instead! A Vagrant 1.4+ plugin that adds a KVM provider to Vagrant, allowing Vagrant to control and provision KVM/QEMU VM.
MIT License
366 stars 60 forks source link

Vagrant can't bring up a kvm box on Arch with vagrant1.7.[1,2] #274

Closed skinney6 closed 9 years ago

skinney6 commented 9 years ago

I can't bring up a kvm box anymore. I believe this broke when Arch moved from ruby (2.1.5-1 -> 2.2.0-1). usr/lib/libruby.so.2.2 is in the file list arch ruby 2.2.0-1 file list.

error reads

/home/user/.vagrant.d/gems/gems/ruby-libvirt-0.5.2/lib/libvirt.rb:11:in `require': libruby.so.2.1: cannot open shared object file: No such file or directory - /home/user/.vagrant.d/gems/gems/ruby-libvirt-0.5.2/lib/_libvirt.so (LoadError)

I'm new at this. Is this a distro, vagrant, or a vagrant-kvm problem? Or is it a me problem? haha Thanks!

tatsuya6502 commented 9 years ago

Sorry for not getting back to you sooner. I didn't have Arch Linux installation anymore, so I just went through a fresh installation process of Arch Linux, Vagrant and vagrant-kvm.

I can't reproduce the problem even though I only have /usr/lib/libruby.so.2.2. (I attached the log at the bottom of this message.) Perhaps, you need to reinstall vagrant-kvm so that ruby-libvirt gem in your $HOME/.vagrant.d/gems/gems/ will be depends on the right library? Can you please try that?

$ vagrant plugin uninstall vagrant-kvm
$ sudo mv /opt/vagrant/embedded/lib/libcurl.so{,.backup}
$ sudo mv /opt/vagrant/embedded/lib/libcurl.so.4{,.backup}
$ sudo mv /opt/vagrant/embedded/lib/libcurl.so.4.3.0{,.backup}
$ sudo mv /opt/vagrant/embedded/lib/pkgconfig/libcurl.pc{,.backup}
$ CONFIGURE_ARGS="with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib" vagrant plugin install vagrant-kvm
Installing the 'vagrant-kvm' plugin. This can take a few minutes...
Installed the plugin 'vagrant-kvm (0.1.9)'!
$ vagrant plugin list        
vagrant-kvm (0.1.9)
$ sudo mv /opt/vagrant/embedded/lib/libcurl.so{.backup,}
$ sudo mv /opt/vagrant/embedded/lib/libcurl.so.4{.backup,}
$ sudo mv /opt/vagrant/embedded/lib/libcurl.so.4.3.0{.backup,}
$ sudo mv /opt/vagrant/embedded/lib/pkgconfig/libcurl.pc{.backup,}

Here is the log from my machine.

[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% uname -a
Linux mini-arch 3.17.6-1-ARCH #1 SMP PREEMPT Sun Dec 7 23:43:32 UTC 2014 x86_64 GNU/Linux
[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% vagrant -v
Vagrant 1.7.2
[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% vagrant plugin list
vagrant-kvm (0.1.9)
[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% ls -l /usr/lib/libruby*
lrwxrwxrwx 1 root root      16 Dec 25 21:22 /usr/lib/libruby.so -> libruby.so.2.2.0
lrwxrwxrwx 1 root root      16 Dec 25 21:22 /usr/lib/libruby.so.2.2 -> libruby.so.2.2.0
-rwxr-xr-x 1 root root 2541112 Dec 25 21:22 /usr/lib/libruby.so.2.2.0
-rw-r--r-- 1 root root 4420402 Dec 25 21:22 /usr/lib/libruby-static.a
[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% ls -l /home/tatsuya/.vagrant.d/gems/gems/ 
total 8
drwxr-xr-x 5 tatsuya users 4096 Jan 10 08:31 net-ssh-2.9.2
drwxr-xr-x 5 tatsuya users  109 Jan 10 08:31 ruby-libvirt-0.5.2
drwxr-xr-x 8 tatsuya users 4096 Jan 10 08:32 vagrant-kvm-0.1.9
[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% sudo pacman -Syu
[sudo] password for tatsuya: 
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
:: Starting full system upgrade...
 there is nothing to do
[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% cat Vagrantfile 
Vagrant.configure('2') do |config|
  config.vm.hostname = 'arch64'
  config.vm.box = 'arch64'
  config.vm.box_url = 'https://vagrant-kvm-boxes-si.s3.amazonaws.com/arch-linux-amd64-kvm-20140412.box'

  config.vm.provider :kvm do |kvm, override|
    # kvm.gui = true
    kvm.memory_size = '1GB'
    kvm.image_mode = 'clone'
  end

end
[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% vagrant status
Current machine states:

default                   not_created (kvm)
...

[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% vagrant up
Bringing machine 'default' up with 'kvm' provider...
==> default: Importing base box 'arch64'...
==> default: Assigning a new mac address to the VM.
==> default: Preparing network interfaces based on configuration...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 192.168.123.31:22
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Host unreachable. Retrying...
    default: Warning: Host unreachable. Retrying...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if its present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Creating shared folders metadata...
==> default: Setting hostname...
==> default: mounting p9 share in guest
[mini-arch] /home/tatsuya/vagrant-kvm/arch-test% vagrant ssh
[vagrant@arch64 ~]$ cat /etc/vagrant_box_build_time 
Sat Apr 12 18:11:25 UTC 2014
[vagrant@arch64 ~]$ uname -a
Linux arch64 3.14.0-4-ARCH #1 SMP PREEMPT Wed Apr 9 21:11:25 CEST 2014 x86_64 GNU/Linux
skinney6 commented 9 years ago

Yes!

$ vagrant plugin uninstall vagrant-kvm
# rm /usr/lib/libruby.so.2.1 (removed the symlink i created earlier)
CONFIGURE_ARGS="with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib" vagrant plugin install vagrant-kvm
Installed the plugin 'vagrant-kvm (0.1.9)'!

Thank you so much!

skinney6 commented 9 years ago

Wait, I forgot to actually try and use it. Haha

$ vagrant up
Bringing machine 'vm1' up with 'kvm' provider...
/home/ /.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/driver/driver.rb:276:in `init_storage_pool': undefined method `active?' for #<Libvirt::StoragePool:0x0000000224a598> (NoMethodError)
    from /home/scott/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/init_storage_pool.rb:14:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /home/scott/.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/action/check_kvm.rb:18:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:214:in `action_raw'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:191:in `block in action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:516:in `lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
tatsuya6502 commented 9 years ago

/home/ /.vagrant.d/gems/gems/vagrant-kvm-0.1.9/lib/vagrant-kvm/driver/driver.rb:276:in init_storage_pool': undefined methodactive?' for #Libvirt::StoragePool:0x0000000224a598 (NoMethodError)

This is a known issue in vagrant-kvm on Arch Linux. Before you install vagrant-kvm, disable the embedded curl by mv command. Please follow the step-by-step instructions here: https://github.com/adrahon/vagrant-kvm/wiki/Install_on_ArchLinux#disable-the-curl-libraries-embedded-in-vagrant

skinney6 commented 9 years ago

Oh, I remember that. That did the trick. Thanks again.