LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 07-20-2015, 05:36 PM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Location: DC
Distribution: RHEL/CentOS
Posts: 1,386
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Load kvm module on boot in RHEL6 not working


Trying to load kvm module under RHEL6 from the following:

Code:
/etc/sysconfig/modules/kvm2.modules
Here is the code for kvm2.modules

Code:
#!/bin/sh 

if [ $(grep -c kvm /proc/cpuinfo) -ne 0 ]; then
     modprobe -v kvm >/dev/null 2>&1
fi
kvm module fails to load after a reboot. Also I'm basically copying what I see from other files in this directory. I'm not even sure what -ne 0 does, is that part o grep?
 
Old 07-20-2015, 10:58 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,201

Rep: Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955
Quote:
Originally Posted by JockVSJock View Post
Trying to load kvm module under RHEL6 from the following:

Code:
/etc/sysconfig/modules/kvm2.modules
Here is the code for kvm2.modules

Code:
#!/bin/sh 

if [ $(grep -c kvm /proc/cpuinfo) -ne 0 ]; then
     modprobe -v kvm >/dev/null 2>&1
fi
kvm module fails to load after a reboot. Also I'm basically copying what I see from other files in this directory. I'm not even sure what -ne 0 does, is that part o grep?
grep -c produces a count of matching lines. If that is not zero, grep found something.

Now, I don't know of a CPU flag named kvm, and your kvm2.modules file looks wrong. On my Centos 6.6, I have a kvm.modules file that looks like this:
Code:
#!/bin/sh
if [ $(grep -c vmx /proc/cpuinfo) -ne 0 ]; then
    modprobe -b kvm-intel >/dev/null 2>&1
fi
if [ $(grep -c svm /proc/cpuinfo) -ne 0 ]; then
    modprobe -b kvm-amd >/dev/null 2>&1
fi
modprobe -b vhost_net >/dev/null 2>&1
exit 0
That is, if the CPU has the vmx flag, it's an Intel CPU with virtualization extentions, therefore kvm-intel will be loaded. If it has the svm flag, it's an AMD CPU.

EDIT: Of course, the grep doesn't necessarily look for a CPU flag. However, that is obviously the intention in the correct kvm.modules.

Last edited by berndbausch; 07-20-2015 at 11:02 PM.
 
Old 07-21-2015, 06:11 AM   #3
JockVSJock
Senior Member
 
Registered: Jan 2004
Location: DC
Distribution: RHEL/CentOS
Posts: 1,386

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
I have a kvm file under /etc/sysconfig/modules, however its not loading the basic kvm module.

Code:
[root@ApacheFTP modules]# cat kvm.modules 
#!/bin/sh

if [ $(grep -c vmx /proc/cpuinfo) -ne 0 ]; then 
    modprobe -b kvm_intel >/dev/null 2>&1
fi

if [ $(grep -c svm /proc/cpuinfo) -ne 0 ]; then 
    modprobe -b kvm_amd >/dev/null 2>&1
fi

modprobe -b vhost_net >/dev/null 2>&1

exit 0
That is why I created a new .module file under this directory, to try and load this module.

Side note, I can't even load kvm_intel without error popping up as well.

Code:
[root@ApacheFTP modules]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 58
Stepping:              9
CPU MHz:               2394.560
BogoMIPS:              4789.12
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              6144K
NUMA node0 CPU(s):     0,1
[root@ApacheFTP modules]# modprobe kvm_intel
FATAL: Error inserting kvm_intel (/lib/modules/2.6.32-431.el6.x86_64/kernel/arch/x86/kvm/kvm-intel.ko): Operation not supported
[root@ApacheFTP modules]#
 
Old 07-21-2015, 07:18 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,201

Rep: Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955Reputation: 1955
Code:
Hypervisor vendor:     KVM
Virtualization type:   full
This probably means that your system is a virtual machine. The CPU is a virtual CPU and has no virtualization extensions. That's why kvm.modules doesn't load kvm-intel or kvm-amd, and that's also why you get an error trying to insert the kvm-intel module.

You can't run KVM on a CPU without virtualization extensions. It follows that you can't run KVM in a virtual machine.
 
Old 07-21-2015, 09:25 AM   #5
JockVSJock
Senior Member
 
Registered: Jan 2004
Location: DC
Distribution: RHEL/CentOS
Posts: 1,386

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
I'll have to read up on this, however I will mark this thread as Solved.
 
  


Reply

Tags
grep, kvm, modules, rhel


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't get KVM working. FATAL: Module kvm_intel not found. CamTheSaxMan Linux - Software 5 03-10-2014 05:43 PM
can we use kvm vm's created on rhel6 on ubantu kvm Gil@LQ Linux - Virtualization and Cloud 1 11-28-2011 02:39 PM
Port forwarding is not working on RHEL6.1 KVM dinesh.tripathi30 Linux - Virtualization and Cloud 0 07-21-2011 12:49 AM
Compile and load kernel module automatically after boot? (Intel NIC module) touser Linux - Newbie 3 08-29-2009 08:45 PM
load a module before another at boot-up? josejcs Linux - Newbie 1 11-05-2003 03:43 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 11:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration