Skip to content

Error "gtk initialization failed" #7

Closed

Description

@miguelmota

Followed the steps on readme but getting an error when running docker container.

Here are the steps to reproduce:

$ sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison ebtables edk2-ovmf
[sudo] password for mota:
warning: qemu-4.2.0-2 is up to date -- reinstalling
warning: libvirt-5.10.0-3 is up to date -- reinstalling
warning: dnsmasq-2.81-3 is up to date -- reinstalling
warning: virt-manager-2.2.1-2 is up to date -- reinstalling
warning: bridge-utils-1.6-4 is up to date -- reinstalling
warning: flex-2.6.4-3 is up to date -- reinstalling
warning: bison-3.5.4-1 is up to date -- reinstalling
warning: ebtables-2.0.10_4-7 is up to date -- reinstalling
warning: edk2-ovmf-202002-7 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (9) bison-3.5.4-1  bridge-utils-1.6-4  dnsmasq-2.81-3  ebtables-2.0.10_4-7  edk2-ovmf-202002-7  flex-2.6.4-3
             libvirt-5.10.0-3  qemu-4.2.0-2  virt-manager-2.2.1-2

Total Installed Size:  85.76 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n] Y
(9/9) checking keys in keyring                                            [##########################################] 100%
(9/9) checking package integrity                                          [##########################################] 100%
(9/9) loading package files                                               [##########################################] 100%
(9/9) checking for file conflicts                                         [##########################################] 100%
(9/9) checking available disk space                                       [##########################################] 100%
warning: could not get file information for run/libvirt/
warning: could not get file information for run/libvirt/lockd/
warning: could not get file information for run/libvirt/lxc/
warning: could not get file information for run/libvirt/network/
warning: could not get file information for run/libvirt/qemu/
warning: could not get file information for run/libvirt/qemu/swtpm/
:: Running pre-transaction hooks...
(1/1) Checking Arch News ...
:: Processing package changes...
(1/9) reinstalling qemu                                                   [##########################################] 100%
(2/9) reinstalling libvirt                                                [##########################################] 100%
(3/9) reinstalling dnsmasq                                                [##########################################] 100%
(4/9) reinstalling virt-manager                                           [##########################################] 100%
(5/9) reinstalling bridge-utils                                           [##########################################] 100%
(6/9) reinstalling flex                                                   [##########################################] 100%
(7/9) reinstalling bison                                                  [##########################################] 100%
(8/9) reinstalling ebtables                                               [##########################################] 100%
(9/9) reinstalling edk2-ovmf                                              [##########################################] 100%
:: Running post-transaction hooks...
( 1/10) Creating system user accounts...
( 2/10) Reloading system manager configuration...
( 3/10) Applying kernel sysctl settings...
( 4/10) Reloading device manager configuration...
( 5/10) Arming ConditionNeedsUpdate...
( 6/10) Reloading system bus configuration...
( 7/10) Compiling GSettings XML schema files...
( 8/10) Updating icon theme caches...
( 9/10) Updating the info directory file...
(10/10) Updating the desktop file MIME type cache...

$ reboot
$ docker pull sickcodes/docker-osx
Using default tag: latest
latest: Pulling from sickcodes/docker-osx
Digest: sha256:79814aad5e234dca5676616e43a9a5120d0ec9ab1b2e0100fec450248ef58675
Status: Image is up to date for sickcodes/docker-osx:latest
docker.io/sickcodes/docker-osx:latest
$ docker run --privileged -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx
No protocol specified
Unable to init server: Could not connect: Connection refused
QEMU 5.0.0 monitor - type 'help' for more information
(qemu) ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5181:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(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:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5181:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(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:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5181:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(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:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5181:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(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
$ uname -a
Linux archlinux 5.6.10-arch1-1 #1 SMP PREEMPT Sat, 02 May 2020 19:11:54 +0000 x86_64 GNU/Linux
$ neofetch
                   -`                    mota@archlinux
                  .o+`                   --------------
                 `ooo/                   OS: Arch Linux x86_64
                `+oooo:                  Host: 20L50010US ThinkPad T480
               `+oooooo:                 Kernel: 5.6.10-arch1-1
               -+oooooo+:                Uptime: 6 mins
             `/:-:++oooo+:               Packages: 1350 (pacman), 8 (flatpak)
            `/++++/+++++++:              Shell: bash 5.0.16
           `/++++++++++++++:             Resolution: 1920x1080
          `/+++ooooooooooooo/`           WM: bspwm
         ./ooosssso++osssssso+`          Theme: Arc-Dark [GTK2/3]
        .oossssso-````/ossssss+`         Icons: Papirus-Dark [GTK2/3]
       -osssssso.      :ssssssso.        Terminal: alacritty
      :osssssss/        osssso+++.       CPU: Intel i7-8650U (8) @ 4.200GHz
     /ossssssss/        +ssssooo/-       GPU: Intel UHD Graphics 620
   `/ossssso+/:-        -:/+osssso+-     Memory: 2108MiB / 64069MiB
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/
 .`                                 `/

Virtualization is enabled in bios:

out

Any help is appreciated. Thanks!

Activity

  1. sickcodes commented on Jun 5, 2020

    @sickcodes
    Owner

    Working on it

  2. raoulh commented on Jun 5, 2020

    @raoulh

    Same here. I did this to make it work:

    sudo pacman -S xorg-xhost
    

    Then disable access control from X11:

    xhost +
    

    And run the docker command again. It worked then.

  3. sickcodes commented on Jun 5, 2020

    @sickcodes
    Owner

    Thanks Raoulh!

    
    echo $DISPLAY
    
    # ARCH
    sudo pacman -S xorg-xhost
    
    # UBUNTU DEBIAN
    sudo apt install x11-xserver-utils
    
    # CENTOS RHEL FEDORA
    sudo yum install xorg-x11-server-utils
    
    # then run
    xhost +
    
    docker run --privileged -e "DISPLAY=${DISPLAY:-:0.0}" -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx ./OpenCore-Boot.sh
    
  4. sickcodes commented on Jun 5, 2020

    @sickcodes
    Owner

    Same here. I did this to make it work:

    sudo pacman -S xorg-xhost
    

    Then disable access control from X11:

    xhost +
    

    And run the docker command again. It worked then.

    Worked a treat! @raoulh

  5. iiordanov commented on Nov 23, 2021

    @iiordanov

    @sickcodes thanks for your awesome work!

    Just in case this helps people who would like to run this headless. I saw that there is a really helpful EXTRA variable that may be utilized to start qemu's built-in VNC server. For instance:

    sudo docker run -it --device /dev/kvm -p5910:5900 -p 50922:10022 -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" -e GENERATE_UNIQUE=true -e TERMS_OF_USE=i_agree -e EXTRA='-vnc :0' sickcodes/docker-osx:auto

    Will run docker-osx:auto with VNC port 5910 on the host machine forwarded to qemu's VNC server started at 5900 as per the EXTRA variable. The default VNC password appears to be alpine.

  6. gopalkhasria commented on Nov 14, 2024

    @gopalkhasria

    I am getting this on windows. Is there a way to wix it?

  7. 5E7EN commented on Nov 27, 2024

    @5E7EN

    I am getting this on windows. Is there a way to wix it?

    @gopalkhasria
    I've got it working using the updated command found in PR #774.

    docker run  --device /dev/kvm -v /run/desktop/mnt/host/wslg/.X11-unix:/tmp/.X11-unix -v /run/desktop/mnt/host/wslg:/mnt/wslg -e DISPLAY=:0 sickcodes/docker-osx:ventura
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions