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

Closed
opened 2025-12-29 00:23:31 +01:00 by adam · 12 comments
Owner

Originally created by @mattpackwood on GitHub (Dec 19, 2021).

OS related issued, please help us identify the issue by posting the output of this

uname -a
; echo "${DISPLAY}"
; echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs
; grep NAME /etc/os-release
; df -h .
; qemu-system-x86_64 --version
; libvirtd --version
; free -mh
; nproc
; egrep -c '(svm|vmx)' /proc/cpuinfo
; ls -lha /dev/kvm
; ls -lha /tmp/.X11-unix/
; ps aux | grep dockerd
; docker ps | grep osx
; grep "docker|kvm|virt" /etc/group

I get:

Linux dockerserver 5.13.0-22-generic #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

1
PRETTY_NAME="Ubuntu 21.10"
NAME="Ubuntu"
VERSION_CODENAME=impish
UBUNTU_CODENAME=impish
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv   15G  8.7G  5.3G  63% /
QEMU emulator version 6.0.0 (Debian 1:6.0+dfsg-2expubuntu1.1)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
libvirtd (libvirt) 7.6.0
               total        used        free      shared  buff/cache   available
Mem:           1.9Gi       320Mi        72Mi       1.0Mi       1.5Gi       1.4Gi
Swap:          2.0Gi       0.0Ki       2.0Gi
2
0
ls: cannot access '/dev/kvm': No such file or directory
total 8.0K
drwxrwxrwt  2 root root 4.0K Dec 18 21:17 .
drwxrwxrwt 15 root root 4.0K Dec 19 16:31 ..
root         851  0.0  4.4 1722428 89492 ?       Ssl  Dec18   0:56 dockerd --group docker --exec-root=/run/snap.docker --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/run/snap.docker/docker.pid --config-file=/var/snap/docker/1125/config/daemon.json
mattpac+   32958  0.0  0.1   6680  2316 pts/0    S+   16:32   0:00 grep --color=auto dockerd
kvm:x:108:
libvirt:x:119:mattpackwood
libvirt-qemu:x:64055:libvirt-qemu
libvirt-dnsmasq:x:120:
docker:x:1001:mattpackwood
Originally created by @mattpackwood on GitHub (Dec 19, 2021). # OS related issued, please help us identify the issue by posting the output of this uname -a \ ; echo "${DISPLAY}" \ ; echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs \ ; grep NAME /etc/os-release \ ; df -h . \ ; qemu-system-x86_64 --version \ ; libvirtd --version \ ; free -mh \ ; nproc \ ; egrep -c '(svm|vmx)' /proc/cpuinfo \ ; ls -lha /dev/kvm \ ; ls -lha /tmp/.X11-unix/ \ ; ps aux | grep dockerd \ ; docker ps | grep osx \ ; grep "docker\|kvm\|virt" /etc/group I get: ``` Linux dockerserver 5.13.0-22-generic #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux 1 PRETTY_NAME="Ubuntu 21.10" NAME="Ubuntu" VERSION_CODENAME=impish UBUNTU_CODENAME=impish Filesystem Size Used Avail Use% Mounted on /dev/mapper/ubuntu--vg-ubuntu--lv 15G 8.7G 5.3G 63% / QEMU emulator version 6.0.0 (Debian 1:6.0+dfsg-2expubuntu1.1) Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers libvirtd (libvirt) 7.6.0 total used free shared buff/cache available Mem: 1.9Gi 320Mi 72Mi 1.0Mi 1.5Gi 1.4Gi Swap: 2.0Gi 0.0Ki 2.0Gi 2 0 ls: cannot access '/dev/kvm': No such file or directory total 8.0K drwxrwxrwt 2 root root 4.0K Dec 18 21:17 . drwxrwxrwt 15 root root 4.0K Dec 19 16:31 .. root 851 0.0 4.4 1722428 89492 ? Ssl Dec18 0:56 dockerd --group docker --exec-root=/run/snap.docker --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/run/snap.docker/docker.pid --config-file=/var/snap/docker/1125/config/daemon.json mattpac+ 32958 0.0 0.1 6680 2316 pts/0 S+ 16:32 0:00 grep --color=auto dockerd kvm:x:108: libvirt:x:119:mattpackwood libvirt-qemu:x:64055:libvirt-qemu libvirt-dnsmasq:x:120: docker:x:1001:mattpackwood ```
adam closed this issue 2025-12-29 00:23:31 +01:00
Author
Owner

@sickcodes commented on GitHub (Dec 21, 2021):

Hey Matt, your device/service/VM unfortunately does not support KVM.

You will need either a dedicated or compute optimized instance, for example.

@sickcodes commented on GitHub (Dec 21, 2021): Hey Matt, your device/service/VM unfortunately does not support KVM. You will need either a dedicated or compute optimized instance, for example.
Author
Owner

@mattpackwood commented on GitHub (Dec 22, 2021):

Can you make a suggestion on what OS to use? I am running VMWare ESXi.

@mattpackwood commented on GitHub (Dec 22, 2021): Can you make a suggestion on what OS to use? I am running VMWare ESXi.
Author
Owner

@mattpackwood commented on GitHub (Dec 26, 2021):

I turned on Hardware virtualization, now I am getting:

Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.11.0-43-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

0 updates can be applied immediately.

Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login: Sun Dec 26 10:03:07 2021 from 2601:409:8500:d630:5834:a64c:f9dc:4621
mattpackwood@Ubuntu-macOS:~$ docker run -it     --device /dev/kvm     -p 50922:10022     -v /tmp/.X11-unix:/tmp/.X11-unix     -e "DISPLAY=${DISPLAY:-:0.0}"     sickcodes/docker-osx:latest
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 
nohup: appending output to 'nohup.out'
++ id -u
++ id -g
+ sudo chown 1000:1000 /dev/kvm
++ id -u
++ id -g
+ sudo chown -R 1000:1000 /dev/snd
+ [[ 4 = max ]]
+ [[ 4 = half ]]
++ id -u
++ id -g
+ sudo chown -R 1000:1000 /dev/snd
+ exec qemu-system-x86_64 -m 4000 -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check, -machine q35,accel=kvm:tcg -smp 4,cores=4 -usb -device usb-kbd -device usb-tablet -device 'isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc' -drive if=pflash,format=raw,readonly=on,file=/home/arch/OSX-KVM/OVMF_CODE.fd -drive if=pflash,format=raw,file=/home/arch/OSX-KVM/OVMF_VARS-1024x768.fd -smbios type=2 -audiodev alsa,id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda -device ich9-ahci,id=sata -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2 -device ide-hd,bus=sata.2,drive=OpenCoreBoot -device ide-hd,bus=sata.3,drive=InstallMedia -drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 -drive id=MacHDD,if=none,file=/home/arch/OSX-KVM/mac_hdd_ng.img,format=qcow2 -device ide-hd,bus=sata.4,drive=MacHDD -netdev user,id=net0,hostfwd=tcp::10022-:22,hostfwd=tcp::5900-:5900, -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:09:49:17 -monitor stdio -boot menu=on -vga vmware
qemu-system-x86_64: warning: dbind: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-Xvi7KiZi6m: Connection refused
QEMU 6.2.0 monitor - type 'help' for more information
(qemu) qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
@mattpackwood commented on GitHub (Dec 26, 2021): I turned on Hardware virtualization, now I am getting: ``` Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.11.0-43-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 0 updates can be applied immediately. Your Hardware Enablement Stack (HWE) is supported until April 2025. Last login: Sun Dec 26 10:03:07 2021 from 2601:409:8500:d630:5834:a64c:f9dc:4621 mattpackwood@Ubuntu-macOS:~$ docker run -it --device /dev/kvm -p 50922:10022 -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" sickcodes/docker-osx:latest ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 nohup: appending output to 'nohup.out' ++ id -u ++ id -g + sudo chown 1000:1000 /dev/kvm ++ id -u ++ id -g + sudo chown -R 1000:1000 /dev/snd + [[ 4 = max ]] + [[ 4 = half ]] ++ id -u ++ id -g + sudo chown -R 1000:1000 /dev/snd + exec qemu-system-x86_64 -m 4000 -cpu Penryn,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check, -machine q35,accel=kvm:tcg -smp 4,cores=4 -usb -device usb-kbd -device usb-tablet -device 'isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc' -drive if=pflash,format=raw,readonly=on,file=/home/arch/OSX-KVM/OVMF_CODE.fd -drive if=pflash,format=raw,file=/home/arch/OSX-KVM/OVMF_VARS-1024x768.fd -smbios type=2 -audiodev alsa,id=hda -device ich9-intel-hda -device hda-duplex,audiodev=hda -device ich9-ahci,id=sata -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2 -device ide-hd,bus=sata.2,drive=OpenCoreBoot -device ide-hd,bus=sata.3,drive=InstallMedia -drive id=InstallMedia,if=none,file=/home/arch/OSX-KVM/BaseSystem.img,format=qcow2 -drive id=MacHDD,if=none,file=/home/arch/OSX-KVM/mac_hdd_ng.img,format=qcow2 -device ide-hd,bus=sata.4,drive=MacHDD -netdev user,id=net0,hostfwd=tcp::10022-:22,hostfwd=tcp::5900-:5900, -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:09:49:17 -monitor stdio -boot menu=on -vga vmware qemu-system-x86_64: warning: dbind: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-Xvi7KiZi6m: Connection refused QEMU 6.2.0 monitor - type 'help' for more information (qemu) qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory ```
Author
Owner

@sickcodes commented on GitHub (Jan 5, 2022):

Cannot allocate memory
But it also appears that the server does not support nested virtualization

@sickcodes commented on GitHub (Jan 5, 2022): `Cannot allocate memory` But it also appears that the server does not support **nested virtualization**
Author
Owner

@mattpackwood commented on GitHub (Jan 6, 2022):

I fixed that, turned it on in the UEFI / VM Settings...

@mattpackwood commented on GitHub (Jan 6, 2022): I fixed that, turned it on in the UEFI / VM Settings...
Author
Owner

@mattpackwood commented on GitHub (Jan 12, 2022):

Is there an "optimum" OS I should run this on?

@mattpackwood commented on GitHub (Jan 12, 2022): Is there an "optimum" OS I should run this on?
Author
Owner

@mattpackwood commented on GitHub (Jan 26, 2022):

@sickcodes What OS do people "typically" use?

@mattpackwood commented on GitHub (Jan 26, 2022): @sickcodes What OS do people "typically" use?
Author
Owner

@sickcodes commented on GitHub (Jan 26, 2022):

Arch (btw), Ubuntu

In the tests folder is my exact script to create the upload images via digital ocean

@sickcodes commented on GitHub (Jan 26, 2022): Arch (btw), Ubuntu In the tests folder is my exact script to create the upload images via digital ocean
Author
Owner

@mattpackwood commented on GitHub (Jan 26, 2022):

I will give that a try!

@mattpackwood commented on GitHub (Jan 26, 2022): I will give that a try!
Author
Owner

@mattpackwood commented on GitHub (Jan 28, 2022):

I set up a Droplet, ran the test.sh script and got "this"
Screen Shot 2022-01-27 at 8 09 07 PM

Now I need to work out how to get VNC to connect....

@mattpackwood commented on GitHub (Jan 28, 2022): I set up a Droplet, ran the test.sh script and got "this" <img width="1070" alt="Screen Shot 2022-01-27 at 8 09 07 PM" src="https://user-images.githubusercontent.com/1097448/151469460-68fad35a-d72d-42ad-8903-470a1c32a571.png"> Now I need to work out how to get VNC to connect....
Author
Owner

@mattpackwood commented on GitHub (Feb 3, 2022):

@sickcodes No luck with VNC, are there any instructions?

@mattpackwood commented on GitHub (Feb 3, 2022): @sickcodes No luck with VNC, are there any instructions?
Author
Owner

@sickcodes commented on GitHub (Mar 11, 2022):

test.sh makes every image and takes screenshots of every image working.

So they're definitely working, albeit in a virtual framebuffer :)

The best VNC to use is native qemu VNC: https://github.com/sickcodes/Docker-OSX#building-a-headless-container-which-allows-insecure-vnc-on-localhost-for-local-use-only

@sickcodes commented on GitHub (Mar 11, 2022): test.sh makes every image and takes screenshots of every image working. So they're definitely working, albeit in a virtual framebuffer :) The best VNC to use is native qemu VNC: https://github.com/sickcodes/Docker-OSX#building-a-headless-container-which-allows-insecure-vnc-on-localhost-for-local-use-only
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#297