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.2k stars 1.79k forks source link

Not able to run Docker-OSX on WSLg in windows 11 #430

Open sonook opened 2 years ago

sonook commented 2 years ago

Hi,

i have followed all the steps in windows 11 for running Docker-OSX on WSL but getting below error.

root@5CD1407WWJ:/mnt/c/Users/sonook# docker run -it \

--device /dev/kvm \
-p 888:888 \
-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 opendefault': 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 opendefault': 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 voiceadc' gtk initialization failed
kris-hamade commented 2 years ago

I am having this same issue

sonook commented 2 years ago

i am able to run finally after hours of troubleshooting. I have used VNC method.

https://youtu.be/BxBw16OCQME

sickcodes commented 2 years ago

This is the gtk initialization failed error, I'm gonna work on the windows instructions, have you jumped in the discord? Link on http://sick.chat and we're working on making Windows instructions better

evilz commented 2 years ago

I run on wsl2g Everytime. I launch the docker command from Ubuntu.

dazbeattie commented 2 years ago

I run on wsl2g Everytime. I launch the docker command from Ubuntu.

I agree. Had issues running it within Windows, but from Ubuntu WSL2, no issues

VIEWVIEWVIEW commented 2 years ago

Hey,

if you used WSL2 under Windows 10 previously and upgraded to Windows 11 via windows update (no clean w11 installation): you need to update your WSL2 VM first.

# Update WSL2 (run powershell with administrator privileges)
wsl --update

# Shut any down all VMs
wsl --shutdown

# Wait at least 8 seconds. See for more info: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#the-8-second-rule

# Start wsl again
wsl

# Test if display output works now
xeyes

# Run your docker container
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-e "DISPLAY=${DISPLAY:-:0}" \
-v /mnt/wslg/.X11-unix:/tmp/.X11-unix \
sickcodes/docker-osx:latest

Hope this helps :)

mensdev commented 9 months ago

Hey,

if you used WSL2 under Windows 10 previously and upgraded to Windows 11 via windows update (no clean w11 installation): you need to update your WSL2 VM first.

# Update WSL2 (run powershell with administrator privileges)
wsl --update

# Shut any down all VMs
wsl --shutdown

# Wait at least 8 seconds. See for more info: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#the-8-second-rule

# Start wsl again
wsl

# Test if display output works now
xeyes

# Run your docker container
docker run -it \
--device /dev/kvm \
-p 50922:10022 \
-e "DISPLAY=${DISPLAY:-:0}" \
-v /mnt/wslg/.X11-unix:/tmp/.X11-unix \
sickcodes/docker-osx:latest

Hope this helps :)

Worked for me. But before that, I manually switched to WSL 1 and didn’t update from 10 to 11. Thanks!