codyps / illum

Daemon that wires button presses to screen backlight level
31 stars 6 forks source link

Illum service failed to start #14

Closed Razer0123 closed 4 years ago

Razer0123 commented 4 years ago

The app works fine if i start it manually, but if i enable the service it fails at boot and then i get this mar 25 17:52:28 archlinux systemd[1]: illum.service: Scheduled restart job, re> mar 25 17:52:28 archlinux systemd[1]: Stopped illum.service. mar 25 17:52:28 archlinux systemd[1]: illum.service: Start request repeated to> mar 25 17:52:28 archlinux systemd[1]: illum.service: Failed with result 'exit-> mar 25 17:52:28 archlinux systemd[1]: Failed to start illum.service.

Any advice on how to fix it?

codyps commented 4 years ago

Hi @Razer0123 , can you provide the end of the journal log from journalctl -u illum.service? It looks like the lines you've pasted above are cut off. Try disabling the pager or redirecting to a file (journalctl -u illum.service >illum.log) to get the full output.

Razer0123 commented 4 years ago

Wow that was fast! :+1:

Again, if i start it from the desktop it works, so it might be related to the ddcci module loading before or after?

https://pastebin.com/zdVRmCWQ

codyps commented 4 years ago

mar 25 17:52:27 archlinux illum-d[1428]: no backlight entries found in '/sys/class/backlight'
mar 25 17:52:27 archlinux systemd[1]: illum.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
mar 25 17:52:27 archlinux systemd[1]: illum.service: Failed with result 'exit-code'.
mar 25 17:52:28 archlinux systemd[1]: illum.service: Scheduled restart job, restart counter is at 5.
mar 25 17:52:28 archlinux systemd[1]: Stopped illum.service.
mar 25 17:52:28 archlinux systemd[1]: illum.service: Start request repeated too quickly.
mar 25 17:52:28 archlinux systemd[1]: illum.service: Failed with result 'exit-code'.
mar 25 17:52:28 archlinux systemd[1]: Failed to start illum.service.

it looks like this is due to us requiring a backlight. It's likely that what's happening here is that we're starting before the backlight device is created.

We have a couple options:

  1. Tell systemd to start illum later using systemd-udev-settle.service. Change amounts to adding After=systemd-udev-settle.service and perhaps Wants=systemd-udev-settle.service to the [unit] section of the illum.service file. This is a quick workaround, but isn't very good
  2. we really should subscribe to udev events (as noted in the docs for systemd-udev-settle.service linked above. This requires some larger code changes to illum.
  3. have starting illum be triggered on each backlight device by udev itself (less work, but limits our ability to select a backlight)
Razer0123 commented 4 years ago

Not sure what happened, restored a backup from earlier today and the same exact setup now works

Should we consider this a solved issue?

codyps commented 4 years ago

It's something that needs work irregardless. It's possible that it's just happening to work for you right now due to the backlight just so happening to get probed prior to illum being started. I'm going to look into some proper fixes for this.

Razer0123 commented 4 years ago

Good attitude, thank you for your quick response and stay safe in these tiring days

Razer0123 commented 4 years ago

Unfortunately today happened again, not sure why, so yeah, here we go again...

Which solution were you considering the most?

codyps commented 4 years ago

I'm in the process of modifying the code to monitor udev for device probing. (option 2). If you need a quick workaround, using option 3 should work (if this is a single machine, only requires tweaking the illum.service file).

Razer0123 commented 4 years ago

I'm in the process of modifying the code to monitor udev for device probing. (option 2). If you need a quick workaround, using option 3 should work (if this is a single machine, only requires tweaking the illum.service file).

Take your time

If you could post the workaround maybe that could be useful to other people (maybe with different services, but still)

codyps commented 4 years ago

An illum.service service file that might workaround the issue. Place in /etc/systemd/system/illum.service

[Unit]
After=systemd-udev-settle.service
Wants=systemd-udev-settle.service

[Service]
Type=simple
ExecStart=/usr/bin/illum-d
Restart=on-failure

[Install]
WantedBy=multi-user.target
codyps commented 4 years ago

I've merged a change that should fix this by doing dynamic device detection. It also means that keyboards that are plugged in after illum-d is started also work to control the backlight. Let me know if it resolves your issue. If not, let me know and re-open this ticket.

Razer0123 commented 4 years ago

Tried building again via AUR (Archlinux) but building now fails with this error (it's half italian but you can figure out)

fatal: git upload-pack: not our ref 1cebc0895d236bfc5cd6797d03e02c55c773ddf1 fatal: errore remoto: upload-pack: not our ref 1cebc0895d236bfc5cd6797d03e02c55c773ddf1 Fetch eseguito nel percorso del sottomodulo 'ccan', ma non conteneva 1cebc0895d236bfc5cd6797d03e02c55c773ddf1.

EDIT: Pointed it to the mantainer and it fixed it now, thanks for your work

If you don't hear from me again, suppose this is fixed :)

codyps commented 4 years ago

Yep, definitely let me know if this is still broken for you and reopen if so. I don't have a system with a backlight that shows up late, so my testing has been limited.

Razer0123 commented 4 years ago

Seems to work fine now, thanks!