Error: "/dev/kvm": no such file or directory #387

Open
opened 2025-12-29 00:26:02 +01:00 by adam · 3 comments
Owner

Originally created by @JoshPerson on GitHub (Jul 20, 2022).

When trying the docker run commands at the top of the documentation, I'm getting:
"docker: Error response from daemon: error gathering device information while adding custom device "/dev/kvm": no such file or directory."

This same error message was present in a previously logged issue (https://github.com/sickcodes/Docker-OSX/issues/127), but none of the answers in that discussion fit. I proved I could handle nested virtualization by running a ubuntu container. I went through the first-time setup process in your docs that included installing kvm.

That said, there is an odd message that I couldn't figure out:
If I run "sudo apt install qemu qemu-kvm", the initial message is "Note, selecting 'qemu-system-x86' instead of 'qemu-kvm'" before it proceeds to install this different package. Seems like it could be related

In case it makes any difference, I'm on a windows 10 physical machine running ubuntu in VMWare. I'm using docker on that ubuntu virtual machine.

Output of command in issue template:
Linux josh-virtual-machine 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
:0
tee: /sys/module/kvm/parameters/ignore_msrs: No such file or directory
1
PRETTY_NAME="Ubuntu 22.04 LTS"
NAME="Ubuntu"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 98G 14G 79G 15% /
QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.3)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
libvirtd (libvirt) 8.0.0
total used free shared buff/cache available
Mem: 3.8Gi 1.2Gi 173Mi 33Mi 2.4Gi 2.3Gi
Swap: 2.0Gi 3.0Mi 2.0Gi
2
0
ls: cannot access '/dev/kvm': No such file or directory
total 8.0K
drwxrwxrwt 2 root root 4.0K Jul 19 15:32 .
drwxrwxrwt 24 root root 4.0K Jul 19 16:03 ..
srwxrwxr-x 1 josh josh 0 Jul 19 15:32 X0
srwxrwxr-x 1 josh josh 0 Jul 19 15:32 X1
root 1400 0.0 2.0 1457596 82856 ? Ssl 15:32 0:01 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
josh 5015 0.0 0.0 17864 2424 pts/0 S+ 16:08 0:00 grep --color=auto dockerd
kvm:x:109:
docker:x:999:
libvirt:x:138:josh
libvirt-qemu:x:64055:libvirt-qemu
libvirt-dnsmasq:x:139:

Originally created by @JoshPerson on GitHub (Jul 20, 2022). When trying the docker run commands at the top of the documentation, I'm getting: "docker: Error response from daemon: error gathering device information while adding custom device "/dev/kvm": no such file or directory." This same error message was present in a previously logged issue (https://github.com/sickcodes/Docker-OSX/issues/127), but none of the answers in that discussion fit. I proved I could handle nested virtualization by running a ubuntu container. I went through the first-time setup process in your docs that included installing kvm. That said, there is an odd message that I couldn't figure out: If I run "sudo apt install qemu qemu-kvm", the initial message is "Note, selecting 'qemu-system-x86' instead of 'qemu-kvm'" before it proceeds to install this different package. Seems like it could be related In case it makes any difference, I'm on a windows 10 physical machine running ubuntu in VMWare. I'm using docker on that ubuntu virtual machine. **Output of command in issue template:** Linux josh-virtual-machine 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux :0 tee: /sys/module/kvm/parameters/ignore_msrs: No such file or directory 1 PRETTY_NAME="Ubuntu 22.04 LTS" NAME="Ubuntu" VERSION_CODENAME=jammy UBUNTU_CODENAME=jammy Filesystem Size Used Avail Use% Mounted on /dev/sda3 98G 14G 79G 15% / QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.3) Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers libvirtd (libvirt) 8.0.0 total used free shared buff/cache available Mem: 3.8Gi 1.2Gi 173Mi 33Mi 2.4Gi 2.3Gi Swap: 2.0Gi 3.0Mi 2.0Gi 2 0 ls: cannot access '/dev/kvm': No such file or directory total 8.0K drwxrwxrwt 2 root root 4.0K Jul 19 15:32 . drwxrwxrwt 24 root root 4.0K Jul 19 16:03 .. srwxrwxr-x 1 josh josh 0 Jul 19 15:32 X0 srwxrwxr-x 1 josh josh 0 Jul 19 15:32 X1 root 1400 0.0 2.0 1457596 82856 ? Ssl 15:32 0:01 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock josh 5015 0.0 0.0 17864 2424 pts/0 S+ 16:08 0:00 grep --color=auto dockerd kvm:x:109: docker:x:999: libvirt:x:138:josh libvirt-qemu:x:64055:libvirt-qemu libvirt-dnsmasq:x:139:
Author
Owner

@JoshPerson commented on GitHub (Jul 21, 2022):

I've been messing with permissions, and the issue went away. Not sure what happened, but maybe add this to the readme (as the readme says that if you get the error, it's because the daemon isn't running). Not sure why my old permissions allowed me to run other docker images but not this one.

@JoshPerson commented on GitHub (Jul 21, 2022): I've been messing with permissions, and the issue went away. Not sure what happened, but maybe add this to the readme (as the readme says that if you get the error, it's because the daemon isn't running). Not sure why my old permissions allowed me to run other docker images but not this one.
Author
Owner

@Hungiepooh commented on GitHub (Aug 31, 2022):

I tried the solution here at the link below and it worked!

https://stackoverflow.com/questions/65435561/how-to-pass-kvm-from-local-machine-to-docker-container

@Hungiepooh commented on GitHub (Aug 31, 2022): I tried the solution here at the link below and it worked! https://stackoverflow.com/questions/65435561/how-to-pass-kvm-from-local-machine-to-docker-container
Author
Owner

@Areopagitics commented on GitHub (Dec 19, 2022):

I tried the solution here at the link below and it worked!

https://stackoverflow.com/questions/65435561/how-to-pass-kvm-from-local-machine-to-docker-container

Could you please elaborate? I tried the same post and no luck.

@Areopagitics commented on GitHub (Dec 19, 2022): > I tried the solution here at the link below and it worked! > > https://stackoverflow.com/questions/65435561/how-to-pass-kvm-from-local-machine-to-docker-container Could you please elaborate? I tried the same post and no luck.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#387