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

Sway fails to start in a fresh Debian 12 virtual machine under KVM/QEMU: "DRI2: failed to create screen". #8552

Open
higher-order opened this issue Jan 27, 2025 · 7 comments
Labels
bug Not working as intended

Comments

@higher-order
Copy link

(gdb) bt full
#0  0x00007fd99781f882 in ?? () from /usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so
No symbol table info available.
#1  0x00007fd99781fbdd in ?? () from /usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so
No symbol table info available.
#2  0x00007fd9978d266c in ?? () from /usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so
No symbol table info available.
#3  0x00007fd9978d34c5 in ?? () from /usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so
No symbol table info available.
#4  0x00007fd9978d35db in ?? () from /usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so
No symbol table info available.
#5  0x00007fd99730bf97 in ?? () from /usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so
No symbol table info available.
#6  0x00007fd99a2221c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
        ret = <optimized out>
        pd = <optimized out>
        out = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140572329240256, -2115298659480049604, -544, 2, 140728031792912, 140572320849920, 2096395304618485820, 2096363330870896700}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, 
              canceltype = 0}}}
        not_first_call = <optimized out>
#7  0x00007fd99a2a285c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
No locals.
  • Description:
    • I'm creating a new KVM/QEMU virtual machine with a fresh install of Debian 12, and trying to run Sway in it. My first attempt didn't install any DE like GNOME or KDE, since I thought I would be running Sway. After doing sudo apt install sway and then sway, it crashed with error messages saying "EGL_NOT_INITIALIZED", "DRI2: failed to create screen", etc.
      Image
    • I thought maybe some critical packages are missing. So I deleted the VM and restarted the install from scratch. This time I installed GNOME during Debian's installation wizard. After the installation finished, GNOME was able to run and everything appeared normal. GNOME appeared to run in Wayland rather than X11 as well, as indicated by echo $XDG_SESSION_TYPE. So I installed Sway, switched to another tty by pressing Ctrl-Alt-F3, and started Sway again. But the same error messages were shown. The logs and traces were uploaded above.
    • There aren't any dedicated GPUs on my laptop.
@higher-order higher-order added the bug Not working as intended label Jan 27, 2025
@emersion
Copy link
Member

This is a very old version of Sway. Can you reproduce with a more recent one, e.g. by building from source?

@higher-order
Copy link
Author

@emersion I would try but the "install dependencies" sections of both Sway and wlroots are unclear about which package to install. E.g. On Debian 12, apt show cairo doesn't return a package, while apt search cairo returns many packages.

@emersion
Copy link
Member

The wiki has a guide, with a list of Debian packages: https://github.com/swaywm/sway/wiki/Development-Setup

@higher-order
Copy link
Author

Running ninja -C build/ shows:

Found ninja-1.11.1 at /usr/bin/ninja
Cleaning... 0 files.
[2/791] Compiling C object subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr.c.o
FAILED: subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr.c.o 
cc -Isubprojects/libdrm/intel/libdrm_intel.so.1.124.0.p -Isubprojects/libdrm/intel -I../subprojects/libdrm/intel -Isubprojects/libdrm -I../subprojects/libdrm -I../subprojects/libdrm/include/drm -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O0 -g -include /home/user/sway/build/subprojects/libdrm/config.h -fPIC -pthread -Wsign-compare -Werror=undef -Werror=implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-aliasing=2 -Winit-self -Winline -Wshadow -Wdeclaration-after-statement -Wold-style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Wno-missing-field-initializers -MD -MQ subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr.c.o -MF subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr.c.o.d -o subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr.c.o -c ../subprojects/libdrm/intel/intel_bufmgr.c
In file included from ../subprojects/libdrm/intel/intel_bufmgr.c:34:
../subprojects/libdrm/include/drm/i915_drm.h:2233:1: error: packed attribute is unnecessary for \u2018i915_context_engines_load_balance\u2019 [-Werror=packed]
 2233 | } __attribute__((packed));
      | ^
../subprojects/libdrm/include/drm/i915_drm.h:2271:1: error: packed attribute is unnecessary for \u2018i915_context_engines_bond\u2019 [-Werror=packed]
 2271 | } __attribute__((packed));
      | ^
../subprojects/libdrm/include/drm/i915_drm.h:2399:1: error: packed attribute is unnecessary for \u2018i915_context_engines_parallel_submit\u2019 [-Werror=packed]
 2399 | } __attribute__((packed));
      | ^
../subprojects/libdrm/include/drm/i915_drm.h:2473:1: error: packed attribute is unnecessary for \u2018i915_context_param_engines\u2019 [-Werror=packed]
 2473 | } __attribute__((packed));
      | ^
cc1: all warnings being treated as errors
[4/791] Compiling C object subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr_fake.c.o
FAILED: subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr_fake.c.o 
cc -Isubprojects/libdrm/intel/libdrm_intel.so.1.124.0.p -Isubprojects/libdrm/intel -I../subprojects/libdrm/intel -Isubprojects/libdrm -I../subprojects/libdrm -I../subprojects/libdrm/include/drm -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O0 -g -include /home/user/sway/build/subprojects/libdrm/config.h -fPIC -pthread -Wsign-compare -Werror=undef -Werror=implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-aliasing=2 -Winit-self -Winline -Wshadow -Wdeclaration-after-statement -Wold-style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Wno-missing-field-initializers -MD -MQ subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr_fake.c.o -MF subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr_fake.c.o.d -o subprojects/libdrm/intel/libdrm_intel.so.1.124.0.p/intel_bufmgr_fake.c.o -c ../subprojects/libdrm/intel/intel_bufmgr_fake.c
In file included from ../subprojects/libdrm/intel/intel_bufmgr_fake.c:47:
../subprojects/libdrm/include/drm/i915_drm.h:2233:1: error: packed attribute is unnecessary for \u2018i915_context_engines_load_balance\u2019 [-Werror=packed]
 2233 | } __attribute__((packed));
      | ^
../subprojects/libdrm/include/drm/i915_drm.h:2271:1: error: packed attribute is unnecessary for \u2018i915_context_engines_bond\u2019 [-Werror=packed]
 2271 | } __attribute__((packed));
      | ^
../subprojects/libdrm/include/drm/i915_drm.h:2399:1: error: packed attribute is unnecessary for \u2018i915_context_engines_parallel_submit\u2019 [-Werror=packed]
 2399 | } __attribute__((packed));
      | ^
../subprojects/libdrm/include/drm/i915_drm.h:2473:1: error: packed attribute is unnecessary for \u2018i915_context_param_engines\u2019 [-Werror=packed]
 2473 | } __attribute__((packed));
      | ^
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

I tried replacing werror=true with werror=false in all the meson.build files in the project and subprojects and then running ninja -C build/ again. But it still showed the same thing.

@emersion
Copy link
Member

The meson.build files only contain the defaults. Newer Meson has per-subproject knobs for werror, but maybe your version is older. Maybe try meson configure build/ -Dwerror=false?

@higher-order
Copy link
Author

higher-order commented Jan 28, 2025

@emersion I did that followed by a clean rebuild. It compiled. But running build/sway/sway freezes after showing:

libEGL warning: egl: failed to create dri2 screen
00:00:00.056 [wlr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "DRI2: failed to create screen"
libEGL warning: NEEDS EXTENSION: falling back to kms_swrast
00:00:00.075 [sway/commands/output/background.c:121] Unable to access background file '/home/user/.config/sway/@datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png': No such file or directory
00:00:00.077 [sway/config.c:830] Error on line 24 'output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill': unable to access background file '/home/user/.config/sway/@datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png' (/home/user/.config/sway/config)
00:00:00.077 [sway/config.c:440] Error(s) loading config!
sh: 1: swaynag: not found
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
00:00:00.096 [wlr] [render/allocator/gbm.c:118] gbm_bo_create failed: Permission denied
00:00:00.096 [wlr] [render/swapchain.c:105] Failed to allocate buffer
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
00:00:00.096 [wlr] [render/allocator/gbm.c:118] gbm_bo_create failed: Permission denied
00:00:00.096 [wlr] [render/swapchain.c:105] Failed to allocate buffer
00:00:00.096 [sway/config/output.c:887] Requested backend configuration failed, searching for valid fallbacks
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
00:00:00.096 [wlr] [render/allocator/gbm.c:118] gbm_bo_create failed: Permission denied
00:00:00.096 [wlr] [render/swapchain.c:105] Failed to allocate buffer
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
00:00:00.096 [wlr] [render/allocator/gbm.c:118] gbm_bo_create failed: Permission denied
00:00:00.096 [wlr] [render/swapchain.c:105] Failed to allocate buffer
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
00:00:00.096 [wlr] [render/allocator/gbm.c:118] gbm_bo_create failed: Permission denied
00:00:00.096 [wlr] [render/swapchain.c:105] Failed to allocate buffer
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
00:00:00.096 [wlr] [render/allocator/gbm.c:118] gbm_bo_create failed: Permission denied
00:00:00.096 [wlr] [render/swapchain.c:105] Failed to allocate buffer
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
00:00:00.097 [wlr] [render/allocator/gbm.c:118] gbm_bo_create failed: Permission denied
00:00:00.097 [wlr] [render/swapchain.c:105] Failed to allocate buffer
KMS: DRM_IOCTL_MODE_CREATE_DUMB failed: Permission denied
00:00:00.097 [wlr] [render/allocator/gbm.c:118] gbm_bo_create failed: Permission denied
00:00:00.097 [wlr] [render/swapchain.c:105] Failed to allocate buffer
00:00:00.098 [sway/config/output.c:1080] failed to execute 'swaybg' (background configuration probably not applied): No such file or directory

If I start a new tty (by pressing Ctrl-Alt-F3) and then running build/sway/sway, it shows:
Image

@smlx
Copy link
Contributor

smlx commented Feb 3, 2025

Debian testing has a recent version of sway that might be easier to install and test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests

3 participants