I launched Virtual Box today as usual, and thought to turn on my virtual machine, but for some reason I got this error" Virtual Box Guru Meditation", I have to admit this was the first time I got this error, I had never seen this error before and I thought well I need to Investigate this more and hopefully I can find a solution so I can write about it for other people who may be getting the same issue.
On the error tab it also tells you where the log file is located so you can look at it, to see exactly what caused this issue, so I went and checked the log file which was located on /home/user/VirtualBox VMs/arch/Logs, now on this folder you will find all logs related to Virtualbox and it actually helps to debug when an issue happens however in this case it did not, the error was still there.
This is the log file that was generated after pressing the OK button on the error tab
As you can see at the end of log file it says " GUI: Aborting startup due to invalid machine state detected : 1
The last line is usually supposed to specify why the vm wasn't able to start, in my case this error is generic because "invalid state machine detected" means the vm it's not on or off so it's just a generic error.
You can get $20 free cloud credit on Hetzner if you join via our link
After no luck with the log file, I thought to check vm options, maybe something broke the configuration so I checked everything on there, and nothing was changed, ram was the same, cpu too, storage and everything else and yet the vm wasn't powering on and it was showing up the same error again.
So the log file wasn't specifying exactly what was causing this issue, the only thing that I did not check yet was processes running in background, so I went on terminal and typed the command to list all processes : top and I saw that qemu-system-x86 was running along with virt-manager and libvirtd, and I instantly knew this was the issue because KVM and Virtualbox can't be used at the same time.
top #If you are having the same issue, you don't have to check for processes but simply type the command below to check if these processes are running, and it should show you the PID of process that you need to terminate ps aux | grep virt-manager ps aux | grep qemu-system-x86
For example the PID of virt-manager in my case is 25911
To terminate these processes simply use the command below
I went ahead and terminated all three processes as shown on the screenshot above, qemu-sytem-x86, virt-manager and libvirtd
sudo kill -9 pid
After terminating these processes I tried running the virtual machine on Virtualbox again, at this time I had the log file opened, and pressed the reload button on the text editor to see the new log that was generated by Virtualbox and I saw that the error was gone.
And Vm started normally after that.
I hope this tutorial helped you to fix this issue, there are a lot of other stuff that may cause the same error but in my case the error "Virtual Box Guru Meditation error" was caused because kvm was running in background, and the solution was simply to terminate all kvm processes before trying to turn on the vm(s) on Virtualbox because KVM and Virtualbox can't run together at the same time.