0bCdian/Waypaper-Engine

Daemon doesn't work at startup

Opened this issue ยท 22 comments

I'm on arch, latest version of this amazing program, THANK YOU!

The problem that I have is for some reason the daemon doesn't run at startup.

exec-once = waypaper-engine daemon & waypaper-engine run

If I try to open waypaper engine from rofi (using the desktop shortcut) it doesn't start. I have to go and manually run waypaper-engine run in the console to launch the program. I'd like the daemon and the program to run automatically at startup and have the tray icon.

Hi! I have experienced this issue as well, and will get to it right away. It's kinda weird because I used the app literally 2 days ago and was working fine, and haven't updated anything as far as I'm concerned. I will get to the bottom of this asap and push the fix. Sorry for the inconveniences ๐Ÿ˜ž

I think I have found the culprit, but I will keep testing, basically it's a node version mismatch. I'm gonna need some info just for confirmation. Please run the following commands:

waypaper-engine run --logs
waypaper-engine daemon --logs
node --version

I need to know which node version you're running, and the contents of the logs located in $HOME/.waypaper-engine/ there should be a daemon.log and an electron.log file.

I'm 99% sure the error is because your node version was updated to a version that uses a different npm version, and the modules of the daemon need to be rebuilt to use the newer version, but let's confirm that with the logs first.

For now, if you want a quick fix (I'm assuming the node version mismatch is the problem) Doing a clean install will do it. I'm currently learning golang to rewrite the daemon in it, that way is way easier to deal with dependencies, less memory footprint and no more problems like this, I haven't really made any progress so far because I didn't think that many people use my tool anyways so why bother, but seeing feedback like this really motivates me to keep developing it and improving it, I'll try my best to make this rewrite possible in the least amount of time I can :)

I'm on arch, latest version of this amazing program, THANK YOU!

The problem that I have is for some reason the daemon doesn't run at startup.

exec-once = waypaper-engine daemon & waypaper-engine run

If I try to open waypaper engine from rofi (using the desktop shortcut) it doesn't start. I have to go and manually run waypaper-engine run in the console to launch the program. I'd like the daemon and the program to run automatically at startup and have the tray icon.

I think I have found the culprit, but I will keep testing, basically it's a node version mismatch. I'm gonna need some info just for confirmation. Please run the following commands:

waypaper-engine run --logs waypaper-engine daemon --logs node --version

I need to know which node version you're running, and the contents of the logs located in $HOME/.waypaper-engine/ there should be a daemon.log and an electron.log file.

I'm 99% sure the error is because your node version was updated to a version that uses a different npm version, and the modules of the daemon need to be rebuilt to use the newer version, but let's confirm that with the logs first.

These commands don't output anything. I'm using the waypaper-engine-git package from the AUR. I can test with any node version you'd ask me to, I'd be glad to help.

waypaper-engine run --logs
waypaper-engine daemon --logs

image

I Also don't have daemon.log file and electron.log is kinda empty.

image

For now, if you want a quick fix (I'm assuming the node version mismatch is the problem) Doing a clean install will do it. I'm currently learning golang to rewrite the daemon in it, that way is way easier to deal with dependencies, less memory footprint and no more problems like this, I haven't really made any progress so far because I didn't think that many people use my tool anyways so why bother, but seeing feedback like this really motivates me to keep developing it and improving it, I'll try my best to make this rewrite possible in the least amount of time I can :)

DO IT MAN! waypaper-engine is THE best wallpaper gui for linux, hands down. I use almost anything in a cli/terminal, but for wallpapers I think guis are the way. The feature that spans wallpapers across all monitors is nowhere else to be found. I had to write my own script to split my wallpapers in half to do this in the past. Thank you for this gem again!

Update: I did a full reinstall, removed folders from $HOME, $XDG_CONFIG_HOME and so on. Then set the default node version to 22.6.0, but the daemon didn't want to start at all. Here's what I got:

> waypaper-engine daemon                                                                                                                                                                                            at 23:52:52
starting daemon...
src/gbm_drv_common.c:131: GBM-DRV error (get_bytes_per_component): Unknown or not supported format: 808530000

src/gbm_drv_common.c:131: GBM-DRV error (get_bytes_per_component): Unknown or not supported format: 808530000

src/gbm_drv_common.c:131: GBM-DRV error (get_bytes_per_component): Unknown or not supported format: 808530000

src/gbm_drv_common.c:131: GBM-DRV error (get_bytes_per_component): Unknown or not supported format: 808530000

src/gbm_drv_common.c:131: GBM-DRV error (get_bytes_per_component): Unknown or not supported format: 808530000

Error: Failed to establish connection to waypaper daemon.
    at testConnection (/opt/waypaper-engine/resources/app/dist-electron/main.js:13905:9)
    at async initWaypaperDaemon (/opt/waypaper-engine/resources/app/dist-electron/main.js:13883:5)
Could not start waypaper-daemon, shutting down app...

Then I tried with 20.12.2, same error. Finally I tried again with 18.17.1 and the daemon started successfully, but not at system startup though. I had to manually launch it again. Hope this helps.

It shouldnt really matter which version of node you're using as long as that's the one you stick with it before you actually reinstall the app. There's this quirk with the bettersqlite3 module that it needs to be compiled for specific node version ranges or it doesn't work, so the temporal fix is to stick with one node version ( I recommend using fnm to manage your nodejs versions) and then reinstall. The reinstall "compiles" the bettersqlite3 module to whatever node version you're using in that moment, so as long as you keep using that version system wide it should work. Try it again this time make sure you first settle with a nodejs version, doesnt matter which one, and then reinstall the app, then restart and let me know, that's what did it in my system. Btw, if you want to open the gui in the tray on startup, just run waypaper-engine run the gui depends on the daemon and autostarts it in the background.

If you're still having problems, another temporary solution until I figure something more robust other than rewriting the daemon (Already on it) is after you installed the app, to rebuild the daemon packages, cd /opt/waypaper-engine/resources/daemon sudo npm rebuild and that should also fix the problem.

Tried it, said it rebuilt successfully, but unfortunately it doesn't help.

I'm sorry it didn't work, can you try clean installing the latest git?

I used fd to get every possible waypaper folder, removed them all, even the yay caches. Built from last commit, the daemon still doesn't load at startup unfortunately. Here are the logs that I get right after booting the system, hopefully they are of any help:

โ•ฐโ”€โฏ journalctl -b 0 -r | grep waypaper                                                                                                                                                                                 at 02:23:50
Aug 26 02:23:36 me /usr/lib/gdm-wayland-session[1632]: /usr/bin/waypaper-engine: line 805: Something went wrong: command not found
Aug 26 02:23:36 me /usr/lib/gdm-wayland-session[909]: Could not start waypaper-daemon, shutting down app...
Aug 26 02:23:36 me /usr/lib/gdm-wayland-session[909]:     at async /opt/waypaper-engine/resources/app/dist-electron/main.js:14981:3
Aug 26 02:23:36 me /usr/lib/gdm-wayland-session[909]:     at async initWaypaperDaemon (/opt/waypaper-engine/resources/app/dist-electron/main.js:13654:5)
Aug 26 02:23:36 me /usr/lib/gdm-wayland-session[909]:     at testConnection (/opt/waypaper-engine/resources/app/dist-electron/main.js:13676:9)
Aug 26 02:23:36 me /usr/lib/gdm-wayland-session[909]: Error: Failed to establish connection to waypaper daemon.

Ok, let's try something else.

cd /opt/waypaper-engine/resources/daemon
PROCESS=daemon node ./dist/daemon/daemon.js

and tell me what error it gives.

The obvious is that the daemon is failing for some reason (In my testing was the bettersqlite3 module not running because it was compiled against a different node version) and rebuilding the packages of the daemon would fix this, but since that's not helping in your case, and neither is doing a reinstall, let's just run the daemon directly and see what error it throws.

Literally tried everything I could come up with, no luck. It's just so strange, daemon doesn't start with exec-once in Hyprland config, but it does start normally if I invoke the command manually in the terminal. Even tried making a shell script and use that, still no luck. Tried adding sleeps and stuff also, using different flags I found from other GH issues, nah... These just launch the daemon normally:

cd /opt/waypaper-engine/resources/daemon
PROCESS=daemon node ./dist/daemon/daemon.js

It seems that I will have to start it up by myself I guess - kind of annoying, but no biggie.

It really is strange, I for the life of me cannot replicate this on my machine, I'm asking a friend that also runs hyprland to help me replicate this bug.

my config looks like this:

exec-once=dbus-update-activation-environment --all WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once=gnome-keyring-daemon --start --components=secrets
exec-once=$HOME/.config/hypr/scripts/start_xdg
exec-once=systemctl --user start opentabletdriver.service
exec-once=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
#exec-once=hyprctl setcursor Bibata-Original-Ice 24
exec-once=waypaper-engine run
exec-once=ags
exec-once=hypridle
#exec-once=blueman-applet
exec-once=nm-applet --indicator
#exec-once=$HOME/.config/hypr/scripts/clear_clipboard.sh
exec-once=copyq --start-server
exec-once=$HOME/.config/hypr/scripts/copyq.sh

and in my main hyprland.conf

source=./envs.conf
source=./monitors.conf
source=./exec.conf

This is the order in which I'm sourcing the config files.

In my case the app works just fine, it starts up well. I also noticed you use gdm as your display manager, idk if it has anything to do, but I recall having problems with it in the past and moved to use sddm. I'm sorry I haven't yet found a solution to this, but I'm working on it.

Does adding the --wayland flag to waypaper-engine work? By default, it runs on XWayland, but I doubt it has anything to do with that. I'm just grasping at straws at this point.

Does adding the --wayland flag to waypaper-engine work? By default, it runs on XWayland, but I doubt it has anything to do with that. I'm just grasping at straws at this point.

LOL!

That was the problem, disabled gdm.service and started hyprland from the tty and it indeed... DID load ๐Ÿคฃ

I think that there's something about electron and gdm that don't play well for some reason on hyprland. I have 1Password on autostart as well, it does load but it didn't show the tray icon. Now after launching from the tty without gdm it is visible.

LMAO, Well, I'm glad I was able to help, if you have any more problems do not hesitate on opening an issue, or if you'd like more features added in or improvements, let me know!

Just FYI, I think it is related to auto execing Hyprland. I added this to my .zshenv to auto launch at login and the problem reappeared:

if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
	exec Hyprland
fi

As I said, no biggie, thanks again for helping out.

My guess is that somehow somewhere the envs are getting borked at startup, you could try printenv in the tty, and with the zsh approach, to see if the node versions differ.

Would like to add, I am also experiencing this, tried to fix by reinstall, however I apparently get issues during the npm build process of installation. Sort of stuck at a wall at this point. I've attached the error log to diagnose.

2024-12-09T17_12_48_942Z-debug-0.log

Would like to add, I am also experiencing this, tried to fix by reinstall, however I apparently get issues during the npm build process of installation. Sort of stuck at a wall at this point. I've attached the error log to diagnose.

2024-12-09T17_12_48_942Z-debug-0.log

Hi! Sorry for the late reply, I haven't had a lot of time lately to develop this side project. Would you mind opening a new issue? Also I would like to know which version of nodejs are you running so I can try to reproduce the error. I am still planning on keeping development active on this project, but it will most likely be around january. I will get rid of the daemon entirely and rewrite it in go as I said in this issue. Most of the install problems stem from having two different nodejs versions one in the daemon server and one in the electron app itself. I have to constantly be aware of electron updates and try to stabilize both versions, this leads to a lot of problems, one being that everything is fragile and prone to break on each update, the other one is that depending on the user's installed nodejs version is also itself a whole can of worms. For now I can help you solve those issues, but I will try to commit some time next year to port the daemon and get rid of those problems entirely.