You are not logged in.

#1 2023-12-12 01:13:34

causasui
Member
Registered: 2013-04-04
Posts: 63

[SOLVED] systemd never reaches graphical-session.target for waybar

extra/waybar includes a systemd file that I have enabled as a user service.

Problem is, it fails with `Job waybar.service/start failed with result 'dependency'.`.

So I guess it thinks I haven't reached graphical-session.target? But why not? I'm in my window manager entering these commands in a terminal emulator!

$ journalctl --user -xeu waybar
[...]
Dec 11 18:46:08 typhon systemd[818]: Dependency failed for Highly customizable Wayland bar for Sway and Wlroots based compositors..
░░ Subject: A start job for unit UNIT has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit UNIT has finished with a failure.
░░
░░ The job identifier is 2025 and the job result is dependency.
Dec 11 18:46:08 typhon systemd[818]: waybar.service: Job waybar.service/start failed with result 'dependency'.
$ systemctl --user status graphical-session.target
○ graphical-session.target - Current graphical user session
     Loaded: loaded (/usr/lib/systemd/user/graphical-session.target; static)
     Active: inactive (dead)
       Docs: man:systemd.special(7)
$ systemctl --user list-dependencies waybar
waybar.service
● ├─app.slice
● ├─basic.target
● │ ├─paths.target
● │ ├─sockets.target
● │ │ ├─dbus.socket
● │ │ ├─dirmngr.socket
● │ │ ├─gcr-ssh-agent.socket
● │ │ ├─gnome-keyring-daemon.socket
● │ │ ├─gpg-agent-browser.socket
● │ │ ├─gpg-agent-extra.socket
● │ │ ├─gpg-agent-ssh.socket
● │ │ ├─gpg-agent.socket
○ │ │ ├─keyboxd.socket
● │ │ ├─p11-kit-server.socket
● │ │ ├─pipewire-pulse.socket
● │ │ └─pipewire.socket
● │ └─timers.target
○ └─graphical-session.target
●   ├─at-spi-dbus-bus.service
●   ├─dunst.service
●   ├─xdg-desktop-portal-wlr.service
●   ├─xdg-desktop-portal.service
●   ├─xdg-document-portal.service
●   ├─xdg-permission-store.service
●   └─basic.target
●     ├─paths.target
●     ├─sockets.target
●     │ ├─dbus.socket
●     │ ├─dirmngr.socket
●     │ ├─gcr-ssh-agent.socket
●     │ ├─gnome-keyring-daemon.socket
●     │ ├─gpg-agent-browser.socket
●     │ ├─gpg-agent-extra.socket
●     │ ├─gpg-agent-ssh.socket
●     │ ├─gpg-agent.socket
○     │ ├─keyboxd.socket
●     │ ├─p11-kit-server.socket
●     │ ├─pipewire-pulse.socket
●     │ └─pipewire.socket
●     └─timers.target
$

I'm not sure where to go from here; is systemd misconfigured on my machine? Is the window manager supposed to do something to signal that I have a graphical session that it's not doing?

Last edited by causasui (2023-12-12 17:15:13)

Offline

#2 2023-12-12 07:26:39

seth
Member
Registered: 2012-09-03
Posts: 56,290

Re: [SOLVED] systemd never reaches graphical-session.target for waybar

journalctl --user -xeu waybar

is probably not helpful and the "-x" is flat out spam.

*What* is your graphical session and *how* do you start it?
See eg. https://github.com/i3/i3/issues/5186

Offline

#3 2023-12-12 15:11:34

causasui
Member
Registered: 2013-04-04
Posts: 63

Re: [SOLVED] systemd never reaches graphical-session.target for waybar

seth wrote:

*What* is your graphical session and *how* do you start it?

sway. I start it by logging in to a tty and typing:

exec sway

I'll try setting up some of these user targets.

Last edited by causasui (2023-12-12 15:12:49)

Offline

#4 2023-12-12 15:21:38

seth
Member
Registered: 2012-09-03
Posts: 56,290

Offline

#5 2023-12-12 17:14:52

causasui
Member
Registered: 2013-04-04
Posts: 63

Re: [SOLVED] systemd never reaches graphical-session.target for waybar

This seems to have solved the problem for me:

diff --git c/home/.config/sway/config i/home/.config/sway/config
index 4dba2f2..27d7a80 100644
--- c/home/.config/sway/config
+++ i/home/.config/sway/config
@@ -167,6 +167,10 @@ input * {
     xkb_numlock enabled
     # xkb_options "grp:win_space_toggle"
 }
+
 exec kitty
 
+# Tell systemd we have a graphical session now
+exec --no-startup-id systemctl start --user sway-session.service
+
 # EOF
diff --git c/home/.config/systemd/user/sway-session.service i/home/.config/systemd/user/sway-session.service
new file mode 100644
index 0000000..2f6f072
--- /dev/null
+++ i/home/.config/systemd/user/sway-session.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=sway window manager session
+PartOf=sway-session.target
+Wants=sway-session.target
+
+# this service is started by sway in its config file
+# it's done like this so sway and its launched child processes
+# are not a service itself, but in the regular session scope.
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/true
+Restart=on-failure
diff --git c/home/.config/systemd/user/sway-session.target i/home/.config/systemd/user/sway-session.target
new file mode 100644
index 0000000..73407d6
--- /dev/null
+++ i/home/.config/systemd/user/sway-session.target
@@ -0,0 +1,13 @@
+# this target is wanted by sway-session.service
+# (started by sway config file)
+[Unit]
+Description=sway window manager session
+Requires=basic.target
+BindsTo=graphical-session.target
+Before=graphical-session.target
+
+DefaultDependencies=no
+RefuseManualStart=yes
+RefuseManualStop=yes
+Requires=basic.target
+StopWhenUnneeded=yes

Offline

Board footer

Powered by FluxBB