sickcodes / Docker-OSX

Run macOS VM in a Docker! Run near native OSX-KVM in Docker! X11 Forwarding! CI/CD for OS X Security Research! Docker mac Containers.
https://hub.docker.com/r/sickcodes/docker-osx
GNU General Public License v3.0
46.71k stars 2.53k forks source link

"/dev/kvm": no such file or directory #127

Closed xiaoqi7s closed 3 years ago

xiaoqi7s commented 3 years ago

docker run --device /dev/kvm --device /dev/snd -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" sickcodes/docker-osx:latest docker: Error response from daemon: error gathering device information while adding custom device "/dev/kvm": no such file or directory. ERRO[0000] error waiting for container: context canceled

sickcodes commented 3 years ago

You need to install kvm https://github.com/sickcodes/Docker-OSX#requirements-kvm-on-the-host

xiaoqi7s commented 3 years ago

My system is centos and I installed it with command : sudo yum install libvirt qemu-kvm sudo systemctl enable libvirtd.service sudo systemctl enable virtlogd.service sudo modprobe kvm reboot

when I run docker,it's error:

docker: Error response from daemon: error gathering device information while adding custom device "/dev/kvm": no such file or directory.
ERRO[0000] error waiting for container: context canceled 
sickcodes commented 3 years ago

Is this a server or desktop? This happens when your CPU does not support hardware virtualization.

Try a different server, like Digital Ocean, which works perfectly.

ghasemikasra39 commented 3 years ago

I am getting the same error on Ubuntu 20.04.2.0 LTS . The command I run:

sudo docker run --device /dev/kvm --device /dev/snd -v /tmp/X11-unix:/tmp/X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" sickcodes/docker-osx:latest

The output I get:

docker: Error response from daemon: error gathering device information while adding custom device "/dev/kvm": no such file or directory.
ERRO[0001] error waiting for container: context canceled 

What I tried:

sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager

sudo systemctl enable --now libvirtd
sudo systemctl enable --now virtlogd

echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs

sudo modprobe kvm
sickcodes commented 3 years ago

I am getting the same error on Ubuntu 20.04.2.0 LTS . The command I run:


sudo docker run --device /dev/kvm --device /dev/snd -v /tmp/X11-unix:/tmp/X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" sickcodes/docker-osx:latest

The output I get:


docker: Error response from daemon: error gathering device information while adding custom device "/dev/kvm": no such file or directory.

ERRO[0001] error waiting for container: context canceled 

What I tried:


sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager

sudo systemctl enable --now libvirtd

sudo systemctl enable --now virtlogd

echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs

sudo modprobe kvm

The server does not support KVM, which cloud is it?

mgkha commented 3 years ago

I am getting the same error on Ubuntu 20.04.2.0 LTS . The command I run:

sudo docker run --device /dev/kvm --device /dev/snd -v /tmp/X11-unix:/tmp/X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" sickcodes/docker-osx:latest

The output I get:

docker: Error response from daemon: error gathering device information while adding custom device "/dev/kvm": no such file or directory.

ERRO[0001] error waiting for container: context canceled 

What I tried:

sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager

sudo systemctl enable --now libvirtd

sudo systemctl enable --now virtlogd

echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs

sudo modprobe kvm

The server does not support KVM, which cloud is it?

I got the same error on digital ocean.

sickcodes commented 3 years ago

This sets you up on Digital Ocean,

https://github.com/sickcodes/Docker-OSX/blob/master/tests/test.sh

Just ignore the docker push commands at the end.

howthegodschill commented 2 years ago

Currently running Centos 7 with an Intel CPU and full virtualization support and am running into this same issue

sickcodes commented 2 years ago

I am using compute optimized instances, I don't believe the lower image tiers support nested virtualization.

ZGuQing commented 2 years ago

You need to install kvm https://github.com/sickcodes/Docker-OSX#requirements-kvm-on-the-host How to install kvm?

ZGuQing commented 2 years ago

You need to install kvm https://github.com/sickcodes/Docker-OSX#requirements-kvm-on-the-host How to install kvm? macos

dm-for-git commented 2 years ago

It seems a silly question but can I use this image on a Monterey macOS host machine running on a M1 pro macbook? Because I got the same error when trying to install your Monterey image error gathering device information while adding custom device "/dev/kvm": no such file or directory

CainPy commented 2 years ago

Hi everyone!

I'm trying to install BLISSOS on Linux Mint 20.3, Kernel 5.4.0-125, Intel i3-7100. Nvidia GP107, 8Gb RAM

I do every step as indicated in https://docs.blissos.org/install-bliss-os/run-from-docker

But I'm stucked on

docker run -it \ --device /dev/kvm \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e RAM=4 \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -p 5555:5555 \ sickcodes/dock-droid:latest

docker: Error response from daemon: error gathering device information while adding custom device "/dev/kvm": **not a device node**.

ERRO[0000] error waiting for container: context canceled

Any help?

Areopagitics commented 1 year ago

I get the same error on PopOS (Ubuntu 22.04)

Tyree commented 1 year ago

Same. I'm no linux pro, but I've done everything I can find to do and I still get the "no such file or directory" for /dev/kvm. But it's there. I have taken ownership of it. kvm-ok says I'm good to go. Check CPU capabilities is good. I'm at a loss.

Areopagitics commented 1 year ago

Same. I'm no linux pro, but I've done everything I can find to do and I still get the "no such file or directory" for /dev/kvm. But it's there. I have taken ownership of it. kvm-ok says I'm good to go. Check CPU capabilities is good. I'm at a loss.

exactly the same

youssef-sobhy commented 1 year ago

has anyone been able to fix this issue? facing the same issue on PopOS 22.04

Areopagitics commented 1 year ago

I just tried it using the docker CLI and now it boots up to In Memory Stackshot Suceeded

STAY AWAY FROM DOCKER DESKTOP and make sure to use sudo before the docker command

https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository errors

sickcodes commented 1 year ago

Can you show me which Docker version? I may need to update Docs about secomp and privileged use

Areopagitics commented 1 year ago

docker -v outputs

Docker version 20.10.22, build 3a2c30b

I am also using PopOs 22.04 (Ubuntu based) on a Ryzen 9 4900h laptop (Asus TUF506IV)

ChristopherSargent commented 1 year ago

If you are using a virtual machine the above error is likely due to nested virtualization being disabled (as the automatic selection by the hypervisor is usually to disable it). This can be enabled on KVM and VMware. Below are screenshots of examples.

vCenter with esxi host: image

KVM ubuntu host: image

Once enabled you will get the following when running the command: echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs && modprobe kvm 1

instead of

echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs && modprobe kvm INFO: Your CPU does not support KVM extensions KVM acceleration can NOT be used

or kvm-ok INFO: /dev/kvm exists KVM acceleration can be used

instead of

kvm-ok INFO: Your CPU does not support KVM extensions KVM acceleration can NOT be used

AZetZ commented 8 months ago

To solve problem you can go to BIOS and change settings. For my AMD processor I needed to enabled the AMD V Technology.

CrypticGuru commented 7 months ago

To solve problem you can go to BIOS and change settings. For my AMD processor I needed to enabled the AMD V Technology.

I also had to enable virtualization in my BIOS for this to work (sudo kvm-ok hinted to me that it wasn't enabled). You'll have to google how to do this for your specific BIOS version, but this solved it for me!

heruit777 commented 7 months ago

I just tried it using the docker CLI and now it boots up to In Memory Stackshot Suceeded

STAY AWAY FROM DOCKER DESKTOP and make sure to use sudo before the docker command

https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository errors

I used sudo before docker command and it worked for me. Thank you!

ChronSyn commented 2 months ago

In case anyone is searching for an Unraid-specific solution, make sure VM support is enabled (Settings -> VM Management).

If enabled is set to 'false', the /dev/kvm path isn't present, and this container and other 'InDocker'-like containers will fail to start due to the missing path.

To resolve, set 'enabled' to 'true'.