DEV Community

Tyler Auerbeck
Tyler Auerbeck

Posted on • Edited on

CodeReady Containers: Unable to load kvm module

I found myself setting up a new machine recently and was enjoying the usual fun of configuring all of my tooling again. One of those tools is CodeReady Containers, which allows me to run a small OpenShift 4 environment locally. I've never had much issue with this previously (aside from some of the resource requirements that it has of course), but on this machine that wasn't going to be an issue.

That being said, after pulling down the binary and my pull secret, I was a bit surprised after running the intial crc setup command:

Failed to load kvm amd module: exit status 1: modprobe: ERROR: could not insert 'kvm_amd': Operation not supported
Enter fullscreen mode Exit fullscreen mode

Now before digging into what this actually means, let me be quite clear. This wasn't an actual issue with crc itself. It was more of an issue with the prerequisites that crc requires. I only came across one pull request that mentions something similar and didn't find anything in the way of documentation (Note: I also only did a quick pass on this), so I thought this quick write up would be helpful for others that find themselves in the same boat.

So what is the problem?

Again, the error message that we received here was this:

Failed to load kvm amd module: exit status 1: modprobe: ERROR: could not insert 'kvm_amd': Operation not supported
Enter fullscreen mode Exit fullscreen mode

I'm running on an AMD machine, so that makes sense. If you find yourself on an Intel machine, it would look something more like this:

Failed to load kvm intel module: exit status 1: modprobe: ERROR: could not insert 'kvm_intel': Operation not supported
Enter fullscreen mode Exit fullscreen mode

What this is telling us is that it's having an issue enabling the specific kvm module that it's trying to use. And what it all boils down to (at least in my case) was that I have a machine where I haven't enabled virtualization on yet. CRC of course sets up a single virtual machine that runs an OpenShift release, so of course if there's no virtualization enabled on the machine, I'm not going to get OpenShift here.

The fix is going to look slightly different in each case as your BIOS is going to look a bit different depending on your own machine, but overall what you're going to need to look for is found in your BIOS settings. So reboot your machine and press whatever keys necessary to get you to your BIOS screen. The setting you'll be looking for (likely to be settled in somewhere under an Advanced or CPU tab) is one that allows you to enable virtualization. In my case, the acronym was SVM -- but your mileage and use of acronyms may vary across any number of BIOS.

Top comments (2)

Collapse
 
manishfoodtechs profile image
manish srivastava

Enabling CPU virtualization is first step. I missed too.... Anyway, if you are looking very light containers go for lxc. New version of lxc also allows spinning of containers from iso file. Yup, vm as containers.

Collapse
 
tylerauerbeck profile image
Tyler Auerbeck

Funny enough, I'm running this to do some work with KubeVirt (so running VMs inside of containers). But thanks for the info on lxc. Will definitely need to check that out!