Subject: Re: elogind: SwayWM fails to launch from vTTY: Could not take device: No such file or directory

From: Andrew Bower <[email-masked]>
Date: Sun, 25 Jan 2026 21:10:39 +0000

On Sun, Jan 25, 2026 at 08:49:31PM +0000, [email-masked] wrote:
> On Sunday, January 25th, 2026 at 13:40, Andrew Bower <[email-masked]> wrote:
> > Instead we should find out exactly what is calling sd_notify() at these
> > later points and make it handle the -errno style error code
> > appropriately. I can't see where this is getting called.
> > 
> > We could hack s-s-d to keep showing us or hack elogind to print them
> > out. One quick way might be to hack src/shared/daemon-util.h
> > NOTIFY_READY definition to misspell 'READY' as 'REAxDY' and whack a big
> > --notify-timout into START_ARGS; then s-s-d will keep waiting and
> > printing everything it gets from elogind and we can trace it that way.
> 
> Not sure there's enough detail with this method; attached elogind-reaxdy.log; double line breaks are entered by me (marking before sway, w/in sway, exiting sway); sd_notify(true, ...) reverted.  Sway launches successfully ...

Oh no this is perfect, thanks!

Looks like there's a bunch of nonsense about passing fds to PID1 that we
are not interested in and should fail beningly or not be done.

Here's another possible patch. There's probably a multitude of ways we
can solve this.

diff --git a/src/shared/daemon-util.c b/src/shared/daemon-util.c
index 32180a14b..c641799c8 100644
--- a/src/shared/daemon-util.c
+++ b/src/shared/daemon-util.c
@@ -46,6 +46,7 @@ int close_and_notify_warn(int fd, const char *name) {
 
 static int notify_push_fd(int fd, const char *name) {
         _cleanup_free_ char *state = NULL;
+        int r;
 
         assert(fd >= 0);
         assert(name);
@@ -55,7 +56,14 @@ static int notify_push_fd(int fd, const char *name) {
         if (!state)
                 return -ENOMEM;
 
-        return sd_pid_notify_with_fds(0, /* unset_environment = */ false, state, &fd, 1);
+        r = sd_pid_notify_with_fds(0, /* unset_environment = */ false, state, &fd, 1);
+        if (r == -ENOENT) {
+                 log_warning_errno(r,
+                                   "Supervisor notification channel vanished. Cannot store file descriptor \"%s\", ignoring: %m",
+                                   name);
+                 return 0;
+        }
+        return r;
 }
 
 int notify_push_fdf(int fd, const char *format, ...) {