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
36.13k stars 1.78k forks source link

WSL2 on Windows 11 crashing out on run #328

Open a10kiloham opened 2 years ago

a10kiloham commented 2 years ago

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

Linux LENOVO-920X 5.10.43.3-microsoft-standard-WSL2 #1 SMP Wed Jun 16 23:47:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
172.21.112.1:0.0
1
NAME="Ubuntu"
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

/dev/sde        251G   40G  199G  17% /
none             16G   40K   16G   1% /mnt/wslg
none             16G  401M   16G   3% /mnt/wsl
/dev/sdd        251G  129G  110G  55% /mnt/wsl/docker-desktop-data/isocache
none             16G  8.0K   16G   1% /mnt/wsl/docker-desktop/shared-sockets/host-services
/dev/sdc        251G  132M  239G   1% /mnt/wsl/docker-desktop/docker-desktop-proxy
/dev/loop0      396M  396M     0 100% /mnt/wsl/docker-desktop/cli-tools
tools           931G  601G  330G  65% /init
none             16G     0   16G   0% /dev
none             16G  8.0K   16G   1% /run
none             16G     0   16G   0% /run/lock
none             16G     0   16G   0% /run/shm
none             16G     0   16G   0% /run/user
tmpfs            16G     0   16G   0% /sys/fs/cgroup
none             16G   76K   16G   1% /mnt/wslg/versions.txt
none             16G   76K   16G   1% /mnt/wslg/doc
drivers         931G  601G  330G  65% /usr/lib/wsl/drivers
lib             931G  601G  330G  65% /usr/lib/wsl/lib
drvfs           931G  601G  330G  65% /mnt/c

QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.17)

libvirtd (libvirt) 6.0.0

              total        used        free      shared  buff/cache   available
Mem:           31Gi       1.1Gi       263Mi       270Mi        29Gi        29Gi
Swap:         8.0Gi       248Mi       7.8Gi
12
24
crw-rw-rw- 1 xxx xxx 10, 232 Aug 11 12:31 /dev/kvm
total 0
drwxrwxrwx 2 root root   60 Aug 11 10:44 .
drwxrwxrwt 6 root root  260 Aug 11 10:44 ..
srwxrwxrwx 1 xxx users   0 Aug 11 10:44 X0
xxx 2881  0.0  0.0   8168   728 pts/2    S+   12:35   0:00 grep --color=auto dockerd
kvm:x:108:
docker:x:1001:xxx
libvirt:x:120:xxx
libvirt-qemu:x:64055:li

I can get this working great on bare metal Ubuntu but having issues on WSL2 now (with Windows 11).

With various configs I can get the X window up with the Apple logo, but then it crashes out.

In headless mode, I can get just to the point where there are a few fast moving lines about Legacy shim, then it crashes out again.

In other scenarios, it fails in docker on

docker-osx  | Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
docker-osx  | /usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
docker-osx  | ssh: connect to host 127.0.0.1 port 10022: Connection refused
docker-osx  | Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
docker-osx  | /usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
docker-osx  | ssh: connect to host 127.0.0.1 port 10022: Connection refused
docker-osx  | Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
docker-osx  | /usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
docker-osx  | ssh: connect to host 127.0.0.1 port 10022: Connection refused
docker-osx  | Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
docker-osx  | /usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
docker-osx  | ssh: connect to host 127.0.0.1 port 10022: Connection refused
docker-osx  | Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
docker-osx  | /usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
docker-osx  | ssh: connect to host 127.0.0.1 port 10022: Connection refused

Any ideas? I've tried the VNC version as well but it still seems to crash out on that too.

a10kiloham commented 2 years ago

The VNC version hangs here

docker-osx  |
docker-osx  | _XSERVTransmkdir: Mode of /tmp/.X11-unix should be set to 1777
docker-osx  | The XKEYBOARD keymap compiler (xkbcomp) reports:
docker-osx  | > Warning:          Could not resolve keysym XF86BrightnessAuto
docker-osx  | > Warning:          Could not resolve keysym XF86DisplayOff
docker-osx  | > Warning:          Could not resolve keysym XF86Info
docker-osx  | > Warning:          Could not resolve keysym XF86AspectRatio
docker-osx  | > Warning:          Could not resolve keysym XF86DVD
docker-osx  | > Warning:          Could not resolve keysym XF86Audio
docker-osx  | > Warning:          Could not resolve keysym XF86ChannelUp
docker-osx  | > Warning:          Could not resolve keysym XF86ChannelDown
docker-osx  | > Warning:          Could not resolve keysym XF86Break
docker-osx  | > Warning:          Could not resolve keysym XF86VideoPhone
docker-osx  | > Warning:          Could not resolve keysym XF86ZoomReset
docker-osx  | > Warning:          Could not resolve keysym XF86Editor
docker-osx  | > Warning:          Could not resolve keysym XF86GraphicsEditor
docker-osx  | > Warning:          Could not resolve keysym XF86Presentation
docker-osx  | > Warning:          Could not resolve keysym XF86Database
docker-osx  | > Warning:          Could not resolve keysym XF86Voicemail
docker-osx  | > Warning:          Could not resolve keysym XF86Addressbook
docker-osx  | > Warning:          Could not resolve keysym XF86DisplayToggle
docker-osx  | > Warning:          Could not resolve keysym XF86SpellCheck
docker-osx  | > Warning:          Could not resolve keysym XF86ContextMenu
docker-osx  | > Warning:          Could not resolve keysym XF86MediaRepeat
docker-osx  | > Warning:          Could not resolve keysym XF8610ChannelsUp
docker-osx  | > Warning:          Could not resolve keysym XF8610ChannelsDown
docker-osx  | > Warning:          Could not resolve keysym XF86Images
docker-osx  | > Warning:          Could not resolve keysym XF86NotificationCenter
docker-osx  | > Warning:          Could not resolve keysym XF86PickupPhone
docker-osx  | > Warning:          Could not resolve keysym XF86HangupPhone
docker-osx  | > Warning:          Could not resolve keysym XF86Fn
docker-osx  | > Warning:          Could not resolve keysym XF86Fn_Esc
docker-osx  | > Warning:          Could not resolve keysym XF86FnRightShift
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric0
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric1
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric2
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric3
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric4
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric5
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric6
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric7
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric8
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric9
docker-osx  | > Warning:          Could not resolve keysym XF86NumericStar
docker-osx  | > Warning:          Could not resolve keysym XF86NumericPound
docker-osx  | > Warning:          Could not resolve keysym XF86NumericA
docker-osx  | > Warning:          Could not resolve keysym XF86NumericB
docker-osx  | > Warning:          Could not resolve keysym XF86NumericC
docker-osx  | > Warning:          Could not resolve keysym XF86NumericD
docker-osx  | > Warning:          Could not resolve keysym XF86CameraFocus
docker-osx  | > Warning:          Could not resolve keysym XF86WPSButton
docker-osx  | > Warning:          Could not resolve keysym XF86CameraZoomIn
docker-osx  | > Warning:          Could not resolve keysym XF86CameraZoomOut
docker-osx  | > Warning:          Could not resolve keysym XF86CameraUp
docker-osx  | > Warning:          Could not resolve keysym XF86CameraDown
docker-osx  | > Warning:          Could not resolve keysym XF86CameraLeft
docker-osx  | > Warning:          Could not resolve keysym XF86CameraRight
docker-osx  | > Warning:          Could not resolve keysym XF86AttendantOn
docker-osx  | > Warning:          Could not resolve keysym XF86AttendantOff
docker-osx  | > Warning:          Could not resolve keysym XF86AttendantToggle
docker-osx  | > Warning:          Could not resolve keysym XF86LightsToggle
docker-osx  | > Warning:          Could not resolve keysym XF86ALSToggle
docker-osx  | > Warning:          Could not resolve keysym XF86Buttonconfig
docker-osx  | > Warning:          Could not resolve keysym XF86Taskmanager
docker-osx  | > Warning:          Could not resolve keysym XF86Journal
docker-osx  | > Warning:          Could not resolve keysym XF86ControlPanel
docker-osx  | > Warning:          Could not resolve keysym XF86AppSelect
docker-osx  | > Warning:          Could not resolve keysym XF86Screensaver
docker-osx  | > Warning:          Could not resolve keysym XF86VoiceCommand
docker-osx  | > Warning:          Could not resolve keysym XF86Assistant
docker-osx  | > Warning:          Could not resolve keysym XF86BrightnessMin
docker-osx  | > Warning:          Could not resolve keysym XF86BrightnessMax
docker-osx  | > Warning:          Could not resolve keysym XF86KbdInputAssistPrev
docker-osx  | > Warning:          Could not resolve keysym XF86KbdInputAssistNext
docker-osx  | > Warning:          Could not resolve keysym XF86KbdInputAssistPrevgroup
docker-osx  | > Warning:          Could not resolve keysym XF86KbdInputAssistNextgroup
docker-osx  | > Warning:          Could not resolve keysym XF86KbdInputAssistAccept
docker-osx  | > Warning:          Could not resolve keysym XF86KbdInputAssistCancel
docker-osx  | > Warning:          Could not resolve keysym XF86RightUp
docker-osx  | > Warning:          Could not resolve keysym XF86RightDown
docker-osx  | > Warning:          Could not resolve keysym XF86LeftUp
docker-osx  | > Warning:          Could not resolve keysym XF86LeftDown
docker-osx  | > Warning:          Could not resolve keysym XF86RootMenu
docker-osx  | > Warning:          Could not resolve keysym XF86MediaTopMenu
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric11
docker-osx  | > Warning:          Could not resolve keysym XF86Numeric12
docker-osx  | > Warning:          Could not resolve keysym XF86AudioDesc
docker-osx  | > Warning:          Could not resolve keysym XF863DMode
docker-osx  | > Warning:          Could not resolve keysym XF86NextFavorite
docker-osx  | > Warning:          Could not resolve keysym XF86StopRecord
docker-osx  | > Warning:          Could not resolve keysym XF86PauseRecord
docker-osx  | > Warning:          Could not resolve keysym XF86VOD
docker-osx  | > Warning:          Could not resolve keysym XF86Unmute
docker-osx  | > Warning:          Could not resolve keysym XF86FastReverse
docker-osx  | > Warning:          Could not resolve keysym XF86SlowReverse
docker-osx  | > Warning:          Could not resolve keysym XF86Data
docker-osx  | > Warning:          Could not resolve keysym XF86OnScreenKeyboard
docker-osx  | > Warning:          Could not resolve keysym XF86PrivacyScreenToggle
docker-osx  | > Warning:          Could not resolve keysym XF86SelectiveScreenshot
docker-osx  | > Warning:          Could not resolve keysym XF86Macro1
docker-osx  | > Warning:          Could not resolve keysym XF86Macro2
docker-osx  | > Warning:          Could not resolve keysym XF86Macro3
docker-osx  | > Warning:          Could not resolve keysym XF86Macro4
docker-osx  | > Warning:          Could not resolve keysym XF86Macro5
docker-osx  | > Warning:          Could not resolve keysym XF86Macro6
docker-osx  | > Warning:          Could not resolve keysym XF86Macro7
docker-osx  | > Warning:          Could not resolve keysym XF86Macro8
docker-osx  | > Warning:          Could not resolve keysym XF86Macro9
docker-osx  | > Warning:          Could not resolve keysym XF86Macro10
docker-osx  | > Warning:          Could not resolve keysym XF86Macro11
docker-osx  | > Warning:          Could not resolve keysym XF86Macro12
docker-osx  | > Warning:          Could not resolve keysym XF86Macro13
docker-osx  | > Warning:          Could not resolve keysym XF86Macro14
docker-osx  | > Warning:          Could not resolve keysym XF86Macro15
docker-osx  | > Warning:          Could not resolve keysym XF86Macro16
docker-osx  | > Warning:          Could not resolve keysym XF86Macro17
docker-osx  | > Warning:          Could not resolve keysym XF86Macro18
docker-osx  | > Warning:          Could not resolve keysym XF86Macro19
docker-osx  | > Warning:          Could not resolve keysym XF86Macro20
docker-osx  | > Warning:          Could not resolve keysym XF86Macro21
docker-osx  | > Warning:          Could not resolve keysym XF86Macro22
docker-osx  | > Warning:          Could not resolve keysym XF86Macro23
docker-osx  | > Warning:          Could not resolve keysym XF86Macro24
docker-osx  | > Warning:          Could not resolve keysym XF86Macro25
docker-osx  | > Warning:          Could not resolve keysym XF86Macro26
docker-osx  | > Warning:          Could not resolve keysym XF86Macro27
docker-osx  | > Warning:          Could not resolve keysym XF86Macro28
docker-osx  | > Warning:          Could not resolve keysym XF86Macro29
docker-osx  | > Warning:          Could not resolve keysym XF86Macro30
docker-osx  | > Warning:          Could not resolve keysym XF86MacroRecordStart
docker-osx  | > Warning:          Could not resolve keysym XF86MacroRecordStop
docker-osx  | > Warning:          Could not resolve keysym XF86MacroPresetCycle
docker-osx  | > Warning:          Could not resolve keysym XF86MacroPreset1
docker-osx  | > Warning:          Could not resolve keysym XF86MacroPreset2
docker-osx  | > Warning:          Could not resolve keysym XF86MacroPreset3
docker-osx  | > Warning:          Could not resolve keysym XF86KbdLcdMenu1
docker-osx  | > Warning:          Could not resolve keysym XF86KbdLcdMenu2
docker-osx  | > Warning:          Could not resolve keysym XF86KbdLcdMenu3
docker-osx  | > Warning:          Could not resolve keysym XF86KbdLcdMenu4
docker-osx  | > Warning:          Could not resolve keysym XF86KbdLcdMenu5
docker-osx  | Errors from xkbcomp are not fatal to the X server
a10kiloham commented 2 years ago

Running the VNC version is weird. I get this error

docker-osx  | + exec qemu-system-x86_64 -m 3000 -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-Catalina/OpenCore.qcow2 -device ide-hd,bus=sata.2,drive=OpenCoreBoot -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
docker-osx  | Unable to init server: Could not connect: Connection refused
docker-osx  | QEMU 6.0.0 monitor - type 'help' for more information
docker-osx  | (qemu) qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
docker-osx  | qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
docker-osx  | qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
docker-osx  | qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000007H:EDX.invtsc [bit 8]
docker-osx  | ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
docker-osx  | ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
docker-osx  | ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
docker-osx  | ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
docker-osx  | ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
docker-osx  | alsa: Could not initialize DAC
docker-osx  | alsa: Failed to open `default':
docker-osx  | alsa: Reason: No such file or directory
docker-osx  | ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
docker-osx  | ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
docker-osx  | ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
docker-osx  | ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
docker-osx  | ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
docker-osx  | alsa: Could not initialize DAC
docker-osx  | alsa: Failed to open `default':
docker-osx  | alsa: Reason: No such file or directory
docker-osx  | audio: Failed to create voice `dac'
docker-osx  | ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
docker-osx  | ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
docker-osx  | ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
docker-osx  | ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
docker-osx  | ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
docker-osx  | alsa: Could not initialize ADC
docker-osx  | alsa: Failed to open `default':
docker-osx  | alsa: Reason: No such file or directory
docker-osx  | ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
docker-osx  | ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
docker-osx  | ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
docker-osx  | ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
docker-osx  | ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
docker-osx  | ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
docker-osx  | alsa: Could not initialize ADC
docker-osx  | alsa: Failed to open `default':
docker-osx  | alsa: Reason: No such file or directory
docker-osx  | audio: Failed to create voice `adc'
docker-osx  | gtk initialization failed
docker-osx exited with code 1

nested virtualization is enabled now by default in the newest WSL.

a10kiloham commented 2 years ago

Docker via wsl2 on windows. So proper Ubuntu base

ltomes commented 2 years ago

I see the same behavior as your first post, wsl2, ubuntu, podman in rootless or privileged mode.

podman run -it --device /dev/kvm -p 50922:10022 -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" sickcodes/docker-osx:auto

Followed by a loop of

Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
ssh: connect to host 127.0.0.1 port 10022: Connection refused

Edit: Comments here got qemu started: https://github.com/sickcodes/Docker-OSX/issues/131#issuecomment-885930416 But I now panic. I am past the issue described on your ticket at any rate.

WordlessEcho commented 2 years ago

Following the README I have setup the Docker Desktop. image image

> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  Arch                   Running         2
  docker-desktop-data    Running         2
  docker-desktop         Running         2

With x11-apps installed and KVM was enabled by default.

$ sudo apt install x11-apps
Reading package lists... Done
Building dependency tree
Reading state information... Done
x11-apps is already the newest version (7.7+8).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

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

Run xhost +:

$ xhost +
access control disabled, clients can connect from any host

Here is the log I was got:

> docker run -it --device /dev/kvm -p 50922:10022 -v /mnt/wslg/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-: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 6.2.0 monitor - type 'help' for more information
(qemu) ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `dac'
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `adc'
gtk initialization failed
antoinegaspard commented 2 years ago

Same as @WordlessEcho, anyone have solution ?

WordlessEcho commented 2 years ago

Same as @WordlessEcho, anyone have solution ?

No. I had gave up for a long time.

sickcodes commented 2 years ago

Stale Apple logo means unsupported CPU, I tried it on the raspberry Pi.

But GTK error is fixed with xhost + and this should be added to the readme if anyone wants to make a PR:

    -v /mnt/wslg/.X11-unix:/tmp/.X11-unix \

Because Windows doesn't use /tmp/.X11-Unix, it uses the WSLg socket, apparently

Error996 commented 2 years ago

Stale Apple logo means unsupported CPU, I tried it on the raspberry Pi.

But GTK error is fixed with xhost + and this should be added to the readme if anyone wants to make a PR:

    -v /mnt/wslg/.X11-unix:/tmp/.X11-unix \

Because Windows doesn't use /tmp/.X11-Unix, it uses the WSLg socket, apparently

not work,same error

JustJoostNL commented 2 years ago

Is there a fix for it already? I have the same problem?

antoinegaspard commented 2 years ago

Unfortunately no, I gave up.

sembsa commented 1 year ago

Following the README I have setup the Docker Desktop. image image

> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  Arch                   Running         2
  docker-desktop-data    Running         2
  docker-desktop         Running         2

With x11-apps installed and KVM was enabled by default.

$ sudo apt install x11-apps
Reading package lists... Done
Building dependency tree
Reading state information... Done
x11-apps is already the newest version (7.7+8).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

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

Run xhost +:

$ xhost +
access control disabled, clients can connect from any host

Here is the log I was got:

> docker run -it --device /dev/kvm -p 50922:10022 -v /mnt/wslg/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-: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 6.2.0 monitor - type 'help' for more information
(qemu) ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `dac'
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `adc'
gtk initialization failed

Try run command: docker run in Ubuntu terminal, download Wndows Terminal and open ubuntu termianl