Docker-OSX icon indicating copy to clipboard operation
Docker-OSX copied to clipboard

Docker does not start: (qemu) gtk initialization failed

Open ennrl opened this issue 1 year ago • 11 comments

NAME="Manjaro Linux" PRETTY_NAME="Manjaro Linux" Файловая система Размер Использовано Дост Использовано% Cмонтировано в /dev/nvme0n1p2 225G 119G 95G 56% / QEMU emulator version 9.0.1 Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers libvirtd (libvirt) 10.5.0 free: Multiple unit options don't make sense. 4 egrep: warning: egrep is obsolescent; using grep -E 8 crw-rw-rw- 1 root kvm 10, 232 июл 18 02:30 /dev/kvm итого 0 drwxrwxrwt 2 root root 120 июл 18 02:23 . drwxrwxrwt 17 root root 420 июл 18 02:33 .. srwxr-xr-x 1 akkenrl akkenrl 0 июл 18 02:23 X0 srwxr-xr-x 1 akkenrl akkenrl 0 июл 18 02:23 X1 srwxr-xr-x 1 gdm gdm 0 июл 18 02:23 X1024 srwxr-xr-x 1 gdm gdm 0 июл 18 02:23 X1025 root 1213 0.0 0.9 2347780 77164 ? Ssl 02:23 0:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock akkenrl 5555 0.0 0.0 6640 4340 pts/1 S+ 02:33 0:00 grep dockerd

Command:

sudo docker run --privileged -e "DISPLAY=${DISPLAY:-:0.0}" -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx

Output:

ssh-keygen: generating new host keys: RSA ECDSA ED25519 ++ 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 Authorization required, but no authorization protocol specified

QEMU 8.0.2 monitor - type 'help' for more information (qemu) gtk initialization failed

ennrl avatar Jul 17 '24 23:07 ennrl

You need X11, possibly you are on Wayland, just install xorg-host using these commands.

To know your graphic environment: echo $XDG_SESSION_TYPE

Try this

sudo pacman -S xorg-xhost

Allow Docker to access xorg-host:

xhost +local:docker

jdic avatar Jul 25 '24 00:07 jdic

@jdic Can we not use it on Wayland or those are the steps to run it on Wayland?

PixsaOJ avatar Jul 26 '24 18:07 PixsaOJ

@jdic Can we not use it on Wayland or those are the steps to run it on Wayland?

I'm on Wayland, and those steps solved my problem.

$ echo $XDG_SESSION_TYPE
wayland

jdic avatar Jul 26 '24 18:07 jdic

I have the same problem i am using fedora workstation on x11 what command should i run to show detalils

Zero2wo avatar Jul 31 '24 12:07 Zero2wo

xhost + or if you sudo sudo xhost +

PixsaOJ avatar Jul 31 '24 12:07 PixsaOJ

Doesn't run

Here's the output

ssh-keygen: generating new host keys: RSA ECDSA ED25519 
nohup: appending output to 'nohup.out'
++ id -u
++ id -g
+ sudo chown 1000:1000 /dev/kvm
+ true
++ 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 -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 -device usb-tablet,bus=xhci.0 -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 9.0.0 monitor - type 'help' for more information
(qemu) ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5204:(_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:5204:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(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:5204:(_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:5204:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(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: Could not create a backend for voice `dac'
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5204:(_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:5204:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(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:5204:(_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:5204:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(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: Could not create a backend for voice `adc'
gtk initialization failed

Zero2wo avatar Jul 31 '24 14:07 Zero2wo

Madep

ibraiiian avatar Aug 02 '24 22:08 ibraiiian

xhost + or if you sudo sudo xhost +

access control disabled, clients can connect from any host

Zero2wo avatar Aug 05 '24 14:08 Zero2wo

Yep. Same on Hyprland Wayland Linux. Tried run over this command. I remember that few weeks ago when I did it first time it at least run but boot was in loop

docker run -it --device /dev/kvm \ 
    -p 50922:10022 \
    -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY  \
    -e SHORTNAME=sequoia sickcodes/docker-osx:latest

syorito-hatsuki avatar Feb 08 '25 10:02 syorito-hatsuki

I've had the same problem. The issue was SELinux for me. Qemu tried to write into restricted file. Changing SELinux to permissive mode and ignoring that one error solved the issue for me. You can probably also follow the instruction in SELinux troubleshooter if you don't want to change SELinux permission.

I also did xhost +local:docker from @jdic second time I run docker, and I've picked Sonoma. Not sure if that make a difference, but the second time I noticed SELinux error.

jcubic avatar Aug 30 '25 14:08 jcubic

sudo pacman -S xorg-xhost
xhost +local:docker
sudo xhost +local:docker

and

sudo docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e GENERATE_UNIQUE=true \
    -e CPU='Haswell-noTSX' \
    -e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on' \
    -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist' \
    -e SHORTNAME=sequoia -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \
    sickcodes/docker-osx:latest

did the trick for me on Manjaro Plasma with Wayland.

GrauBlitz avatar Oct 10 '25 15:10 GrauBlitz