gtk initialization failed #642

Closed
opened 2025-12-29 01:24:08 +01:00 by adam · 2 comments
Owner

Originally created by @ademirtug on GitHub (Feb 13, 2025).

I'm encountering the error "GTK initialization failed" when running the following command from the Windows Terminal:

docker run -it --device /dev/kvm -p 50921:10022 -v /mnt/wslg/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" -e RAM=8 -e EXTRA='-smp 8,sockets=4,cores=2' -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=sonoma sickcodes/docker-osx:latest

However, if I first launch WSL (wsl) and then run the same command inside the WSL environment, everything works fine.

Is this the intended behavior?

Originally created by @ademirtug on GitHub (Feb 13, 2025). I'm encountering the error "GTK initialization failed" when running the following command from the Windows Terminal: `docker run -it --device /dev/kvm -p 50921:10022 -v /mnt/wslg/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" -e RAM=8 -e EXTRA='-smp 8,sockets=4,cores=2' -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=sonoma sickcodes/docker-osx:latest` However, if I first launch WSL (wsl) and then run the same command inside the WSL environment, everything works fine. Is this the intended behavior?
adam closed this issue 2025-12-29 01:24:08 +01:00
Author
Owner

@ipaqmaster commented on GitHub (Feb 22, 2025):

Experienced the same for SHORTNAME=ventura and SHORTNAME=sonoma.

Ran xhost + and it worked.

Relevant log lines:

Authorization required, but no authorization protocol specified
gtk initialization failed

@ipaqmaster commented on GitHub (Feb 22, 2025): Experienced the same for `SHORTNAME=ventura` and `SHORTNAME=sonoma`. Ran `xhost +` and it worked. Relevant log lines: `Authorization required, but no authorization protocol specified` `gtk initialization failed`
Author
Owner

@mohamadsy1234 commented on GitHub (Apr 9, 2025):

لحل مشكلة "فشل تهيئة GTK" عند تشغيل الأمر في Windows Terminal، اتبع الخطوات التالية:

1. تثبيت خادم X11 على Windows:

  • تنزيل وتثبيت VcXsrv من هنا.
  • عند التشغيل، اختر "Disable access control" في إعدادات الأمان لتسماح للحاوية بالاتصال.

2. تعديل متغير DISPLAY في الأمر:

  • استخدم عنوان host.docker.internal للاتصال بخادم X على الـ host:
    -e "DISPLAY=host.docker.internal:0.0"
    

3. إزالة مشاركة مجلد WSLg:

  • احذف الجزء التالي من الأمر، لأنه يعتمد على WSLg غير المتوفر خارج WSL:
    -v /mnt/wslg/.X11-unix:/tmp/.X11-unix
    

4. الأمر المعدل النهائي:

docker run -it --device /dev/kvm -p 50921:10022 \
  -e "DISPLAY=host.docker.internal:0.0" \
  -e RAM=8 \
  -e EXTRA='-smp 8,sockets=4,cores=2' \
  -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=sonoma \
  sickcodes/docker-osx:latest

5. تأكد من:

  • تشغيل VcXsrv قبل تنفيذ الأمر.
  • فتح الجدار الناري لـ VcXsrv إذا لزم الأمر.
  • أن Docker Desktop مهيأ لاستخدام WSL2 (إعدادات Docker → General → Use WSL 2 based engine).

ملاحظة: إذا استمرت المشكلة، جرب إضافة --network host إلى الأمر لتجنب مشاكل شبكة Docker.

@mohamadsy1234 commented on GitHub (Apr 9, 2025): لحل مشكلة "فشل تهيئة GTK" عند تشغيل الأمر في Windows Terminal، اتبع الخطوات التالية: ### 1. تثبيت خادم X11 على Windows: - **تنزيل وتثبيت VcXsrv** من [هنا](https://sourceforge.net/projects/vcxsrv/). - عند التشغيل، اختر "Disable access control" في إعدادات الأمان لتسماح للحاوية بالاتصال. ### 2. تعديل متغير `DISPLAY` في الأمر: - استخدم عنوان `host.docker.internal` للاتصال بخادم X على الـ host: ```bash -e "DISPLAY=host.docker.internal:0.0" ``` ### 3. إزالة مشاركة مجلد WSLg: - احذف الجزء التالي من الأمر، لأنه يعتمد على WSLg غير المتوفر خارج WSL: ```bash -v /mnt/wslg/.X11-unix:/tmp/.X11-unix ``` ### 4. الأمر المعدل النهائي: ```bash docker run -it --device /dev/kvm -p 50921:10022 \ -e "DISPLAY=host.docker.internal:0.0" \ -e RAM=8 \ -e EXTRA='-smp 8,sockets=4,cores=2' \ -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=sonoma \ sickcodes/docker-osx:latest ``` ### 5. تأكد من: - تشغيل VcXsrv قبل تنفيذ الأمر. - فتح الجدار الناري لـ VcXsrv إذا لزم الأمر. - أن Docker Desktop مهيأ لاستخدام WSL2 (إعدادات Docker → General → Use WSL 2 based engine). --- **ملاحظة:** إذا استمرت المشكلة، جرب إضافة `--network host` إلى الأمر لتجنب مشاكل شبكة Docker.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#642