Vladimir-csp / uwsm

Universal Wayland Session Manager
MIT License
245 stars 13 forks source link

Hyprland - exiting the compositor with hyprctl dispatch exit problems #51

Open izmyname opened 2 weeks ago

izmyname commented 2 weeks ago

In response https://github.com/hyprwm/hyprland-wiki/pull/850#discussion_r1833823643

Namely, xdg-desktop-portal-hyprland.service, mpd-notification.service do not restart after exiting Hyprland with the compositor-side command as well, as xcursor doesn't apply to flatpak firefox if it was started to early.

If there are other logs I should provide - please, let me know.

journalctl -xe

░ Subject: A start job for unit UNIT has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has begun execution.
░░ 
░░ The job identifier is 1334.
Nov 08 14:36:03 archbtw systemd[1230]: Started Portal service (GTK/GNOME implementation).
░░ Subject: A start job for unit UNIT has finished successfully
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has finished successfully.
░░ 
░░ The job identifier is 1334.
Nov 08 14:36:05 archbtw uwsm_hyprland.desktop[3879]: warn: client.c:381: /run/user/1000/foot-wayland-1.sock: failed to connect, will now try /run/user/1000/foot.sock
Nov 08 14:36:05 archbtw kernel: pcieport 0000:00:1d.5: AER: Multiple Correctable error message received from 0000:00:1d.5
Nov 08 14:36:05 archbtw kernel: pcieport 0000:00:1d.5: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Receiver ID)
Nov 08 14:36:05 archbtw kernel: pcieport 0000:00:1d.5:   device [8086:06b5] error status/mask=00000001/00002000
Nov 08 14:36:05 archbtw kernel: pcieport 0000:00:1d.5:    [ 0] RxErr                  (First)
Nov 08 14:36:05 archbtw kernel: pcieport 0000:00:1d.5: AER: Multiple Correctable error message received from 0000:00:1d.5
Nov 08 14:36:05 archbtw kernel: pcieport 0000:00:1d.5: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Receiver ID)
Nov 08 14:36:05 archbtw kernel: pcieport 0000:00:1d.5:   device [8086:06b5] error status/mask=00000001/00002000
Nov 08 14:36:05 archbtw kernel: pcieport 0000:00:1d.5:    [ 0] RxErr                  (First)
Nov 08 14:36:05 archbtw wpa_supplicant[967]: wlan0: CTRL-EVENT-SIGNAL-CHANGE above=1 signal=-63 noise=9999 txrate=117000
Nov 08 14:36:06 archbtw uwsm_hyprland.desktop[3897]: warn: client.c:381: /run/user/1000/foot-wayland-1.sock: failed to connect, will now try /run/user/1000/foot.sock
Nov 08 14:36:06 archbtw systemd[1230]: Started app-flatpak-org.telegram.desktop-3898.scope.
░░ Subject: A start job for unit UNIT has finished successfully
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has finished successfully.
░░ 
░░ The job identifier is 1355.
Nov 08 14:36:06 archbtw kernel: pcieport 0000:00:1d.5: AER: Multiple Correctable error message received from 0000:00:1d.5
Nov 08 14:36:06 archbtw kernel: pcieport 0000:00:1d.5: PCIe Bus Error: severity=Correctable, type=Physical Layer, (Receiver ID)
Nov 08 14:36:06 archbtw kernel: pcieport 0000:00:1d.5:   device [8086:06b5] error status/mask=00000001/00002000
Nov 08 14:36:06 archbtw kernel: pcieport 0000:00:1d.5:    [ 0] RxErr                  (First)
Nov 08 14:36:06 archbtw uwsm_hyprland.desktop[3925]: QPainter::begin: Paint device returned engine == 0, type: 2
Nov 08 14:36:06 archbtw uwsm_hyprland.desktop[3925]: QWidget::render: Cannot render with an inactive painter
Nov 08 14:36:07 archbtw uwsm_hyprland.desktop[3984]: warn: client.c:381: /run/user/1000/foot-wayland-1.sock: failed to connect, will now try /run/user/1000/foot.sock
Nov 08 14:36:08 archbtw kernel: pcieport 0000:00:1d.5: AER: Correctable error message received from 0000:07:00.0

systemctl --user status xdg-desktop-portal-hyprland.service

○ xdg-desktop-portal-hyprland.service - Portal service (Hyprland implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-hyprland.service; static)
     Active: inactive (dead)

Nov 08 14:22:11 archbtw systemd[1230]: Starting Portal service (Hyprland implementation)...
Nov 08 14:22:11 archbtw systemd[1230]: Started Portal service (Hyprland implementation).
Nov 08 14:35:52 archbtw systemd[1230]: Stopping Portal service (Hyprland implementation)...
Nov 08 14:35:52 archbtw systemd[1230]: Stopped Portal service (Hyprland implementation).
Nov 08 14:35:53 archbtw systemd[1230]: Starting Portal service (Hyprland implementation)...
Nov 08 14:35:53 archbtw systemd[1230]: Started Portal service (Hyprland implementation).
Nov 08 14:35:53 archbtw systemd[1230]: Starting Portal service (Hyprland implementation)...
Nov 08 14:35:53 archbtw systemd[1230]: Started Portal service (Hyprland implementation).
Nov 08 14:35:53 archbtw systemd[1230]: Starting Portal service (Hyprland implementation)...
Nov 08 14:35:53 archbtw systemd[1230]: Started Portal service (Hyprland implementation).

systemctl --user status mpd-notification.service

○ mpd-notification.service - MPD Notification
     Loaded: loaded (/usr/lib/systemd/user/mpd-notification.service; enabled; preset: enabled)
    Drop-In: /home/arch-mage/.config/systemd/user/mpd-notification.service.d
             └─override.conf
     Active: inactive (dead) since Fri 2024-11-08 14:35:52 +05; 6min ago
   Duration: 13min 43.667s
 Invocation: 2b2fa072bedc43ab817ab6c700fa68ae
    Process: 1376 ExecStart=/usr/bin/mpd-notification -H localhost -p 6600 -m ${HOME}/Music c -s 150 -t 10 (code=exited, status=0/SUCCESS)
   Main PID: 1376 (code=exited, status=0/SUCCESS)
     Status: "Stopped. Bye!"
   Mem peak: 17.2M
        CPU: 37ms

Nov 08 14:22:08 archbtw systemd[1230]: Starting MPD Notification...
Nov 08 14:22:08 archbtw systemd[1230]: Started MPD Notification.
Nov 08 14:35:52 archbtw systemd[1230]: Stopping MPD Notification...
Nov 08 14:35:52 archbtw systemd[1230]: Stopped MPD Notification.
izmyname commented 2 weeks ago

UPD: Managed to get startup logs.

Here's the log for 'unclean' session (previously exited with hyprctl dispatch exit)


Selected compositor ID: hyprland.desktop
          Command Line: Hyprland
      Plugin/binary ID: hyprland
 Initial Desktop Names: Hyprland
                  Name: Hyprland
           Description: An intelligent dynamic tiling Wayland compositor

Units unchanged.
Starting hyprland.desktop and waiting while it is running...
Holding until PID 8691 exits
izmyname commented 2 weeks ago

For comparison: a log for a 'clean' session (previously exited with loginctl terminate-user "")


Selected compositor ID: hyprland.desktop
          Command Line: Hyprland
      Plugin/binary ID: hyprland
 Initial Desktop Names: Hyprland
                  Name: Hyprland
           Description: An intelligent dynamic tiling Wayland compositor

Created dir "/run/user/1000/systemd/user/"
Updated "wayland-session-pre@.target".
Updated "wayland-session@.target".
Updated "wayland-session-xdg-autostart@.target".
Updated "wayland-session-shutdown.target".
Updated "wayland-wm-env@.service".
Updated "wayland-wm@.service".
Updated "wayland-session-waitenv.service".
Updated "wayland-wm-app-daemon.service".
Updated "wayland-session-bindpid@.service".
Updated "app-graphical.slice".
Updated "background-graphical.slice".
Updated "session-graphical.slice".
Created unit subdir "wayland-wm-env@hyprland.desktop.service.d/"
Updated "wayland-wm-env@hyprland.desktop.service.d/50_custom.conf".
Created unit subdir "wayland-wm@hyprland.desktop.service.d/"
Updated "wayland-wm@hyprland.desktop.service.d/50_custom.conf".
Created unit subdir "app-@autostart.service.d/"
Updated "app-@autostart.service.d/slice-tweak.conf".
Created unit subdir "xdg-desktop-portal-gtk.service.d/"
Updated "xdg-desktop-portal-gtk.service.d/order-tweak.conf".
Created unit subdir "plasma-xdg-desktop-portal-kde.service.d/"
Updated "plasma-xdg-desktop-portal-kde.service.d/order-tweak.conf".
Reloading systemd user manager.
Starting hyprland.desktop and waiting while it is running...
Holding until PID 9983 exits
Vladimir-csp commented 2 weeks ago

journalctl --user --since ... time just before exiting and until finishing next session startup.

izmyname commented 2 weeks ago

Log from right before exiting "good" session with "bad" command

Nov 08 14:57:59 archbtw uwsm_hyprland.desktop[11901]: warn: client.c:381: /run/user/1000/foot-wayland-1.sock: failed to connect, will now try /run/user/1000/foot.sock
Nov 08 14:58:05 archbtw systemd[11081]: Stopped target XDG Autostart for session of hyprland.desktop Wayland compositor.
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Geoclue Demo agent...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Accessibility services bus...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping flatpak session helper...
Nov 08 14:58:05 archbtw foot[11343]: warn: server.c:71: client FD=8: terminal still alive
Nov 08 14:58:05 archbtw foot[11343]: server: client FD=8: terminal still alive
Nov 08 14:58:05 archbtw dbus-broker[11309]: Dispatched 105 messages @ 3(±4)μs / message.
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Foot terminal server mode...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Virtual filesystem service...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Hyprland's idle daemon...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Fast, IPC-controlled wallpaper utility for Hyprland....
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Hyprland Polkit Authentication Agent...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping MPD Notification...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Highly customizable Wayland bar for Sway and Wlroots based compositors....
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Portal service (GTK/GNOME implementation)...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Portal service (Hyprland implementation)...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Portal service...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping flatpak document portal service...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping sandboxed app permission store...
Nov 08 14:58:05 archbtw systemd[11081]: Stopped flatpak session helper.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped flatpak document portal service.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped sandboxed app permission store.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Accessibility services bus.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Portal service.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Hyprland's idle daemon.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Fast, IPC-controlled wallpaper utility for Hyprland..
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Hyprland Polkit Authentication Agent.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Highly customizable Wayland bar for Sway and Wlroots based compositors..
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Portal service (GTK/GNOME implementation).
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Geoclue Demo agent.
Nov 08 14:58:05 archbtw uwsm_hyprland.desktop[11736]: QDBusTrayIcon encountered a D-Bus error: QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name is not activatable")
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Virtual filesystem service.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Portal service (Hyprland implementation).
Nov 08 14:58:05 archbtw systemd[11081]: Removed slice User Graphical Application Slice.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped target Startup of XDG autostart applications.
Nov 08 14:58:05 archbtw uwsm_hyprland.desktop[11257]: wl_display_dispatch: Broken pipe
Nov 08 14:58:05 archbtw foot[11343]:  err: wayland.c:2105: failed to roundtrip Wayland display: Connection reset by peer
Nov 08 14:58:05 archbtw foot[11343]:  err: wayland.c:2105: failed to roundtrip Wayland display: Connection reset by peer
Nov 08 14:58:05 archbtw foot[11343]:  err: wayland.c:2105: failed to roundtrip Wayland display: Connection reset by peer
Nov 08 14:58:05 archbtw foot[11343]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Nov 08 14:58:05 archbtw foot[11343]: wayland: failed to roundtrip Wayland display: Connection reset by peer
Vladimir-csp commented 2 weeks ago

Is that all that happens after "bad" exit? Show states (before trying to start the next session): systemctl --user status wayland-wm-env@*.service graphical-session-pre.target wayland-wm@*.service graphical-session.target

izmyname commented 2 weeks ago

Here's the output within 'bad' session

● graphical-session-pre.target - Session services which should run early before the graphical session is brought up
     Loaded: loaded (/usr/lib/systemd/user/graphical-session-pre.target; static)
     Active: active since Fri 2024-11-08 15:10:34 +05; 1min 10s ago
 Invocation: 6515e076a7bc4bafa6c13b8bfbbb284b
       Docs: man:systemd.special(7)

Nov 08 15:10:34 archbtw systemd[12988]: Reached target Session services which should run early before the graphical session is brought up.

● graphical-session.target - Current graphical user session
     Loaded: loaded (/usr/lib/systemd/user/graphical-session.target; static)
     Active: active since Fri 2024-11-08 15:10:37 +05; 1min 7s ago
 Invocation: bf3ddbeae9af48e68a17f1105d7cb155
       Docs: man:systemd.special(7)

Nov 08 15:10:37 archbtw systemd[12988]: Reached target Current graphical user session.

● wayland-wm-env@hyprland.desktop.service - Environment preloader for Hyprland, An intelligent dynamic tiling Wayland compositor
     Loaded: loaded (/run/user/1000/systemd/user/wayland-wm-env@.service; static)
    Drop-In: /run/user/1000/systemd/user/wayland-wm-env@hyprland.desktop.service.d
             └─50_custom.conf
     Active: active (exited) since Fri 2024-11-08 15:10:34 +05; 1min 10s ago
 Invocation: 169c2f3833794986b0d6a27dcbbcc124
       Docs: man:uwsm(1)
    Process: 14619 ExecStart=/usr/bin/uwsm aux prepare-env -- hyprland.desktop (code=exited, status=0/SUCCESS)
   Main PID: 14619 (code=exited, status=0/SUCCESS)
   Mem peak: 12.9M
        CPU: 125ms

Nov 08 15:10:34 archbtw uwsm_env-preloader[14619]:   XDG_CONFIG_DIRS
Nov 08 15:10:34 archbtw uwsm_env-preloader[14619]:   XDG_CONFIG_HOME
Nov 08 15:10:34 archbtw uwsm_env-preloader[14619]:   XDG_CURRENT_DESKTOP
Nov 08 15:10:34 archbtw uwsm_env-preloader[14619]:   XDG_DATA_HOME
Nov 08 15:10:34 archbtw uwsm_env-preloader[14619]:   XDG_MENU_PREFIX
Nov 08 15:10:34 archbtw uwsm_env-preloader[14619]:   XDG_SESSION_DESKTOP
Nov 08 15:10:34 archbtw uwsm_env-preloader[14619]:   XDG_SESSION_ID
Nov 08 15:10:34 archbtw uwsm_env-preloader[14619]:   XDG_SESSION_TYPE
Nov 08 15:10:34 archbtw uwsm_env-preloader[14619]:   XDG_VTNR
Nov 08 15:10:34 archbtw systemd[12988]: Finished Environment preloader for Hyprland, An intelligent dynamic tiling Wayland compositor.

● wayland-wm@hyprland.desktop.service - Main service for Hyprland, An intelligent dynamic tiling Wayland compositor
     Loaded: loaded (/run/user/1000/systemd/user/wayland-wm@.service; static)
    Drop-In: /run/user/1000/systemd/user/wayland-wm@hyprland.desktop.service.d
Vladimir-csp commented 2 weeks ago

Please show states after "bad" exit, before starting the next session. And wayland-wm@hyprland.desktop.service state output is cropped.

izmyname commented 2 weeks ago

Ah yes, my bad.

So, I exited 'good' session with the 'bad' command and started the command from just shell. The output ofsystemctl --user status wayland-wm-env@*.service graphical-session-pre.target wayland-wm@*.service graphical-session.target

○ graphical-session-pre.target - Session services which should run early before the graphical session is brought up
     Loaded: loaded (/usr/lib/systemd/user/graphical-session-pre.target; static)
     Active: inactive (dead)
       Docs: man:systemd.special(7)

Nov 08 15:10:34 archbtw systemd[12988]: Reached target Session services which should run early before the graphical session is brought up.
Nov 08 15:12:52 archbtw systemd[12988]: Stopped target Session services which should run early before the graphical session is brought up.
Nov 08 15:12:55 archbtw systemd[15570]: Reached target Session services which should run early before the graphical session is brought up.
Nov 08 15:31:48 archbtw systemd[15570]: Stopped target Session services which should run early before the graphical session is brought up.
Nov 08 15:33:55 archbtw systemd[17144]: Reached target Session services which should run early before the graphical session is brought up.
Nov 08 15:34:34 archbtw systemd[17144]: Stopped target Session services which should run early before the graphical session is brought up.
Nov 08 15:34:36 archbtw systemd[18200]: Reached target Session services which should run early before the graphical session is brought up.
Nov 08 15:36:00 archbtw systemd[18200]: Stopped target Session services which should run early before the graphical session is brought up.
Nov 08 15:36:23 archbtw systemd[19356]: Reached target Session services which should run early before the graphical session is brought up.
Nov 08 15:36:50 archbtw systemd[19356]: Stopped target Session services which should run early before the graphical session is brought up.

○ graphical-session.target - Current graphical user session
     Loaded: loaded (/usr/lib/systemd/user/graphical-session.target; static)
     Active: inactive (dead) since Fri 2024-11-08 15:36:49 +05; 49s ago
 Invocation: 42cb3e1ac631401ba02771749d0053e8
       Docs: man:systemd.special(7)

Nov 08 15:36:25 archbtw systemd[19356]: Reached target Current graphical user session.
Nov 08 15:36:49 archbtw systemd[19356]: Stopped target Current graphical user session.
Vladimir-csp commented 2 weeks ago

Those seem to be properly stopped. Run systemctl --user status and systemctl --user --failed, from the same place.

izmyname commented 2 weeks ago

Status


● archbtw
    State: degraded
    Units: 182 loaded (incl. loaded aliases)
     Jobs: 0 queued
   Failed: 1 units
    Since: Fri 2024-11-08 15:45:23 +05; 55s ago
  systemd: 256.7-1-arch
   CGroup: /user.slice/user-1000.slice/user@1000.service
           ├─app.slice
           │ ├─app-dbus\x2d:1.25\x2dorg.a11y.atspi.Registry.slice
           │ │ └─dbus-:1.25-org.a11y.atspi.Registry@0.service
           │ │   └─22564 /usr/lib/at-spi2-registryd --use-gnome-session
           │ ├─dconf.service
           │ │ └─22421 /usr/lib/dconf-service
           │ └─mpd.service
           │   └─22259 /usr/bin/mpd --systemd
           ├─init.scope
           │ ├─22249 /usr/lib/systemd/systemd --user
           │ └─22251 "(sd-pam)"
           └─session.slice
             ├─dbus-broker.service
             │ ├─22280 /usr/bin/dbus-broker-launch --scope user
             │ └─22283 dbus-broker --log 4 --controller 10 --machine-id 3f39857500fc40b5bf4e073a1c99c8a8 --max-bytes 100000000000000 --max-fds 25000000000000 --max-matches 5000000000
             ├─pipewire-pulse.service
             │ └─22263 /usr/bin/pipewire-pulse
             ├─pipewire.service
             │ └─22260 /usr/bin/pipewire
             ├─wireplumber.service
             │ └─22261 /usr/bin/wireplumber
             ├─xdg-desktop-portal.service
             │ └─23110 /usr/lib/xdg-desktop-portal
             ├─xdg-document-portal.service
             │ ├─23115 /usr/lib/xdg-document-portal
             │ └─23126 fusermount3 -o rw,nosuid,nodev,fsname=portal,auto_unmount,subtype=portal -- /run/user/1000/doc
             └─xdg-permission-store.service
               └─23119 /usr/lib/xdg-permission-store

failed


  UNIT                           LOAD   ACTIVE SUB    DESCRIPTION
● xdg-desktop-portal-gtk.service loaded failed failed Portal service (GTK/GNOME implementation)

Legend: LOAD   → Reflects whether the unit definition was properly loaded.
        ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
        SUB    → The low-level unit activation state, values depend on unit type.

1 loaded units listed.
Vladimir-csp commented 2 weeks ago

grep PartOf= /lib/systemd/user/xdg-desktop-portal.service

Vladimir-csp commented 2 weeks ago

graphical-session.target is inactive, but xdg-desktop-portal.service is still alive. This is strange, dependency was added a long time ago

izmyname commented 2 weeks ago

grep PartOf= /lib/systemd/user/xdg-desktop-portal.service

/lib/systemd/user/xdg-desktop-portal.service:PartOf=graphical-session.target

Vladimir-csp commented 2 weeks ago

Just checked on my machine, exiting via exit dispatcher does not leave xdg-desktop-portal.service.

Show your user journal after Nov 08 14:58:05. When was graphical-session.target deactivated? was wayland-session-shutdown.target ever mentioned?

izmyname commented 2 weeks ago

Here's the full log for journalctl --user --since 14:58

log.txt

. When was graphical-session.target deactivated? was wayland-session-shutdown.target ever mentioned?

Search within systemctl output for both targets returned nothing

Vladimir-csp commented 2 weeks ago

You have StatusUnitFormat=description in systemd/system.conf, so unit names do not appear in status messages.

From what I see, shutdown sequence begins correctly. Everything, including portals, is stopped when it should:

Nov 08 14:58:05 archbtw systemd[11081]: Stopping Portal service (GTK/GNOME implementation)...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Portal service (Hyprland implementation)...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping Portal service...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping flatpak document portal service...
Nov 08 14:58:05 archbtw systemd[11081]: Stopping sandboxed app permission store...
Nov 08 14:58:05 archbtw systemd[11081]: Stopped flatpak session helper.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped flatpak document portal service.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped sandboxed app permission store.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Accessibility services bus.
Nov 08 14:58:05 archbtw systemd[11081]: Stopped Portal service.

But immediately portals are trying to start again:

Nov 08 14:58:05 archbtw systemd[11081]: Starting Portal service...
Nov 08 14:58:05 archbtw systemd[11081]: Starting flatpak document portal service...
Nov 08 14:58:05 archbtw systemd[11081]: Starting sandboxed app permission store...
Nov 08 14:58:05 archbtw systemd[11081]: Started sandboxed app permission store.
Nov 08 14:58:05 archbtw systemd[11081]: Started flatpak document portal service.
Nov 08 14:58:05 archbtw systemd[11081]: Starting Portal service (GTK/GNOME implementation)...
Nov 08 14:58:05 archbtw xdg-desktop-por[12005]: cannot open display: 

Something tries to bring them up somewhere around the rest of wayland-wm@hyprland.desktop.service deactivation. A process not wrapped in a unit or something in exec-shutdown?

izmyname commented 2 weeks ago

Something tries to bring them up somewhere around the rest of wayland-wm@hyprland.desktop.service deactivation. A process not wrapped in a unit or something in exec-shutdown?

If you mean hyprland.conf (the only place, where I have autostart programms, aside from systemd) - here's my autostart config

exec-once = uwsm finalize 
exec-once = $easyeffects & $clipboard & $openfreebuds &
exec-once=[workspace 1 silent] sleep 3; $browser & sleep 4; $clock & sleep 1; $filemanager & $telegram &
$telegram = flatpak run org.telegram.desktop
$easyeffects = flatpak run com.github.wwmm.easyeffects --gapplication-service
$clipboard = wl-paste --watch cliphist store
$openfreebuds = flatpak run pw.mmk.OpenFreebuds 
$clock = $term -T tty-clock tty-clock -C3 -c -s -n -f "%A %d %B %Y (%Z)"
$filemanager = $term -T nnn  $HOME/.local/bin/nwrap
$browser = flatpak run org.mozilla.firefox

No exec-shutdown entries

Vladimir-csp commented 2 weeks ago

Tried exiting while running org.gimp.GIMP flatpak, no could not reproduce.

Flatpak starts apps in scopes, so there is no need to wrap them in uwsm app (although it uses app.slice and no relations to graphical-session.target, but at least just running a flatpak app does not trigger this).

Try removing some/all items from exec-once to see if one/some of them cause portal startup on shutdown.

Also try wrapping whatever runs in $term with uwsm app.

izmyname commented 2 weeks ago

Also try wrapping whatever runs in $term with uwsm app.

$term is footclient. Foot, itself, runs as systemd-unit (foot-server.service)

izmyname commented 2 weeks ago

After commenting entries below, xdg-desktop-portal-hyprland restarts normally, if session is exited with 'bad' command. mpd-notification.service, however, does not.

exec-once = $easyeffects & $clipboard & $openfreebuds & exec-once=[workspace 1 silent] sleep 3; $browser & sleep 4; $clock & sleep 1; $filemanager & $telegram &

I restarted session withhyprctl dispatch exit 4 or 5 times, to confirm it works.

izmyname commented 2 weeks ago

After some more testing, I can say - flatpaks are the culprits, as xdph restarts normally if there are no flatpaks in autostart.

I think the problem is that xdg-desktop-portal-hyprland doesn't haveorg.freedesktop.portal.Background implementation (see the related issue https://github.com/hyprwm/xdg-desktop-portal-hyprland/issues/177)

I don't know why mpd-notification doesn't restart, though. Probably, something wrong with the service? https://github.com/eworm-de/mpd-notification/blob/main/systemd/mpd-notification.service

izmyname commented 2 weeks ago

Also, worth to mention, that there's a small chance - xdph may not restart, even without flatpaks. Ihyprctl dispatch exit'ed the session somewhere about 10 times and xph didn't restart 1 time

Vladimir-csp commented 2 weeks ago

I don't know why mpd-notification doesn't restart, though. Probably, something wrong with the service? https://github.com/eworm-de/mpd-notification/blob/main/systemd/mpd-notification.service

It does not have After=graphical-session.target. It has After=dunst.service xfce4-notifyd.service which you do not seem to have.

izmyname commented 2 weeks ago

I don't know why mpd-notification doesn't restart, though. Probably, something wrong with the service? https://github.com/eworm-de/mpd-notification/blob/main/systemd/mpd-notification.service

It does not have After=graphical-session.target. It has After=dunst.service xfce4-notifyd.service which you do not seem to have.

I have an override file with the following contents (I use mako)

[Unit]
 After=dunst.service xfce4-notifyd.service mako.service

[Service]
ExecStart=
ExecStart=/usr/bin/mpd-notification  -H localhost -p 6600 -m '${HOME}/Music' c -s 150 -t 10
izmyname commented 2 weeks ago

Oh wait, I don't even start mako.service. I'm running it with dbus activation. Nevermid, then

Vladimir-csp commented 2 weeks ago

Anyway, https://github.com/eworm-de/mpd-notification/blob/main/systemd/mpd-notification.service could use graphical-session.target in After.

izmyname commented 2 weeks ago

It didn't work, though. I replaced notification services with graphical-session.target to no avail

Vladimir-csp commented 2 weeks ago

What I can tell from logs, mpd-notification is always first to end on exit, but also frequently first to start:

# session start
Nov 08 15:12:54 archbtw dbus-broker-launch[15601]: Service file '/usr/share//dbus-1/services/fr.emersion.mako.service' is not named after the D-Bus name 'org.freedesktop.Notifications'.
# too early
Nov 08 15:12:54 archbtw systemd[15570]: Starting MPD Notification...
Nov 08 15:12:54 archbtw systemd[15570]: Started MPD Notification.
Nov 08 15:12:54 archbtw systemd[15570]: Starting Bind graphical session to PID 15584...
Nov 08 15:12:54 archbtw systemd[15570]: Started Bind graphical session to PID 15584.
Nov 08 15:12:54 archbtw systemd[15570]: Starting Environment preloader for Hyprland, An intelligent dynamic tiling Wayland compositor...
Nov 08 15:12:55 archbtw systemd[15570]: Finished Environment preloader for Hyprland, An intelligent dynamic tiling Wayland compositor.
Nov 08 15:12:55 archbtw systemd[15570]: Reached target Preparation for session of hyprland.desktop Wayland compositor.
Nov 08 15:12:55 archbtw systemd[15570]: Reached target Session services which should run early before the graphical session is brought up.
Nov 08 15:12:55 archbtw systemd[15570]: Starting Main service for Hyprland, An intelligent dynamic tiling Wayland compositor...
Nov 08 15:12:57 archbtw systemd[15570]: Started Main service for Hyprland, An intelligent dynamic tiling Wayland compositor.
Nov 08 15:12:57 archbtw systemd[15570]: Reached target Current graphical user session.
# should start here
...
# exit triggered, mpd-notification is first to die
Nov 08 15:31:47 archbtw systemd[15570]: Stopping MPD Notification...
Nov 08 15:31:47 archbtw systemd[15570]: Stopped target Current graphical user session.
Nov 08 15:31:48 archbtw systemd[15570]: Stopped Main service for Hyprland, An intelligent dynamic tiling Wayland compositor.
Nov 08 15:31:48 archbtw systemd[15570]: wayland-wm@hyprland.desktop.service: Consumed 42.501s CPU time, 849.2M memory peak.
Nov 08 15:31:48 archbtw systemd[15570]: wayland-wm@hyprland.desktop.service: Triggering OnSuccess= dependencies.
Nov 08 15:31:48 archbtw systemd[15570]: Stopped target Session services which should run early before the graphical session is brought up.
Nov 08 15:31:48 archbtw systemd[15570]: Stopped target Preparation for session of hyprland.desktop Wayland compositor.
Nov 08 15:31:48 archbtw systemd[15570]: Stopping Bind graphical session to PID 15584...
Nov 08 15:31:48 archbtw systemd[15570]: Stopping Environment preloader for Hyprland, An intelligent dynamic tiling Wayland compositor...
Nov 08 15:31:48 archbtw systemd[15570]: Stopped Bind graphical session to PID 15584.
Nov 08 15:31:48 archbtw systemd[15570]: Stopped Environment preloader for Hyprland, An intelligent dynamic tiling Wayland compositor.
Nov 08 15:31:48 archbtw systemd[15570]: wayland-wm-env@hyprland.desktop.service: Triggering OnSuccess= dependencies.
izmyname commented 2 weeks ago

It works, if Hyprland was previously closed with loginctl command, so not a big deal for me.

Vladimir-csp commented 2 weeks ago

Does it work if stopping with uwsm stop or systemctl --user start wayland-session-shutdown.target?

izmyname commented 2 weeks ago

No, it doesn't

Vladimir-csp commented 1 week ago

Could you please set StatusUnitFormat=combined in /etc/systemd/system.conf, do systemctl daemon-reload and post journalctl --user ... from running uwsm stop in a session to starting a terminal in a new session (all with uwsm v0.20.4).

...and also systemctl --user status in between sessions.

izmyname commented 1 week ago

Could you please set StatusUnitFormat=combined in /etc/systemd/system.conf, do systemctl daemon-reload and post journalctl --user ... from running uwsm stop in a session to starting a terminal in a new session (all with uwsm v0.20.4).

sincelog.txt

...and also systemctl --user status in between sessions.

● archbtw State: running Units: 178 loaded (incl. loaded aliases) Jobs: 0 queued Failed: 0 units Since: Sun 2024-11-10 00:47:56 +05; 1min 22s ago systemd: 256.7-1-arch CGroup: /user.slice/user-1000.slice/user@1000.service ├─app.slice │ ├─app-dbus\x2d:1.27\x2dorg.a11y.atspi.Registry.slice │ │ └─dbus-:1.27-org.a11y.atspi.Registry@0.service │ │ └─5768 /usr/lib/at-spi2-registryd --use-gnome-session │ ├─dconf.service │ │ └─5624 /usr/lib/dconf-service │ └─mpd.service │ └─5467 /usr/bin/mpd --systemd ├─init.scope │ ├─5457 /usr/lib/systemd/systemd --user │ └─5459 "(sd-pam)" └─session.slice ├─dbus-broker.service │ ├─5488 /usr/bin/dbus-broker-launch --scope user │ └─5499 dbus-broker --log 4 --controller 10 --machine-id 3f39857500fc40b5bf4e073a1c99c8a8 --max-bytes 100000000000000 --max-fds 25000000000000 --max-matches 5000000000 ├─pipewire-pulse.service │ └─5471 /usr/bin/pipewire-pulse ├─pipewire.service │ └─5468 /usr/bin/pipewire └─wireplumber.service └─5469 /usr/bin/wireplumber



**upd:** xdph does restart correctly. mpd-notification isn't, but it because of the service itself
Vladimir-csp commented 1 week ago

With https://github.com/hyprwm/Hyprland/issues/8398 exit dispatcher will behave more like stopping compositor unit. And with app-flatpak- ordering hopefully most of unclean session deactivation problems should go away.

StatusUnitFormat=combined did not apply, BTW.

izmyname commented 1 week ago

So, Hyprland's exit dispatcher will behave, like loginctl terminate-user ""? I'm mostly concerned about 'imperfect' units, likempd-notification.service

StatusUnitFormat=combined did not apply, BTW.

Weird. I did set it and used daemon-reload command

UPD: It won't actually end a user's session, as I understand, so loginctl ..., probably, will remain a better way to close the session, at least for me.

Vladimir-csp commented 1 week ago

It will behave close to systemctl --user stop wayland-wm@hyprland.desktop. Due to the way uwsm binds graphical session and login session together, that particular login session will end too.

loginctl terminalte-user "" is perfectly valid, but a bit of a nuclear-ish option. I just want to make sure that problems with plain graphical+login session deactivation method are resolved.