I’ve done quite a bit of development recently in Android and also been working with a client who has a local virtual environment using Oracle/Sun’s VirtualBox vm. So, I found myself switching between the two platforms quite frequently which unfortunately requires removing and reinstalling kernel modules. So, I wrote the below shell script to switch between the two platforms. Simply put in a directory in $PATH (for me I always have ~/bin as a directory there for my user-local scripts) and call the script something like switch_vm. Use it like:
switch_vm virtualbox switch_vm kvm
Here’s the script:
#!/bin/bash
VM=$1
if [ "$VM" = "kvm" ]; then
sudo rmmod vboxpci vboxnetflt vboxnetadp vboxdrv
sudo modprobe kvm_intel
fi
if [ "$VM" = "virtualbox" ]; then
sudo rmmod kvm_intel kvm
for i in vboxdrv vboxpci vboxnetflt vboxnetadp; do
sudo modprobe $i
done
fi
Good morning
Posible errata on the script
Lines 6 and 10,
Where says:
kvm_intel
It should says:
kvm-intel
Thanks by your works
on ubuntu 16.04 and 18.04 at least it is kvm_intel
Great!!! You saved me searches and tries!
Thank you!!!!