dotless-de / vagrant-vbguest

A Vagrant plugin to keep your VirtualBox Guest Additions up to date
MIT License
2.88k stars 207 forks source link

Unable to install kernel-devel on CentOS #406

Closed alexgit2k closed 3 years ago

alexgit2k commented 3 years ago

Vagrant fails with No package kernel-devel-3.10.0-1127.el7.x86_64 available. when using CentOS 7. The problem is that there is no such kernel-devel-xyz for CentOS (checked 7 & 8), the package-name is just kernel-devel.

See also https://github.com/dotless-de/vagrant-vbguest/issues/351#issuecomment-540870693 and https://github.com/dotless-de/vagrant-vbguest/issues/351#issuecomment-712773555

Vagrantfile

Vagrant.require_version ">= 2.0"

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vbguest.installer_options = { allow_kernel_upgrade: true }

  config.vm.provider :virtualbox do |box|
     box.name = "test"
     box.customize ["modifyvm", :id, "--nictype1", "virtio"]
     box.customize ["modifyvm", :id, "--nictype2", "virtio"]
     box.customize ["modifyvm", :id, "--paravirtprovider", "default"]
     box.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
     box.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
     box.customize ["modifyvm", :id, "--ioapic", "on"]
  end
end
fnordfish commented 3 years ago

CentOS kernel packages are painful. Please check if one of the solutions in https://github.com/dotless-de/vagrant-vbguest/discussions/401 help.

alexgit2k commented 3 years ago

It is working for CentOS 7 with enablerepo: true, because then yum install -y kernel-devel-`uname -r` --enablerepo=C*-base --enablerepo=C*-updates works. It is not working without enablerepo (or set to false): yum install -y kernel-devel-`uname -r` does not work, like now, because the package is no longer in the base-repository.

Without the version as in pull-request #407 yum install -y kernel-devel --enablerepo=C*-base --enablerepo=C*-updates and yum install -y kernel-devel work, BUT install the latest kernel-devel-package which may not matching the running kernel. Therefore allow_kernel_upgrade: true must be used.

I will use enablerepo and I'm closing the pull-request. But there should be a note at lib/vagrant-vbguest/installers/centos.rb:install_kernel_devel if this failes to use enablerepo: true.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Tianran1998 commented 1 year ago

It's very kind of u.