Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Crash when geoclue is not installed #186

Closed
whitelynx opened this issue Jun 12, 2024 · 3 comments
Closed

[BUG] Crash when geoclue is not installed #186

whitelynx opened this issue Jun 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@whitelynx
Copy link

whitelynx commented Jun 12, 2024

Go Hass Agent Version

11:35PM INF Go Hass Agent: v9.3.0-75-gbfc0c89-dirty

Describe the bug
Crash at startup (SIGSEGV) when Geoclue2 is not installed.

To Reproduce
Steps to reproduce the behaviour:

  1. Don't install Geoclue2.
  2. Register using the GUI (go-hass-agent register --force)
  3. go-hass-agent run
  4. See error.

Expected behaviour
It shouldn't crash, and instead should just ignore the location sensor.

Logs

10:03PM WRN Could not activate a worker. error="unable to monitor for active applications: no portal present"
10:03PM WRN Could not activate a worker. error="unable to monitor for desktop settings: no portal present"
10:03PM WRN Could not activate a worker. error="unsupported hardware for laptop sensor monitoring"
10:03PM ERR Could not set up a geoclue client. error="SystemBus: unable to get data org.freedesktop.GeoClue2.Manager.GetClient from org.freedesktop.GeoClue2: The name org.freedesktop.GeoClue2 was not provided by any .service files"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0xd19a9d]

goroutine 83 [running]:
github.com/joshuar/go-hass-agent/pkg/linux/dbusx.WatchBus({0x11b9198, 0xc00071c2d0}, 0x0)
	/home/whitelynx/Development/Other/go-hass-agent/pkg/linux/dbusx/dbus.go:250 +0x3d
github.com/joshuar/go-hass-agent/internal/linux.(*SensorWorker).Updates(0xc000716270, {0x11b9198, 0xc00071c2d0})
	/home/whitelynx/Development/Other/go-hass-agent/internal/linux/worker.go:137 +0x10d
github.com/joshuar/go-hass-agent/internal/agent.runWorkers({0x11b9160, 0xc00044d080}, {0x11b8f30, 0xc0005322e0}, {0x11b8f68, 0xc0005322d0})
	/home/whitelynx/Development/Other/go-hass-agent/internal/agent/runners.go:58 +0x3f1
github.com/joshuar/go-hass-agent/internal/agent.(*Agent).Run.func2.2()
	/home/whitelynx/Development/Other/go-hass-agent/internal/agent/agent.go:104 +0x65
created by github.com/joshuar/go-hass-agent/internal/agent.(*Agent).Run.func2 in goroutine 29
	/home/whitelynx/Development/Other/go-hass-agent/internal/agent/agent.go:102 +0x19a

Desktop:

  • OS: Linux
  • Distribution: Void
  • Version: rolling

Additional context
I encountered this because there's no go-hass-agent package on Void Linux, and when building manually, the documentation doesn't mention Geoclue2 being a prerequisite. Even after installing it, I'm unable to get Geoclue2 to actually run, so I'm still blocked by this error. (some of the specifics changed, of course - it now says Launch helper exited with unknown return code 253 instead of The name org.freedesktop.GeoClue2 was not provided by any .service files but the logs otherwise look practically identical)

For use on a desktop, it doesn't make sense to require a location sensor. (related to the first part of #171)

@whitelynx whitelynx added the bug Something isn't working label Jun 12, 2024
@joshuar
Copy link
Owner

joshuar commented Jun 13, 2024

Firstly thank you for trying out Go Hass Agent and also reporting this issue!

I can see what is the issue here, I recently performed some code clean-up and refactoring that's introduced this bug. Hopefully, commit aeca410 fixes the crash and commit acac8d7 adds the functionality to not start a location sensor when not running on a laptop. Would you be able to try checking out the latest source, building and seeing if that fixes the issue for you?

Would it also be useful if the releases contained a binary archive? i.e., just an amd64 binary in a tar.gz? You'd still need to install the additional libraries the agent needs but this might make it easier on distros I don't have a package for?

@joshuar
Copy link
Owner

joshuar commented Jun 17, 2024

Just following up, v.9.4.0 should fix the crash observed here. Also, a location sensor won't be created unless you are running on a laptop.

Please try out the latest version and reply back with the results when you can!

@whitelynx
Copy link
Author

I pulled the latest (Updating bfc0c89..2b60928) and it seems to have worked. Thanks for fixing that so quickly!

As far as the location sensor being created, I am on a laptop, but I use it as a desktop - it's always plugged into an external keyboard, mouse, and monitor, and I don't move it. It would still be nice to be able shut off the location sensor, but I think #171 covers that. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants