CentOS 7: VirtualBox is complaining that the kernel module is not loaded - virtualbox

Background:
I created a sandbox VM with VirtualBox on my macOS. It correctly spins up a VM (with CentOS7 running on it) on which I can access to.
Inside this sandbox vm, I want to spin up several vms in order to test Ansible Playbooks with Kitchen CI & Vagrant, thus I installed VirtualBox by downloading it from the following link: https://download.virtualbox.org/virtualbox/5.2.8/VirtualBox-5.2-5.2.8_121009_el7-1.x86_64.rpm
After the installation I executed the command:
[david#vmkitchen-env ansible-test]# VBoxManage --version
It returned:
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (3.10.0-693.2.1.el7.x86_64) or it
failed to load. Please recompile the kernel module and install it
by
sudo /sbin/vboxconfig
You will not be able to start VMs until this problem is fixed.
5.2.8r121009
I installed the Development tools, but I keep getting the same issue.
I don't think I need to recompile any kernel module. Any idea?
Thanks in advance for your help.

So, after searching on the internet, and not just on the VirtualBox website, I found the solution, and I was right: I did not need to compile any module.
The following is the reference to the CentOS wiki page:
https://wiki.centos.org/HowTos/Virtualization/VirtualBox
In a few words, I had to install dkms and kernel-devel packages. In order to do so, I needed to install EPEL repository; but personally I prefer to install and enable the IUS repository.
The following are the set of commands that worked for me:
yum groupinstall "Development tools"
yum install https://centos7.iuscommunity.org/ius-release.rpm
yum install dkms
yum install kernel-devel
reboot
After the machine had rebooted, I was able to get VirtualBox working fine.
I verified by the command line:
[david#vmkitchen-env ansible-test]# VBoxManage --version
And it returned the correct value:
5.2.8r121009

Below steps fixed the issue for me.
1.sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-957.10.1.el7.x86_64
2.This website has the kernel module - website
wget https://linuxsoft.cern.ch/cern/centos/7/updates/x86_64/Packages/kernel-devel-3.10.0-957.10.1.el7.x86_64.rpm
4.yum localinstall kernel-devel-3.10.0-957.10.1.el7.x86_64.rpm -y
5.sudo /sbin/vboxconfig
Issue resolved

On Fedora 36, I only had to run
sudo /sbin/vboxconfig

Related

How to install the lustre client on Ubuntu nodes?

I am trying to install the lustre clients on Unbuntu 20.04 nodes I have in GCP. Im using linux kernel version 5.15.0-1021-gcp.
I'm trying to install the client with the following code:
cd /home/apps/
mkdir lustre
git clone git://git.whamcloud.com/fs/lustre-release.git
cd lustre-release
git checkout 2.15.0
sh autogen.sh
./configure --prefix=/home/apps/lustre --disable-server --enable-client ## doesnt run! Fails at ./configures with error message "error: Run make config in /lib/modules/5.15.0-1021-gcp/build"
make debs
The configure step fails with an error about running make config in /lib/modules/5.15.0-1021-gcp/build. I tried running make config in /lib/modules/5.15.0-1021-gcp/build but was asked to input some values that I was unsure of.
I also tried downloading the deb package of the client software at
https://downloads.whamcloud.com/public/lustre/lustre-2.15.0/ubuntu2004/client/lustre-client-modules-5.4.0-96-generic_2.15.0-1_amd64.deb. However this is for the wrong linux kernel and I'm not sure what env variables need to be set for this package.
Anyone know how to install the client modules for lustre on Ubuntu?
You need to have the kernel sources or kernel-devel package that exactly match the kernel that you are installing on. This should also include the .config file that describes all of the options used when building your kernel.
Alternately, you could try a pre-built package, but it isn't clear if this will install on your kernel or not.
https://build.whamcloud.com/job/lustre-b2_15/40/arch=x86_64,build_type=client,distro=ubuntu2204,ib_stack=inkernel/

Which is more preferable? Try to downgrade Ubuntu version of an EC2 server or create a new instance altogether?

I have a dilemma, I am trying to set up the Microsoft slqsrv drivers for PHP and a laravel project so that it can connect to an RDS service and do my migrations, however, the Microsoft page dictates that the supported versions for the Ubuntu Server are 18, 20 and 21. The following snippet is the exact commands for an Ubuntu server from the official Microsoft page.
if ! [[ "18.04 20.04 21.04" == *"$(lsb_release -rs)"* ]];
then
echo "Ubuntu $(lsb_release -rs) is not currently supported.";
exit;
fi
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list >
/etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
Trying to run the commands without the if statement installs "something" but it ends up with errors, moreover, the pdo_sqlsrv and sqlsrv extensions do show up in the extensions list of PHP, running the command "php -m" shows that they are indeed loaded, but if I try to run the migration it shows the alert that the OBDC driver is missing.
What makes me think this is not working is that my EC2 instance has the Ubuntu 22 version, which would make sense since the drivers are not supported at the moment and are not installed properly. The options I concluded are that either somehow downgrade my Ubuntu version from my EC2 server or create a new instance with a version that supports the sqlsrv drivers. I don't know if there's a third option for the installation to work properly in this version, but I assume the previous two are the more sensible.
My question is, is it possible or recommended to downgrade the Ubuntu version of the EC2 server? or should I create a new instance with a compatible version?
One of the main benefits of the cloud is resource provisioning speed.
It takes seconds to create a new EC2 instance, it's much easier & quicker to just create a new instance with the Ubuntu 20.04 LTS or Ubuntu 18.04 LTS AMIs available.

Unable to start VM - Minikube

I am trying to start the minikube using the minikube start command and this is the error i am getting. Even installed the latest version of virtual box but still it gives me this error.
Can someone please tell me why this is happening?
Follow the advice of the error message. Did you try installing virtualbox-dkms and the linux headers?
$ sudo apt update
$ sudo apt install virtualbox-dkms linux-headers-generic
Follow the instructions in the docs, if you aren't already: https://kubernetes.io/docs/tasks/tools/install-minikube/
First of all I would recomend you to install newest version of Minikbue (currently it is 1.5.2) and Kubectl.
Second thing check if your machine is supporting virtualization. It can bo done via command egrep -q 'vmx|svm' /proc/cpuinfo && echo yes || echo no.
If it is no you have to:
If you are running within a VM, your hypervisor does not allow nested virtualization. You will need to use the None (bare-metal) driver.
If you are running on a physical machine, ensure that your BIOS has hardware virtualization enabled.
Minikube set VirtualBox as default driver, but you can use other. Here under Hypervisor Setup you might find that you can also use KVM or None as driver for Linux OS.
Solutions:
1. As Minikube output advised, try to install
- $ sudo apt-get install virtualbox-dkms linux-headers-generic
- run $ sudo modprobe vboxdrv
- reinstall VirtualBox
2. If there is no virtualization option on your Laptop you can use Minikube with --vm-driver=none flag.
$ sudo minikube start --vm-driver=none
If you would use this option, you might need to specify --cpus=X and --memory=XXXX as default is requesting less resources.
Another think is that none driver provides limited isolation and may reduce system security and reliability. More info can be found here.
$ minikube start
๐Ÿ˜„ minikube v1.5.2 on Ubuntu 18.04
๐Ÿ”ฅ Creating virtualbox VM (CPUs=2, Memory=2000MB, Disk=20000MB)
...
$ sudo minikube start --vm-driver=none
๐Ÿ˜„ minikube v1.5.2 on Ubuntu 18.04
๐Ÿคน Running on localhost (CPUs=2, Memory=7470MB, Disk=9749MB) ...
After successfull installation, don't forget to execute mentioned commands.
โ–ช sudo mv /home/<your_user>/.kube /home/<your_user>/.minikube $HOME
โ–ช sudo chown -R $USER $HOME/.kube $HOME/.minikube

RHEL: This system is currently not set up to build kernel modules

I am trying to install virtualbox5.2 on a RHEL 7 VM When I try to rebuild kernels modules I get the following error:
[root#myserver~]# /usr/lib/virtualbox/vboxdrv.sh setup
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-693.11.1.el7.x86_64
I tried install kernet-devel and got success message
Installed:
kernel-devel.x86_64 0:3.10.0-693.21.1.el7
Complete!
But still the setup fails.
Any idea what is missing here?
sudo yum install -y "kernel-devel-$(uname -r)"
Substitute dnf on Fedora. I didn't need to do a reboot, but ymmv.
Edit for 2020:
Centos/RHEL 8 now also use dnf instead of yum. I haven't had occasion to test this on those distros, so the same YMMV disclaimer still applies.
First run in terminal: uname -r then you will get name and information about current kernel (CURRENT_KERNEL).
Now you can install with command: yum install kernel-devel-CURRENT_KERNEL
Note: replace CURRENT_KERNEL with string you get from uname -r.
The same message happened when I tried to upgrade VirtualBox 5.2.12 Guest Additions on my Kali Linux (GNU/Linux Rolling version). I fixed it by following steps:
Do apt update/upgrade to keep your system up-to-date. Do not forget to reboot the system.
Run "apt-get install linux-headers-$(uname -r)".
Run VBoxLinuxAdditions.run from terminal, error message gone and Guest Additions will be installed successfully.
Reboot system, Guest Additions works fine.
I got here looking for the same answer for CentOS 6, and the above answers worked with slight modification (so, for anyone else that lands here too)...
yum install -y kernel-devel kernel-devel-$(uname -r)
So, "yum" instead of "apt-get"
Also, some Linux use "linux-headers" instead of "kernel-devel" but the principle seems to be the same.
The kernel your were using was kernel-devel-3.10.0-693.11.1.el7.x86_64 is slightly different with the one that you installed kernel-devel.x86_64 0:3.10.0-693.21.1.el7 . In my case, there are several different version installed on my OS, and "sudo yum install kernel-devel" always install the newest one for me. Then I work it out by setting my default kernel version as same as yum installed for me. You can check the kernel you have installed on your OS by following command:
sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
Then just set the kernel version you choose to use as same as yum choose for you,by following command:(notice that the number at last is pick up from preceding command result),
sudo grub2-set-default 0
generate the grub2 config with 'gurb2-mkconfig' command, and then reboot the server.
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo reboot
Milan Rakos is right. Your installed kernel-devel must have suffix string exactly the same as the uname -r output. Besides, the logs during the vboxdrv.sh setup also shows the wanted version of the kernel-devel.
So to your case, You will run the command:sudo yum install kernel-devel-3.10.0-693.11.1.el7.x86_64
to solve this problem I ran yum update -y. I think this is the fastest way to solve it. Another solution is to configure the repos with the installation DVD, so you can install the kernel-headers of your current version of CentOS.
My History:
yum install epel-release
yum install perl gcc dkms kernel-devel kernel-headers make bzip2
yum groupinstall "Development tools"
yum update -y
reboot
After that, I mount de VBoxGuestAdditions and I ran the process
yum install kernel-devel-3.10.0-693.11.1.el7.x86_64 fixed the issue.
A little late to the party but I just ran into this problem myself and here's what I did to resolve the issue.
yum update -y
yum install -y redhat-lsb-core net-tools kernel-headers kernel-devel epel-release
yum groupinstall -y "Development Tools"
reboot
Ensure your system has been fully updated when you ran yum update -y before continuing!
Cheers

how to install virtualbox on RHEL 6 without using yum?

My company has firewall rules for yum so we can use only rpm to install the softwares on the RHEL 6 SERVER. So, I got a task to install virtualbox 5.1 on it. i used the rpm from the virtualbox website and installed it, but it failed with 2 dependencies and i installed them also. Then i got the below error.I just googled that i need some kernel-devel rpms but i dono, what to do after that and what else i need to make the virtual box running.
# virtualbox
WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (2.6.32-642.4.2.el6.x86_64) or it failed to load. Please recompile the kernel module and install it by
sudo /sbin/vboxconfig
You will not be able to start VMs until this problem is fixed.
Qt FATAL: QXcbConnection: Could not connect to display
Aborted
There will be lot of dependencies while installing rpm's. you need to check one by one and install the RPM's. Is suggest you to build local yum repository which doesnt require internet. you should use rhel 6 iso file to build local repo. And download the virtual box rpm, and try to install it with yum utility. yum will use local repo for dependency resolution.
Build repo:
1. mount DVD
[root#lh1 Packages]# cd /etc/yum.repos.d
[root#lh1 yum.repos.d]# vi dvd.repo
[root#lh1 yum.repos.d]# cat dvd.repo
[DVD_ISO]
name= Linux 6
baseurl=file:///mnt/cdrom
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
gpgcheck=1
enabled=1
[root#lh1 rpm-gpg]# yum clean all
Loaded plugins: rhnplugin
[Errno 2] No such file or directory: '/var/cache/yum/x86_64/6Server'
[root#lh1 rpm-gpg]# yum repolist
Loaded plugins: rhnplugin
This system is not registered with ULN.
ULN support will be disabled.
DVD_ISO | 3.7 kB 00:00 ...
DVD_ISO/primary_db | 3.1 MB 00:00 ...
repo id repo name status
DVD_ISO Linux 6 3,379
repolist: 3,379