Closed notpeelz closed 6 months ago
Let's see the order of events:
# timestamp of reaching default.target
DEFAULT_START=$(systemctl --user show default.target --property ActiveEnterTimestamp --value)
# relevant events since then
journalctl --user -g '(Starting|Finished|Started) wayland-wm(-env)?@|Exporting variables to systemd|Variables marked for cleanup|XCURSOR_|Finalizing startup of|Reached target|Starting app.*@autostart' --since "$DEFAULT_START"
Failed to parse timestamp: Thu 2023-12-21 12:34:10 EST
Seems like I had to convert the timestamp to ISO 8601.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Paths.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Timers.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Sockets.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Basic System.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Main User Target.
Dec 21 12:34:10 peelz-pc uwsm_env-preloader[24153]: Exporting variables to systemd user manager:
Dec 21 12:34:10 peelz-pc uwsm_env-preloader[24153]: XCURSOR_SIZE
Dec 21 12:34:10 peelz-pc uwsm_env-preloader[24153]: XCURSOR_THEME
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Preparation for session of Hyprland Wayland compositor.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Session services which should run early before the graphical session is brought up.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Session of Hyprland Wayland compositor.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Current graphical user session.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target XDG Autostart for session of Hyprland Wayland compositor.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Startup of XDG autostart applications.
Dec 21 12:34:11 peelz-pc uwsm_Hyprland[24263]: Exporting variables to systemd_user_manager:
Dec 21 12:34:11 peelz-pc uwsm_Hyprland[24263]: XCURSOR_SIZE
Dec 21 12:34:11 peelz-pc uwsm_Hyprland[24263]: XCURSOR_THEME
Dec 21 12:34:11 peelz-pc uwsm_Hyprland[24263]: Finalizing startup of Hyprland
Targets declared reached a bit early.
Please show systemctl --version
, also which version of uwsm?
systemctl --user show-environment | grep XCURSOR_
(eventually proper vars get there, right?)
$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
$ systemctl --version
systemd 255 (255.1-1-arch)
+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified
$ systemctl --user show-environment | grep XCURSOR_
XCURSOR_SIZE=48
XCURSOR_THEME=capitaine-cursors
uwsm version is latest (886f83558cf35007152041fedb5d936f6abc2263)
Did service startup messages ever came up in the log? (Starting app.*@autostart
)
I see this in journalctl --user -b0
:
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Startup of XDG autostart applications.
Dec 21 12:40:11 peelz-pc systemd[24103]: app-org.corectrl.corectrl@autostart.service: Consumed 2.535s CPU time.
but there's no Starting app.*@autostart
logs :thinking:
I'm interested in relative positions of any messages with app-org.corectrl.corectrl@autostart.service
and Finalizing startup of Hyprland
app-org.corectrl.corectrl@autostart.service: Consumed 2.535s CPU time.
was logged when I closed corectrl. Any idea why there's no logs of Starting app.*@autostart
?
Dec 21 12:34:10 peelz-pc systemd-xdg-autostart-generator[24109]: /home/peelz/.config/autostart/Proton Mail Bridge.desktop: not generating unit, executable specified in Exec= does not exist.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Paths.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Timers.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Sockets.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Basic System.
Dec 21 12:34:10 peelz-pc systemd[24103]: Reached target Main User Target.
Dec 21 12:34:10 peelz-pc systemd-xdg-autostart-generator[24143]: /home/peelz/.config/autostart/Proton Mail Bridge.desktop: not generating unit, executable specified in Exec= does not exist.
Dec 21 12:34:10 peelz-pc uwsm_env-preloader[24153]: Exporting variables to systemd user manager:
Dec 21 12:34:10 peelz-pc uwsm_env-preloader[24153]: XCURSOR_SIZE
Dec 21 12:34:10 peelz-pc uwsm_env-preloader[24153]: XCURSOR_THEME
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Preparation for session of Hyprland Wayland compositor.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Session services which should run early before the graphical session is brought up.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Session of Hyprland Wayland compositor.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Current graphical user session.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target XDG Autostart for session of Hyprland Wayland compositor.
Dec 21 12:34:11 peelz-pc systemd[24103]: app-at\x2dspi\x2ddbus\x2dbus@autostart.service: Skipped due to 'exec-condition'.
Dec 21 12:34:11 peelz-pc systemd[24103]: app-gnome\x2dkeyring\x2dpkcs11@autostart.service: Skipped due to 'exec-condition'.
Dec 21 12:34:11 peelz-pc systemd[24103]: app-gnome\x2dkeyring\x2dsecrets@autostart.service: Skipped due to 'exec-condition'.
Dec 21 12:34:11 peelz-pc systemd[24103]: app-gnome\x2dkeyring\x2dssh@autostart.service: Skipped due to 'exec-condition'.
Dec 21 12:34:11 peelz-pc systemd[24103]: app-user\x2ddirs\x2dupdate\x2dgtk@autostart.service: Skipped due to 'exec-condition'.
Dec 21 12:34:11 peelz-pc systemd[24103]: app-org.gnome.SettingsDaemon.DiskUtilityNotify@autostart.service: Skipped due to 'exec-condition'.
Dec 21 12:34:11 peelz-pc systemd[24103]: Reached target Startup of XDG autostart applications.
Dec 21 12:34:11 peelz-pc uwsm_Hyprland[24263]: Exporting variables to systemd_user_manager:
Dec 21 12:34:11 peelz-pc uwsm_Hyprland[24263]: XCURSOR_SIZE
Dec 21 12:34:11 peelz-pc uwsm_Hyprland[24263]: XCURSOR_THEME
Dec 21 12:34:11 peelz-pc uwsm_Hyprland[24263]: Finalizing startup of Hyprland
Dec 21 12:40:11 peelz-pc systemd[24103]: app-org.corectrl.corectrl@autostart.service: Consumed 2.535s CPU time.
systemctl --user show wayland-wm@Hyprland.service --property ActiveEnterTimestampMonotonic --value
systemctl --user show app-org.corectrl.corectrl@autostart.service --property ExecMainStartTimestampMonotonic --value
Is wayland-session
executable on your system named uwsm
? I haven't tested these test cases yet.
I've rebooted since my last message, so the timestamps are going to be different.
$ systemctl --user show wayland-wm@Hyprland.service --property ActiveEnterTimestampMonotonic --value
87560516
$ systemctl --user show app-org.corectrl.corectrl@autostart.service --property ExecMainStartTimestampMonotonic --value
87621889
Is
wayland-session
executable on your system nameduwsm
? I haven't tested these test cases yet.
Yes. I'll try renaming it to wayland-session
.
Just tested with /usr/bin/wayland-session
instead of /usr/bin/uwsm
. Same outcome.
I do not know how to make sense of this yet. For some reason graphical session is declared before the main service finishes startup. Can you post full journalctl --user --since [login] --until [last of autostart apps started]
?
journalctl --user --since="2023-12-21T13:36:49-05:00" --until="2023-12-21T13:36:54-05:00
I also forgot to mention that I'm starting uwsp via tty (no display manager).
My user shell is set to /usr/bin/zsh
, which sources ~/.zprofile
:
# vim:ft=zsh foldmethod=marker
start-compositor() {
local name="$1"
if
fgconsole &>/dev/null && \
systemctl is-active -q graphical.target && \
! systemctl --user is-active -q "wayland-wm@*.service"
then
wayland-session start -S -o "$name"
trap "\
if systemctl --user is-active -q "wayland-wm@${name}.service"; then \
systemctl --user --stop "wayland-wm@${name}.service"; \
fi" \
INT EXIT HUP TERM
echo "Starting ${name} compositor"
exec systemctl --user start --wait "wayland-wm@${name}.service"
fi
}
if [[ -z "${WAYLAND_DISPLAY:-}" && "${XDG_VTNR:-}" -eq 1 ]]; then
start-compositor "Hyprland"
fi
Your systemd logs a bit differently. It does not list target IDs, for example. The -g
filter I gave does not catch them.
For comparison, output on my machine:
Dec 21 02:18:02 hn systemd[478239]: Reached target paths.target - Paths.
Dec 21 02:18:02 hn systemd[478239]: Reached target timers.target - Timers.
Dec 21 02:18:02 hn systemd[478239]: Reached target sockets.target - Sockets.
Dec 21 02:18:02 hn systemd[478239]: Reached target basic.target - Basic System.
Dec 21 02:18:02 hn systemd[478239]: Reached target default.target - Main User Target.
Dec 21 02:18:03 hn systemd[478239]: Starting wayland-wm-env@sway.desktop.service - Environment preloader for Sway...
Dec 21 02:18:03 hn wayland-session_env-preloader[478322]: Exporting variables to systemd user manager:
Dec 21 02:18:03 hn wayland-session_env-preloader[478322]: Variables marked for cleanup from systemd user manager on stop:
Dec 21 02:18:03 hn wayland-session_env-preloader[478322]: XCURSOR_SIZE
Dec 21 02:18:03 hn wayland-session_env-preloader[478322]: XCURSOR_THEME
Dec 21 02:18:03 hn systemd[478239]: Finished wayland-wm-env@sway.desktop.service - Environment preloader for Sway.
Dec 21 02:18:03 hn systemd[478239]: Reached target wayland-session-pre@sway.desktop.target - Preparation for session of sway.desktop Wayland compositor.
Dec 21 02:18:03 hn systemd[478239]: Reached target graphical-session-pre.target - Session services which should run early before the graphical session is brought up.
Dec 21 02:18:03 hn systemd[478239]: Starting wayland-wm@sway.desktop.service - Main service for Sway, An i3-compatible Wayland compositor...
Dec 21 02:18:04 hn wayland-session_sway.desktop[478396]: Exporting variables to systemd_user_manager:
Dec 21 02:18:04 hn wayland-session_sway.desktop[478396]: XCURSOR_SIZE
Dec 21 02:18:04 hn wayland-session_sway.desktop[478396]: Finalizing startup of sway.desktop
Dec 21 02:18:04 hn systemd[478239]: Started wayland-wm@sway.desktop.service - Main service for Sway, An i3-compatible Wayland compositor.
Dec 21 02:18:04 hn systemd[478239]: Reached target wayland-session@sway.desktop.target - Session of sway.desktop Wayland compositor.
Dec 21 02:18:04 hn systemd[478239]: Reached target graphical-session.target - Current graphical user session.
Dec 21 02:18:04 hn systemd[478239]: Reached target wayland-session-xdg-autostart@sway.desktop.target - XDG Autostart for session of sway.desktop Wayland compositor.
Dec 21 02:18:04 hn systemd[478239]: Starting app-blueman@autostart.service - Blueman Applet...
Dec 21 02:18:04 hn systemd[478239]: Starting app-conky@autostart.service - Conky...
Dec 21 02:18:04 hn systemd[478239]: Starting app-gxkb@autostart.service - Gxkb...
Dec 21 02:18:04 hn systemd[478239]: Starting app-lxpolkit@autostart.service - LXPolKit...
Dec 21 02:18:04 hn systemd[478239]: Starting app-lxqt\x2dpicom@autostart.service - picom...
Dec 21 02:18:04 hn systemd[478239]: Starting app-lxqt\x2dqlipper\x2dautostart@autostart.service - Qlipper...
Dec 21 02:18:04 hn systemd[478239]: Starting app-needrestart\x2ddbus\x2dsession@autostart.service - needrestart-dbus-session...
Dec 21 02:18:04 hn systemd[478239]: Starting app-nm\x2dapplet@autostart.service - Network...
Dec 21 02:18:04 hn systemd[478239]: Starting app-org.guido\x2dberhoerster.code.xwrited@autostart.service - xwrited...
Dec 21 02:18:04 hn systemd[478239]: Starting app-pasystray@autostart.service - PulseAudio System Tray...
Dec 21 02:18:04 hn systemd[478239]: Starting app-picom@autostart.service - picom...
Dec 21 02:18:04 hn systemd[478239]: Starting app-polkit\x2dgnome\x2dauthentication\x2dagent\x2d1@autostart.service - PolicyKit Authentication Agent...
Dec 21 02:18:04 hn systemd[478239]: Starting app-print\x2dapplet@autostart.service - Print Queue Applet...
Dec 21 02:18:04 hn systemd[478239]: Starting app-qlipper@autostart.service - Qlipper...
Dec 21 02:18:04 hn systemd[478239]: Starting app-smart\x2dnotifier@autostart.service - Smart Notifier...
Dec 21 02:18:04 hn systemd[478239]: Starting app-solaar@autostart.service - Solaar...
Dec 21 02:18:04 hn systemd[478239]: Starting app-touchpad\x2dautoswitcher@autostart.service - Touchpad autoswitcher...
Dec 21 02:18:04 hn systemd[478239]: Starting app-upbn@autostart.service - UPower Bash Notifier...
Dec 21 02:18:04 hn systemd[478239]: Starting app-user\x2ddirs\x2dupdate\x2dgtk@autostart.service - User folders update...
Dec 21 02:18:04 hn systemd[478239]: Starting app-xdg\x2duser\x2ddirs@autostart.service - User folders update...
Dec 21 02:18:04 hn systemd[478239]: Starting app-xdg\x2duser\x2ddirs\x2dkde@autostart.service - User folders update...
Dec 21 02:18:04 hn systemd[478239]: Starting app-xss\x2dlock@autostart.service - xss-lock...
Dec 21 02:18:04 hn systemd[478239]: Starting app-xssproxy@autostart.service - xssproxy...
Dec 21 02:18:04 hn systemd[478239]: Starting app-xwrited@autostart.service - xwrited...
Dec 21 02:18:04 hn systemd[478239]: Reached target xdg-desktop-autostart.target - Startup of XDG autostart applications.
Yes, now I see that Hyprland is declared started right away and does not wait for notification for some reason.
Dec 21 13:36:50 peelz-pc systemd[19059]: Starting Main service for Hyprland...
Dec 21 13:36:50 peelz-pc wayland-session_Hyprland[19130]: Starting: Hyprland
Dec 21 13:36:50 peelz-pc wayland-session_Hyprland[19130]: amdgpu: amdgpu_cs_ctx_create2 failed. (-13)
Dec 21 13:36:50 peelz-pc systemd[19059]: Started Main service for Hyprland.
Dec 21 13:36:50 peelz-pc systemd[19059]: Reached target Session of Hyprland Wayland compositor.
Dec 21 13:36:50 peelz-pc systemd[19059]: Reached target Current graphical user session.
Dec 21 13:36:50 peelz-pc systemd[19059]: Created slice User Graphical Application Slice.
Dec 21 13:36:50 peelz-pc systemd[19059]: Reached target XDG Autostart for session of Hyprland Wayland compositor.
systemctl --user show wayland-wm@Hyprland.service --property Type,NotifyAccess
BTW, you probably can simplify your startup script.
$ systemctl --user show wayland-wm@Hyprland.service --property Type,NotifyAccess
Type=notify
NotifyAccess=all
I uninstalled dbus-broker in case it's breaking something in systemd. New logs:
journalctl --user --since="2023-12-21T13:54:28-05:00" --until="2023-12-21T13:54:32-05:00"
BTW, you probably can simplify your startup script.
How so? It's a modified version of the one from your README. I removed [ "${0}" != "${0#-}" ]
because it's truthy in ttys started by tmux/screen. I replaced it with fgconsole
to check specifically it's running against the linux console.
I could probably remove the check for WAYLAND_DISPLAY
though.
How so? It's a modified version of the one from your README.
Those shell constructs were moved to explanatory examples. Modern version for your use case:
if wayland-session check may-start; then
exec wayland-session start Hyprland
fi
Ah gotcha, I found it by grepping through the README and didn't notice it wasn't the recommended method.
I have a suspicion that Hyprland may send startup notification to systemd on its own. Can you try to launch another compositor and see how it behaves?
systemctl --user show wayland-wm@Hyprland.service | grep -iE '\.(target|service)|hyprland'
Do you by any chance have any stray systemd-notify
calls somewhere in Hyprland's autostart scripts? I haven't yet got my hands on it.
I have a suspicion that Hyprland may send startup notification to systemd on its own.
https://github.com/hyprwm/Hyprland/blob/main/example/hyprland.service
Type = notify
Suspicion intensifies.
Do you by any chance have any stray
systemd-notify
calls somewhere in Hyprland's autostart scripts? I haven't yet got my hands on it.
Nope. My hyprland config is basically empty. It doesn't have any execs aside from wayland-session finalize
(and the other cursor-related execs, see my first post).
I have a suspicion that Hyprland may send startup notification to systemd on its own. Can you try to launch another compositor and see how it behaves?
I tried it with sway instead.
Using sway, corectrl shows up and the correct cursor is used.
However, if I introduce a delay before calling wayland-session finalize
, everything blows up.
~/.config/sway/config
journalctl --user --since="2023-12-21T14:26:32-05:00"
So with sway it works properly.
However, if I introduce a delay before calling wayland-session finalize, everything blows up.
8 seconds (plus whatever overhead sway has) exceeds 10s unit startup timeout. This is by design.
...no delay is needed that is. Downstream units activate only after notification is passed. And notification is passed only after vars are uplifted to activation environment.
Well, let's wait and see what Hyprland devs say.
8 seconds (plus whatever overhead sway has) exceeds 10s unit startup timeout. This is by design.
I tried it with sleep 20
first and uwsm killed the session as expected. When I lowered it to sleep 8
, all autostart services ended up crashing one way or another (corectrl segfaulted)... yet uwsm didn't kill sway.
Not sure what happened, but oh well. At least it works when I'm not intentionally trying to break it :P
Lower delays work fine. I guess 8s was too close to the limit.
I built Hyprland from source and removed the calls to sd_notify()
:
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index ab478a87..21c44687 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -342,11 +342,6 @@ void CCompositor::cleanup() {
m_bIsShuttingDown = true;
Debug::shuttingDown = true;
-#ifdef USES_SYSTEMD
- if (sd_booted() > 0)
- sd_notify(0, "STOPPING=1");
-#endif
-
// unload all remaining plugins while the compositor is
// still in a normal working state.
g_pPluginSystem->unloadAllPlugins();
@@ -539,14 +534,6 @@ void CCompositor::startCompositor() {
g_pHyprRenderer->setCursorFromName("left_ptr");
-#ifdef USES_SYSTEMD
- if (sd_booted() > 0)
- // tell systemd that we are ready so it can start other bond, following, related units
- sd_notify(0, "READY=1");
- else
- Debug::log(LOG, "systemd integration is baked in but system itself is not booted à la systemd!");
-#endif
-
createLockFile();
// This blocks until we are done.
Now everything works as expected :tada:
Looks like you created the new release tag as v10.2 instead of v0.10.2 by accident :P
oops
I have this in my hyprland config file:
I have corectrl set up as an autostart service, which ends up using the wrong cursor. Could it be because autostart services are started before the compositor signals readiness? I checked the environment variables like this:
cat /proc/$(pidof corectrl)/environ | tr '\0' '\n'