Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qemu stderr: gtk initialization failed #272

Open
mikoday opened this issue Oct 28, 2024 · 2 comments
Open

Qemu stderr: gtk initialization failed #272

mikoday opened this issue Oct 28, 2024 · 2 comments
Labels

Comments

@mikoday
Copy link

mikoday commented Oct 28, 2024

Hello, I'm trying to make Windows image on Ubuntu 24.04.1 (Noble Numbat) but have below error:
Qemu stderr: gtk initialization failed
I even build Qemu from source with these parameters but without success.
./configure --enable-gtk --enable-slirp

Here is my output:
root@maas:/home/maas/packer-maas/windows# make windows ISO=/home/maas/en-us_windows_11_business_editions_version_24h2_x64.iso VERSION=11 windows.json PACKER_LOG=1
rm -f -rf output-* windows.tar.gz http/Autounattend.xml \
drivers.iso OVMF_VARS.fd
cp -v /usr/share/OVMF/OVMF_VARS_4M.fd OVMF_VARS.fd
'/usr/share/OVMF/OVMF_VARS_4M.fd' -> 'OVMF_VARS.fd'
mkisofs -o drivers.iso -V 'Extra Drivers' -input-charset utf-8 drivers
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 2198
Path table size(bytes): 22
Max brk space used 0
176 extents written (0 MB)
sed s#@VERSION@#"Windows 11 PRO"#g http/Autounattend.xml.uefi.template > http/Autounattend.xml
sed -i 's/<!--<LocalAccounts>/<LocalAccounts>/;s/<\/LocalAccounts>-->/<\/LocalAccounts>/' http/Autounattend.xml
packer init . && packer build -var iso_path=/home/maas/en-us_windows_11_business_editions_version_24h2_x64.iso \
-var headless=false \
-var ovmf_suffix=_4M \
windows.pkr.hcl
2024/10/28 15:49:37 [INFO] Packer version: 1.11.2 [go1.21.12 linux amd64]
2024/10/28 15:49:37 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/10/28 15:49:37 [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig
2024/10/28 15:49:37 [WARN] Config file doesn't exist: /root/.packerconfig
2024/10/28 15:49:37 [INFO] Setting cache directory: /root/.cache/packer
2024/10/28 15:49:37 [TRACE] init: plugingetter.ListInstallationsOptions{PluginDirectory:"/root/.config/packer/plugins", BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0007ee000)}}, ReleasesOnly:true}}
2024/10/28 15:49:37 [TRACE] listing potential installations for "github.com/hashicorp/qemu" that match "~> 1.0". plugingetter.ListInstallationsOptions{PluginDirectory:"/root/.config/packer/plugins", BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0007ee000)}}, ReleasesOnly:true}}
2024/10/28 15:49:37 [INFO] (telemetry) Finalizing.
2024/10/28 15:49:37 waiting for all plugin processes to complete...
2024/10/28 15:49:37 [INFO] Packer version: 1.11.2 [go1.21.12 linux amd64]
2024/10/28 15:49:37 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/10/28 15:49:37 [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig
2024/10/28 15:49:37 [WARN] Config file doesn't exist: /root/.packerconfig
2024/10/28 15:49:37 [INFO] Setting cache directory: /root/.cache/packer
2024/10/28 15:49:37 [TRACE] listing potential installations for "github.com/hashicorp/qemu" that match "~> 1.0". plugingetter.ListInstallationsOptions{PluginDirectory:"/root/.config/packer/plugins", BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0000d8a80)}}, ReleasesOnly:false}}
2024/10/28 15:49:37 [TRACE] Found the following "github.com/hashicorp/qemu" installations: [{/root/.config/packer/plugins/github.com/hashicorp/qemu/packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 v1.1.0 x5.0}]
2024/10/28 15:49:37 [INFO] found external [-packer-default-plugin-name-] builders from qemu plugin
2024/10/28 15:49:37 [TRACE] listing potential installations for <nil> that match "". plugingetter.ListInstallationsOptions{PluginDirectory:"/root/.config/packer/plugins", BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000802100)}}, ReleasesOnly:false}}
2024/10/28 15:49:37 [INFO] found external [-packer-default-plugin-name-] builders from qemu plugin
2024/10/28 15:49:37 [TRACE] validateValue: not active for iso_path, so skipping
2024/10/28 15:49:37 [TRACE] validateValue: not active for ovmf_suffix, so skipping
2024/10/28 15:49:37 [TRACE] validateValue: not active for filename, so skipping
2024/10/28 15:49:37 [TRACE] validateValue: not active for headless, so skipping
2024/10/28 15:49:37 [INFO] Starting external plugin /root/.config/packer/plugins/github.com/hashicorp/qemu/packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 start builder -packer-default-plugin-name-
2024/10/28 15:49:37 Starting plugin: /root/.config/packer/plugins/github.com/hashicorp/qemu/packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 []string{"/root/.config/packer/plugins/github.com/hashicorp/qemu/packer-plugin-qemu_v1.1.0_x5.0_linux_amd64", "start", "builder", "-packer-default-plugin-name-"}
2024/10/28 15:49:37 Waiting for RPC address for: /root/.config/packer/plugins/github.com/hashicorp/qemu/packer-plugin-qemu_v1.1.0_x5.0_linux_amd64
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Plugin address: unix /tmp/packer-plugin4224969945
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Waiting for connection...
2024/10/28 15:49:37 Received unix RPC address for /root/.config/packer/plugins/github.com/hashicorp/qemu/packer-plugin-qemu_v1.1.0_x5.0_linux_amd64: addr is /tmp/packer-plugin4224969945
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Serving a plugin connection...
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 [TRACE] starting builder -packer-default-plugin-name-
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 use specified accelerator: kvm
2024/10/28 15:49:37 [INFO] Starting internal plugin packer-post-processor-shell-local
2024/10/28 15:49:37 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "execute", "packer-post-processor-shell-local"}
2024/10/28 15:49:37 Waiting for RPC address for: /usr/bin/packer
2024/10/28 15:49:37 packer-post-processor-shell-local plugin: [INFO] Packer version: 1.11.2 [go1.21.12 linux amd64]
2024/10/28 15:49:37 packer-post-processor-shell-local plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/10/28 15:49:37 packer-post-processor-shell-local plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig
2024/10/28 15:49:37 packer-post-processor-shell-local plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2024/10/28 15:49:37 packer-post-processor-shell-local plugin: [INFO] Setting cache directory: /root/.cache/packer
2024/10/28 15:49:37 packer-post-processor-shell-local plugin: args: []string{"packer-post-processor-shell-local"}
2024/10/28 15:49:37 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin3417990858
2024/10/28 15:49:37 packer-post-processor-shell-local plugin: Plugin address: unix /tmp/packer-plugin3417990858
2024/10/28 15:49:37 packer-post-processor-shell-local plugin: Waiting for connection...
2024/10/28 15:49:37 packer-post-processor-shell-local plugin: Serving a plugin connection...
2024/10/28 15:49:37 [INFO] Starting internal plugin packer-post-processor-compress
2024/10/28 15:49:37 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "execute", "packer-post-processor-compress"}
2024/10/28 15:49:37 Waiting for RPC address for: /usr/bin/packer
2024/10/28 15:49:37 packer-post-processor-compress plugin: [INFO] Packer version: 1.11.2 [go1.21.12 linux amd64]
2024/10/28 15:49:37 packer-post-processor-compress plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/10/28 15:49:37 packer-post-processor-compress plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig
2024/10/28 15:49:37 packer-post-processor-compress plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2024/10/28 15:49:37 packer-post-processor-compress plugin: [INFO] Setting cache directory: /root/.cache/packer
2024/10/28 15:49:37 packer-post-processor-compress plugin: args: []string{"packer-post-processor-compress"}
2024/10/28 15:49:37 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin1639003625
2024/10/28 15:49:37 packer-post-processor-compress plugin: Plugin address: unix /tmp/packer-plugin1639003625
2024/10/28 15:49:37 packer-post-processor-compress plugin: Waiting for connection...
2024/10/28 15:49:37 packer-post-processor-compress plugin: Serving a plugin connection...
a checksum is highly recommended.
on windows.pkr.hcl line 33:
(source code not available)
2024/10/28 15:49:37 Build debug mode: false
2024/10/28 15:49:37 Force build: false
2024/10/28 15:49:37 On error:
Warning: A checksum of 'none' was specified. Since ISO files are so big,
2024/10/28 15:49:37 Waiting on builds to complete...
2024/10/28 15:49:37 Starting build run: qemu.windows_builder
2024/10/28 15:49:37 Running builder: qemu
2024/10/28 15:49:37 [INFO] (telemetry) Starting builder qemu.windows_builder
a checksum is highly recommended.
on windows.pkr.hcl line 33:
(source code not available)
qemu.windows_builder: output will be in this color.
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Qemu path: /usr/local/bin/qemu-system-x86_64, Qemu Image path: /usr/local/bin/qemu-img
==> qemu.windows_builder: Retrieving ISO
==> qemu.windows_builder: Trying /home/maas/en-us_windows_11_business_editions_version_24h2_x64.iso
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Acquiring lock for: /home/maas/en-us_windows_11_business_editions_version_24h2_x64.iso (/root/.cache/packer/84ed5b25e3023beebbaf63bf14ff2ed108102fa9.iso.lock)
==> qemu.windows_builder: Trying /home/maas/en-us_windows_11_business_editions_version_24h2_x64.iso
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Leaving retrieve loop for ISO
==> qemu.windows_builder: /home/maas/en-us_windows_11_business_editions_version_24h2_x64.iso => /home/maas/en-us_windows_11_business_editions_version_24h2_x64.iso
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Floppy label is set to flop
==> qemu.windows_builder: Creating floppy disk...
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Floppy path: /tmp/packer65686085
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Initializing block device backed by temporary file
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Formatting the block device with a FAT filesystem...
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Initializing FAT filesystem on block device
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Reading the root directory from the filesystem
qemu.windows_builder: Copying files flatly from floppy_files
qemu.windows_builder: Copying file: ./http/Autounattend.xml
qemu.windows_builder: Copying file: ./http/logon.ps1
qemu.windows_builder: Copying file: ./http/rh.cer
qemu.windows_builder: Done copying files from floppy_files
qemu.windows_builder: Collecting paths from floppy_dirs
qemu.windows_builder: Resulting paths from floppy_dirs : []
qemu.windows_builder: Done copying paths from floppy_dirs
qemu.windows_builder: Copying files from floppy_content
qemu.windows_builder: Done copying files from floppy_content
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 No CD files specified. CD disk will not be made.
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 [INFO] Creating disk with Path: output-windows_builder/packer-windows_builder and Size: 20G
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Executing qemu-img: []string{"create", "-f", "raw", "output-windows_builder/packer-windows_builder", "20G"}
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 stdout: Formatting 'output-windows_builder/packer-windows_builder', fmt=raw size=21474836480
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 stderr:
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Found available port: 8750 on IP: 0.0.0.0
==> qemu.windows_builder: Starting HTTP server on port 8750
qemu.windows_builder: No communicator is set; skipping port forwarding setup.
==> qemu.windows_builder: Looking for available port between 5900 and 6000 on 0.0.0.0
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Looking for available port between 5900 and 6000 on 0.0.0.0
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Found available port: 5955 on IP: 0.0.0.0
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Found available VNC port: 5955 on IP: 0.0.0.0
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Qemu --version output: QEMU emulator version 9.1.1
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Qemu version: 9.1.1
==> qemu.windows_builder: Starting VM, booting from CD-ROM
==> qemu.windows_builder: Overriding default Qemu arguments with qemuargs template option...
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Executing /usr/local/bin/qemu-system-x86_64: []string{"-machine", "type=q35,accel=kvm", "-cpu", "host", "-name", "packer-windows_builder", "-fda", "/tmp/packer65686085", "-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd", "-drive", "if=pflash,format=raw,id=ovmf_vars,file=OVMF_VARS.fd", "-drive", "file=output-windows_builder/packer-windows_builder,format=raw", "-drive", "file=drivers.iso,media=cdrom,index=3", "-cdrom", "/home/maas/en-us_windows_11_business_editions_version_24h2_x64.iso", "-smp", "2", "-display", "gtk", "-device", "e1000,netdev=user.0", "-serial", "stdio", "-boot", "d", "-netdev", "user,id=user.0", "-vnc", "0.0.0.0:55", "-m", "4096M"}
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Started Qemu. Pid: 2153
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Qemu stderr: WARNING: Image format was not specified for '/tmp/packer65686085' and probing guessed raw.
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Qemu stderr: Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Qemu stderr: Specify the 'raw' format explicitly to remove the restrictions.
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Qemu stderr: gtk initialization failed
==> qemu.windows_builder: Error launching VM: Qemu failed to start. Please run with PACKER_LOG=1 to get more info.
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 failed to unlock port lockfile: close tcp [::]:5955: use of closed network connection
2024/10/28 15:49:37 packer-plugin-qemu_v1.1.0_x5.0_linux_amd64 plugin: 2024/10/28 15:49:37 Deleting floppy disk: /tmp/packer65686085
==> qemu.windows_builder: Deleting output directory...
2024/10/28 15:49:37 [INFO] (telemetry) ending qemu.windows_builder
==> Wait completed after 136 milliseconds 120 microseconds
2024/10/28 15:49:37 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2024/10/28 15:49:37 machine readable: qemu.windows_builder,error []string{"Build was halted."}
==> Builds finished but no artifacts were created.
Build 'qemu.windows_builder' errored after 136 milliseconds 102 microseconds: Build was halted.
2024/10/28 15:49:37 [INFO] (telemetry) Finalizing.
==> Wait completed after 136 milliseconds 120 microseconds
==> Some builds didn't complete successfully and had errors:
--> qemu.windows_builder: Build was halted.
==> Builds finished but no artifacts were created.
2024/10/28 15:49:38 waiting for all plugin processes to complete...
2024/10/28 15:49:38 /usr/bin/packer: plugin process exited
2024/10/28 15:49:38 /root/.config/packer/plugins/github.com/hashicorp/qemu/packer-plugin-qemu_v1.1.0_x5.0_linux_amd64: plugin process exited
2024/10/28 15:49:38 /usr/bin/packer: plugin process exited
make: *** [Makefile:58: windows] Error 1
rm http/Autounattend.xml

@alanbach
Copy link
Contributor

Hello @mikoday Try adding the following under the qemuargs in the hcl file to to see if the error goes away?

["-display", "none"]

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants