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

gtk initialization failed #569

Open 10000-ki opened 1 year ago

10000-ki commented 1 year ago

Command

podman run -it --device /dev/kvm -p 50922:10022 docker.io/sickcodes/docker-osx:monterey

OS Version

NAME="Red Hat Enterprise Linux"
VERSION="8.6 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.6 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.6
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.6"

Error Message

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(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:5180:(_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:5180:(_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:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(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:5180:(_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:5180:(_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:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(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:5180:(_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:5180:(_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:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2666:(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

when using os tag like monterey occur error podman run -it --device /dev/kvm -p 50922:10022 docker.io/sickcodes/docker-osx:monterey

but using auto tag is okay

podman run -it --device /dev/kvm -p 50922:10022 docker.io/sickcodes/docker-osx:auto

Is there any solution?

RichardFevrier commented 1 year ago

Same with ventura for me 🙂

sickcodes commented 1 year ago

xhost + Check your display variable I will test the images

10000-ki commented 1 year ago
xhost +

xhost:  unable to open display ""

i found this error message

i think it required x-window mode

paddymahoney commented 1 year ago

Get the same on latest:

macosx    | (qemu) ++ id -u
macosx    | ++ id -g
macosx    | + sudo chown 0:0 /dev/kvm
macosx    | ++ id -u
macosx    | ++ id -g
macosx    | + sudo chown -R 0:0 /dev/snd
macosx    | + [[ 4 = max ]]
macosx    | + [[ 4 = half ]]
macosx    | ++ id -u
macosx    | ++ id -g
macosx    | + sudo chown -R 0:0 /dev/snd
macosx    | + 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
macosx    | QEMU 7.1.0 monitor - type 'help' for more information
macosx    | ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
macosx    | alsa: Could not initialize DAC
macosx    | alsa: Failed to open `default':
macosx    | alsa: Reason: No such file or directory
macosx    | ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
macosx    | alsa: Could not initialize DAC
macosx    | alsa: Failed to open `default':
macosx    | alsa: Reason: No such file or directory
macosx    | audio: Failed to create voice `dac'
macosx    | ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
macosx    | alsa: Could not initialize ADC
macosx    | alsa: Failed to open `default':
macosx    | alsa: Reason: No such file or directory
macosx    | ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
macosx    | alsa: Could not initialize ADC
macosx    | alsa: Failed to open `default':
macosx    | alsa: Reason: No such file or directory
macosx    | audio: Failed to create voice `adc'
macosx    | gtk initialization failed

Notes:

10000-ki commented 1 year ago

@sickcodes thank you for checking this issue

xhost +

above command It didn't work

Is there any other way?

bckelley commented 1 year ago

I get the same error my only assumption is it's because I'm running an Intel based processor i5-8250U (4) @ 3.4GHz will there be a fix??

Archisman-Mridha commented 1 year ago

I got the same error and i am also running intel based i5 processor.

lorenzholzbauer commented 1 year ago

Try using Xorg and not Wayland. With GNOME you have to log out and search for a little settings wheel, where you have to choose GNOME on Xorg.

Archisman-Mridha commented 1 year ago

Try using Xorg and not Wayland. With GNOME you have to log out and search for a little settings wheel, where you have to choose GNOME on Xorg.

I am using windows with docker-desktop and wsl2

lorenzholzbauer commented 1 year ago

Are you for real trying to run a MacOS VM in a Linux VM on a Windows PC? I think WSL doesn't even have Xorg installed by default. You may need to install Xorg. It may be easier to just run a MacOS VM in VirtualBox or something, but I don't know your exact usecase.

bphd commented 1 year ago

Try using Xorg and not Wayland. With GNOME you have to log out and search for a little settings wheel, where you have to choose GNOME on Xorg.

XWayLand run just fine on WayLand, many apps use X11 on WayLand. Why here it's a problem? It needs a special configuration?

I have an i5 too

lorenzholzbauer commented 1 year ago

As far as i know it doesn't work with XWayland. It started working after I switched to X11.

IsraPerez98 commented 1 year ago

I'm having the exact same problem on Fedora 37 with a Ryzen CPU and X11.

Even after running xhost + I can't get past that error

IsraPerez98 commented 1 year ago

Update: adding --privileged to the docker run command fixed the issue.

TahaOps commented 1 year ago

Fixed the issue for me ! Thank you

bphd commented 1 year ago

Update: adding --privileged to the docker run command fixed the issue.

Running as root can't be a viable solution. It's dangerous

10000-ki commented 1 year ago

@sickcodes hi Is there any solution about this problem yet?

Real-Gecko commented 1 year ago

Same issue on Arch Linux, tried everything, tried all available MacOS versions. Any ways to diagnose what's missing?

Real-Gecko commented 1 year ago

Running on Plasma on X

bphd commented 1 year ago

Same issue on Arch Linux, tried everything, tried all available MacOS versions. Any ways to diagnose what's missing?

Searching for what to diagnose since almost a year, but I discussed with the folks of the project and mostly their politic is that you're not worthy of using that project if you don't know how to debug it by yourself, if you're not a master of virtualization, containerization, Mac os, Linux under layers and such. So yeah, since I've just pushed that project back, doing other things, waiting for someone to have the same problem as me that the dev will be willing to help and get the solution from here