Skip to content

Screenshot portal broken after boot until xdg-desktop-portal-cosmic is restarted (startup race with compositor) #297

@calebdw

Description

@calebdw

Hello! I've been having issues with not being able to capture and paste screenshots after boot, so I had claude do some digging:

Description

After every boot/login, the screenshot portal (org.freedesktop.impl.portal.Screenshot) is non-functional — screenshots cannot be taken or pasted — until xdg-desktop-portal-cosmic is manually restarted (e.g., pkill -f xdg-desktop-portal-cosmic). After the restart, D-Bus re-activates the portal and screenshots work perfectly for the remainder of the session.

This has been reproducible on every boot for over a month.

Root Cause Analysis

The portal starts via D-Bus activation during login, but appears to race with cosmic-comp output initialization. The journal shows multiple Received Done for dead wl_output warnings from smithay_client_toolkit immediately after the portal starts, suggesting it connects to the Wayland compositor before outputs are fully settled:

Apr 15 07:33:45 s76-cwhi-0346 cosmic-session[3265]: got environmental variables from cosmic-comp: [("WAYLAND_DISPLAY", "wayland-1"), ("DISPLAY", ":1")]
Apr 15 07:33:46 s76-cwhi-0346 systemd[3210]: Started dbus-:1.1-org.freedesktop.impl.portal.desktop.cosmic@0.service.
Apr 15 07:33:46 s76-cwhi-0346 xdg-desktop-portal-cosmic[4561]: [2026-04-15T12:33:46Z WARN  wgpu_hal::vulkan::instance] Unable to find extension: VK_EXT_physical_device_drm
Apr 15 07:33:49 s76-cwhi-0346 xdg-desktop-portal-cosmic[4561]: [2026-04-15T12:33:49Z WARN  smithay_client_toolkit::output] Received Done for dead wl_output
Apr 15 07:33:49 s76-cwhi-0346 xdg-desktop-portal-cosmic[4561]: [2026-04-15T12:33:49Z WARN  smithay_client_toolkit::output] Received Done for dead wl_output
Apr 15 07:33:49 s76-cwhi-0346 xdg-desktop-portal-cosmic[4561]: [2026-04-15T12:33:49Z WARN  smithay_client_toolkit::output] Received Done for dead wl_output
Apr 15 07:33:49 s76-cwhi-0346 xdg-desktop-portal-cosmic[4561]: [2026-04-15T12:33:49Z WARN  smithay_client_toolkit::output] Received Done for dead wl_output
Apr 15 07:33:49 s76-cwhi-0346 xdg-desktop-portal-cosmic[4561]: [2026-04-15T12:33:49Z WARN  smithay_client_toolkit::output] Received Done for dead wl_output
Apr 15 07:33:49 s76-cwhi-0346 xdg-desktop-portal-cosmic[4561]: [2026-04-15T12:33:49Z WARN  smithay_client_toolkit::output] Received Done for dead wl_output

The portal appears to get stuck in a bad state with stale output references, which breaks the Screenshot interface. Killing and re-spawning the process gives it a fresh Wayland connection with valid outputs.

Steps to Reproduce

  1. Boot the system and log in to COSMIC
  2. Attempt to take a screenshot (Print Screen key or any tool using the portal)
  3. Screenshot fails / cannot be pasted

Workaround

Kill the portal process; D-Bus will re-activate it on the next portal request:

pkill -f xdg-desktop-portal-cosmic

Expected Behavior

Screenshots should work immediately after login without manual intervention. The portal should either:

  • Start later in the session after the compositor outputs are fully initialized, or
  • Handle output re-initialization gracefully when outputs change during early startup

System Information

  • OS: Pop!_OS 24.04 LTS
  • Kernel: 6.18.7-76061807-generic
  • cosmic-comp: 0.1177618137724.04~4df9519
  • xdg-desktop-portal-cosmic: 0.1.0pop1177618193624.04~08b9ed8
  • Hardware: System76 laptop

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions