# [SOLVED] There is no /dev/kvm directory for QEMU installing?

## pmam

I am trying to install QEMU according this wiki: https://wiki.gentoo.org/wiki/QEMU

I followed wiki and did all needed kernel config's changes, but there is no /dev/kvm directory

Please inform if need to create this directory manually or any other advise?

BTW: Portage warning about this mistake in wiki regarding editing package.use with: qemu_softmmu_targets_m68k qemu_user_targets_x86_64

So I followed the first suggestion by editing make.conf

----------

## NeddySeagoon

pmam,

The contends of /dev are created by the kernel. Thats what the DEVTMPFS option does.

/dev is also a RAM filesystem so it does not persist across reboots.

If you don't have  /dev/kvm, either you have one or more kernel options missing or you are not running the kernel you think you are.

What does 

```
uname -a
```

say?

The date and time shown there is the build time of the running kernel.

```
 $ uname -a

Linux NeddySeagoon_Static 4.15.0-rc4 #4 SMP PREEMPT Tue Dec 19 19:25:32 GMT 2017 x86_64 AMD Phenom(tm) II X6 1090T Processor AuthenticAMD GNU/Linux
```

A popular case is forgetting to mount /boot for the kernel install.

----------

## Hu

As a minor point, when this works correctly, /dev/kvm is not a directory; it is a character device.  Its permissions should be root:kvm 660, so that only root or users in the kvm group can use this service.

----------

## pmam

I am aware of wrong kernel's rev... and looks this kernel is ok:

```
uname -a

Linux new-host.home 4.12.12-gentoo #1 SMP Wed Dec 20 22:22:44 IST 2017 x86_64 Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz GenuineIntel GNU/Linux
```

I am quite new with genkernel and not sure all configurations are taking place -

Please inform how to print menuconfig and verify if all kvm parameters are according wiki?

Here from /etc/genkernel.conf some settings -

BTW: MENUCONFIG="no" is ok or need to change to "yes" in order to "Using previous kernel configuration while changing the sources"?

```
# Configuration file for genkernel

# This file is sourced by genkernel at startup and determines which options

# we will be using to compile our kernel.  The order of precidence is simple,

# with the internal settings being least important, configuration file

# settings next, and command line options being most important.

# =========Common Command Line Option Defaults=========

# Should we install to $BOOTDIR?  Default is "no" because genkernel is used in

# catalyst and stage building.

#INSTALL="yes"

# Run 'make oldconfig' before compiling this kernel?

OLDCONFIG="yes"

# Run 'make menuconfig' before compiling this kernel?

MENUCONFIG="no"

# Run 'make nconfig' (ncurses 'menuconfig') before compiling this kernel?

NCONFIG="no"

# Note, that two previous lines are mutual exclusive (logically), while

# MENUCONFIG has a higher priority if both them is enabled.

# Run 'make clean' before compilation?

# If set to NO, implies MRPROPER WILL NOT be run

# Also, if clean is NO, it won't copy over any configuration

# file, it will use what's there.

CLEAN="yes"

# Run 'make mrproper' before configuration/compilation?

MRPROPER="yes"

# Override the arch detection?

#ARCH_OVERRIDE="x86"

# Mount BOOTDIR automatically if it isn't mounted?

MOUNTBOOT="yes"

# Make symlinks in BOOTDIR automatically?

#SYMLINK="no"

# Save the new configuration in /etc/kernels upon

# successfull compilation

SAVE_CONFIG="yes"

# Use Color output in Genkernel?

USECOLOR="yes"
```

----------

## NeddySeagoon

pmam,

Heres my KVM settings

```
$ grep KVM /usr/src//linux/.config

CONFIG_HAVE_KVM=y

CONFIG_HAVE_KVM_IRQCHIP=y

CONFIG_HAVE_KVM_IRQFD=y

CONFIG_HAVE_KVM_IRQ_ROUTING=y

CONFIG_HAVE_KVM_EVENTFD=y

CONFIG_KVM_MMIO=y

CONFIG_KVM_ASYNC_PF=y

CONFIG_HAVE_KVM_MSI=y

CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y

CONFIG_KVM_VFIO=y

CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y

CONFIG_HAVE_KVM_IRQ_BYPASS=y

CONFIG_KVM=y

CONFIG_KVM_AMD=y
```

 ignore all the ones with _HAVE_, you can't change them.

If you have an Intel CPU, you will need  CONFIG_KVM_INTEL=y

Genkernel always uses the same preset .config file every time its run.  If you want to make changes, you need to run genkernel with the -menuconfig option.

Your changes will be forgotten by the next run.

You can save your changed .config file and tell genkernel to use it next time but other that knowing its possible, I've never done it as I don't use Genkernel.

----------

## pmam

Here mine - looks all kvm settings are ok so dont know why there is no /dev/kvm?

```
grep KVM /usr/src//linux/.config 

CONFIG_HAVE_KVM=y

CONFIG_HAVE_KVM_IRQCHIP=y

CONFIG_HAVE_KVM_IRQFD=y

CONFIG_HAVE_KVM_IRQ_ROUTING=y

CONFIG_HAVE_KVM_EVENTFD=y

CONFIG_KVM_MMIO=y

CONFIG_KVM_ASYNC_PF=y

CONFIG_HAVE_KVM_MSI=y

CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT=y

CONFIG_KVM_VFIO=y

CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y

CONFIG_KVM_COMPAT=y

CONFIG_HAVE_KVM_IRQ_BYPASS=y

CONFIG_KVM=y

CONFIG_KVM_INTEL=m

CONFIG_KVM_AMD=m

CONFIG_KVM_MMU_AUDIT=y
```

I allways use this command:

```
genkernel --menuconfig all
```

Please inform how to verify if all kvm modules are actually loaded? I tried with lsmod but there is no kvm module...

Next installation I will not choose genkernel - It saves some time in the beginning,

however, each kernel's compilation takes very long time, and I dont use to configuration and settings it.

----------

## bbgermany

Hi,

Please post your output of 

```

lsmod | grep kvm

```

if you dont have /dev/kvm, usually the module is not loaded as needed.

greets, bb

----------

## pmam

```
lsmod | grep kvm
```

There is no output of this command... 

If it means that kvm module is not loaded, thus my kernel's settings do not compile into kernel...

Do not know how to update genkernel with the kvm's changes?

----------

## pmam

Dont know why my menuconfig changes are not updating genkernel...

I found that symlink=no by default in /etc/genkernel.conf - Is it needed and should change to "yes"? 

```
# Make symlinks in BOOTDIR automatically?

#SYMLINK="no"
```

----------

## NeddySeagoon

pmam,

```
CONFIG_KVM_INTEL=m

CONFIG_KVM_AMD=m 
```

You will need to modprobe one of those ... whichever matches your CPU

----------

## pmam

I found in this directory: /lib/modules/4.12.12-gentoo/kernel/arch/x86/kvm/  two files:

```
kvm # ls -l

total 428

-rw-r--r-- 1 root root 104968 Dec 21 17:07 kvm-amd.ko

-rw-r--r-- 1 root root 329208 Dec 21 17:07 kvm-intel.ko
```

But I am not sure how to write the modprobe command? The following command gives an I/O error:

```
modprobe kvm-intel

modprobe: ERROR: could not insert 'kvm_intel': Input/output error
```

Other options give Fatal like:

```
modprobe kvm-intel.ko

modprobe: FATAL: Module kvm-intel.ko not found in directory /lib/modules/4.12.12-gentoo

```

----------

## bbgermany

Can you try "modprobe -v kvm-intel" please? And please post the output of "grep vmx /proc/cpuinfo" please.

Maybe you forgot to enable VT-x in the BIOS.  :Wink: 

greets, bb

----------

## pmam

 *Quote:*   

> Maybe you forgot to enable VT-x in the BIOS. 

 

It is ok...   :Smile: 

```
modprobe -v kvm-intel

insmod /lib/modules/4.12.12-gentoo/kernel/arch/x86/kvm/kvm-intel.ko 

modprobe: ERROR: could not insert 'kvm_intel': Input/output error
```

```
grep vmx /proc/cpuinfo

flags      : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl cpuid aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow dtherm

flags      : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl cpuid aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow dtherm
```

Thanks

----------

## NeddySeagoon

pmam,

```
Input/output error
```

indicates that there is a fundamental problem reading the hard drive.

Provoke that error again then post the end of dmesg so we can see what the problem is.

Whatever, the file kvm-intel.ko cannot be read for some reason.

----------

## papas

Good morning, 

you can find informations about how this behaviour starts here:

https://patchwork.kernel.org/patch/9646589/

also you can find the solution  (patch) for the 4.12.12 kernel, here:

https://patchwork.kernel.org/patch/10043403/

and

https://patchwork.kernel.org/patch/10043407/

 OR 

you can just install the 4.14.* kernel, works fine.

----------

## pmam

Neddy,

Here what I think the error after trying to load kvm module - but according papas advise it seems a known issue of old Intel Core2 machines..

```
[  115.610540] gnome-session-f[2333]: segfault at 0 ip 00007f85d3e74689 sp 00007ffd5ed1a600 error 4 in libgtk-3.so.0.2200.16[7f85d3b91000+6f4000]
```

papas,

I have some relief informed by your response that it is a known issue...  

I am not familiar with patch adding - do not know how and where to add it - 

so think it is better to wait for kernel 4.14, or - can I install it even it is not stable?

Thanks a lot

----------

## papas

I think 4.14.8-r1 is stable try  --sync your system...

----------

## pmam

 *Quote:*   

> I think 4.14.8-r1 is stable try --sync your system...

 

You are right, it's stable and I installed it and now have /dev/kvm.. 

At the moment I am updating the system and hpe emulator will work ok

Thanks   :Smile: 

----------

