minikube: Failed to start kvm when virtualbox is running

I saw this error on integeration tests for the https://github.com/kubernetes/minikube/pull/4857 PR, @josedonizetti found out through these related issues that you can not run KVM and virtualbox at the same time.

Related:

Unable to start VM: create: Error creating machine: Error in driver during machine creation: error creating VM: virError(Code=1, Domain=10, Message='internal error: process exited while connecting to monitor: ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy
 08:52:59 | ! failed to initialize KVM: Device or resource busy')
 08:52:59 | ! * 
 08:52:59 | ! X Unable to start VM: create: Error creating machine: Error in driver during machine creation: error creating VM: virError(Code=1, Domain=10, Message='internal error: process exited while connecting to monitor: ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy
 08:52:59 | ! failed to initialize KVM: Device or resource busy')
 08:52:59 | ! * 
 08:52:59 | ! * Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
 08:52:59 | !   - https://github.com/kubernetes/minikube/issues/new/choose

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (13 by maintainers)

Most upvoted comments

What’s the workaround?

Stop all libvirt/KVM virtual machines before starting VirtualBox. Stop all VBox virtual machines before starting KVM.

Note: You don’t have to delete them, just make sure that they are not running. Having them paused and suspended is OK.

@nanikjava I think it would be reasonable to check if either kvm/virtualbox is already running & log a warning to the user if that’s the case.

@josedonizetti @medyagh Is this something that need to be fixed ? What kind of check would be appropriate for this scenario ?

@josedonizetti When KVM runs first and then Virtualbox it gets stuck trying to connect to 127.0.0.1 port 34207

I1018 18:02:16.866907 7782 main.go:107] libmachine: Checking vm logs: /home/nanik/.minikube/machines/nanikvirtualbox/nanikvirtualbox/Logs/VBox.log I1018 18:02:16.868494 7782 main.go:107] libmachine: Waiting for an IP… I1018 18:02:16.868510 7782 main.go:107] libmachine: Getting to WaitForSSH function… I1018 18:02:16.868577 7782 main.go:107] libmachine: Using SSH client type: native I1018 18:02:16.868743 7782 main.go:107] libmachine: &{{{<nil> 0 [] [] []} docker [0xed0540] 0xed0510 <nil> [] 0s} 127.0.0.1 34207 <nil> <nil>} I1018 18:02:16.868757 7782 main.go:107] libmachine: About to run SSH command: exit 0 I1018 18:03:32.707305 7782 main.go:107] libmachine: Error dialing TCP: ssh: handshake failed: read tcp 127.0.0.1:33038->127.0.0.1:34207: read: connection reset by peer I1018 18:04:51.405462 7782 main.go:107] libmachine: Error dialing TCP: ssh: handshake failed: read tcp 127.0.0.1:33048->127.0.0.1:34207: read: connection reset by peer I1018 18:06:09.484929 7782 main.go:107] libmachine: Error dialing TCP: ssh: handshake failed: read tcp 127.0.0.1:33058->127.0.0.1:34207: read: connection reset by peer I1018 18:07:28.528378 7782 main.go:107] libmachine: Error dialing TCP: ssh: handshake failed: read tcp 127.0.0.1:33118->127.0.0.1:34207: read: connection reset by peer I1018 18:08:46.767847 7782 main.go:107] libmachine: Error dialing TCP: ssh: handshake failed: read tcp 127.0.0.1:33128->127.0.0.1:34207: read: connection reset by peer I1018 18:10:05.452337 7782 main.go:107] libmachine: Error dialing TCP: ssh: handshake failed: read tcp 127.0.0.1:33132->127.0.0.1:34207: read: connection reset by peer I1018 18:11:23.530606 7782 main.go:107] libmachine: Error dialing TCP: ssh: handshake failed: read tcp 127.0.0.1:33142->127.0.0.1:34207: read: connection reset by peer I1018 18:12:43.233888 7782 main.go:107] libmachine: Error dialing TCP: ssh: handshake failed: read tcp 127.0.0.1:33144->127.0.0.1:34207: read: connection reset by peer

This is how the VM in Virtualbox UI looks like

Screenshot from 2019-10-18 18-15-04

Able replicate the problem.

Running kvm2 after virtualbox running shows the following

I1017 19:47:07.436429 7185 main.go:107] libmachine: (nanik) Calling .Remove I1017 19:47:07.436532 7185 main.go:107] libmachine: (nanik) DBG | Removing machine… I1017 19:47:07.437066 7185 main.go:107] libmachine: (nanik) DBG | Trying to delete the networks (if possible) I1017 19:47:07.437439 7185 main.go:107] libmachine: (nanik) DBG | Checking if network minikube-net exists… I1017 19:47:07.437533 7185 main.go:107] libmachine: (nanik) DBG | Network minikube-net exists I1017 19:47:07.437568 7185 main.go:107] libmachine: (nanik) DBG | Trying to list all domains… I1017 19:47:07.437608 7185 main.go:107] libmachine: (nanik) DBG | Listed all domains: total of 1 domains I1017 19:47:07.437638 7185 main.go:107] libmachine: (nanik) DBG | Trying to get name of domain… I1017 19:47:07.437677 7185 main.go:107] libmachine: (nanik) DBG | Got domain name: nanik I1017 19:47:07.437724 7185 main.go:107] libmachine: (nanik) DBG | Skipping domain as it is us… I1017 19:47:07.437755 7185 main.go:107] libmachine: (nanik) DBG | Trying to destroy network minikube-net… I1017 19:47:07.726276 7185 main.go:107] libmachine: (nanik) DBG | Trying to undefine network minikube-net… I1017 19:47:07.726615 7185 main.go:107] libmachine: (nanik) Successfully deleted networks I1017 19:47:07.726657 7185 main.go:107] libmachine: (nanik) DBG | Checking if the domain needs to be deleted I1017 19:47:07.726783 7185 main.go:107] libmachine: (nanik) Domain nanik exists, removing… I1017 19:47:07.726878 7185 main.go:107] libmachine: (nanik) Domain nanik already destroyed, skipping…

💣 Unable to start VM ❌ Error: [KVM_CREATE_CONFLICT] create: Error creating machine: Error in driver during machine creation: error creating VM: virError(Code=1, Domain=10, Message=‘internal error: process exited while connecting to monitor: ioctl(KVM_CREATE_VM) failed: 16 Device or resource busy 2019-10-17T08:47:05.073182Z qemu-system-x86_64: failed to initialize KVM: Device or resource busy’) 💡 Suggestion: There appears to be another hypervisor conflicting with KVM. Please stop the other hypervisor, or use --vm-driver to switch to it. ⁉️ Related issues: ▪ https://github.com/kubernetes/minikube/issues/4913

😿 If the above advice does not help, please let us know: 👉 https://github.com/kubernetes/minikube/issues/new/choose

found out through these related issues that you can not run KVM and virtualbox at the same time.

I knew this ☺️ Just didn’t know it was an issue. One at a time (without any reboot) is fine, though.