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

Connection Refused on Fedora 41 #38

Open
thennicke opened this issue Jan 17, 2025 · 9 comments
Open

Connection Refused on Fedora 41 #38

thennicke opened this issue Jan 17, 2025 · 9 comments

Comments

@thennicke
Copy link

Fedora 41 Gnome/Wayland.

I only learned about ActivityWatch today, and so I fiddled around manually installing the zip file, only to find that my browser activity was showing up as user "unknown" because of the lack of Wayland support. After a little digging I came across this project, and was relieved to find an RPM release. So I manually removed the original AW files I'd installed and downloaded/installed the latest RPM bundle.

I ran awatcher in the terminal and got the following output (-vvvv flag added for more info):

[thennicke@thennicke ~]$ awatcher -vvvv
[2025-01-17 15:04:06.481565 INFO awatcher] Sending to server 127.0.0.1:5600
[2025-01-17 15:04:06.481598 INFO awatcher] Idle timeout: 180 seconds
[2025-01-17 15:04:06.481606 INFO awatcher] Idle polling period: 5 seconds
[2025-01-17 15:04:06.481612 INFO awatcher] Window polling period: 1 seconds
[2025-01-17 15:04:06.498727 WARN watchers::report_client] Failed to connect on attempt #0, retrying: error sending request for url (http://127.0.0.1:5600//api/0/buckets/aw-watcher-afk_thennicke): error trying to connect: tcp connect error: Connection refused (os error 111)
[2025-01-17 15:04:07.500428 WARN watchers::report_client] Failed to connect on attempt #1, retrying: error sending request for url (http://127.0.0.1:5600//api/0/buckets/aw-watcher-afk_thennicke): error trying to connect: tcp connect error: Connection refused (os error 111)
Error: Failed to create bucket aw-watcher-afk_thennicke

Caused by:
    0: error sending request for url (http://127.0.0.1:5600//api/0/buckets/aw-watcher-afk_thennicke): error trying to connect: tcp connect error: Connection refused (os error 111)
    1: error trying to connect: tcp connect error: Connection refused (os error 111)
    2: tcp connect error: Connection refused (os error 111)
    3: Connection refused (os error 111)

I saw another user had a similar problem in issue #18. Just like them if I run the command with no-server it works:

[thennicke@thennicke ~]$ awatcher -vvvv --no-server
[2025-01-17 15:07:29.225777 WARN awatcher] Not sending to server 127.0.0.1:5600
[2025-01-17 15:07:29.225816 INFO awatcher] Idle timeout: 180 seconds
[2025-01-17 15:07:29.225825 INFO awatcher] Idle polling period: 5 seconds
[2025-01-17 15:07:29.225831 INFO awatcher] Window polling period: 1 seconds
[2025-01-17 15:07:29.236176 DEBUG watchers::watchers] Watcher "Wayland idle (ext-idle-notify-v1)" cannot run: the requested global was not found in the registry
[2025-01-17 15:07:29.236325 DEBUG watchers::watchers] Watcher "Wayland idle (KDE)" cannot run: the requested global was not found in the registry
[2025-01-17 15:07:29.237047 DEBUG watchers::watchers] Watcher "X11 idle (screensaver)" cannot run: Unsupported extension
[2025-01-17 15:07:29.237056 DEBUG watchers::watchers::gnome_wayland] Gnome Wayland detected
[2025-01-17 15:07:29.237309 DEBUG watchers::watchers] Watcher "Wayland window (wlr-foreign-toplevel-management-unstable-v1)" cannot run: the requested global was not found in the registry
[2025-01-17 15:07:29.237761 DEBUG watchers::watchers] Watcher "KWin window (script)" cannot run: org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable
[2025-01-17 15:07:29.238148 DEBUG watchers::watchers] Watcher "X11 window" cannot run: GetPropertyReply[_NET_WM_NAME] failed
[2025-01-17 15:07:29.238155 DEBUG watchers::watchers::gnome_wayland] Gnome Wayland detected
[2025-01-17 15:07:29.240583 INFO watchers::watchers] Selected watcher: Gnome idle (Mutter/IdleMonitor)
[2025-01-17 15:07:29.240605 INFO watchers::watchers] Starting idle watcher
[2025-01-17 15:07:29.242443 TRACE watchers::report_client] Reporting as not idle at 2025-01-17 15:07:29
[2025-01-17 15:07:29.242780 INFO watchers::watchers] Selected watcher: Gnome window (extension)
[2025-01-17 15:07:29.242788 INFO watchers::watchers] Starting active window watcher
[2025-01-17 15:07:29.243797 DEBUG watchers::watchers::gnome_window] Changed window app_id="org.gnome.Terminal", title="thennicke@thennicke:~"
[2025-01-17 15:07:29.243807 TRACE watchers::report_client] Reporting app_id: org.gnome.Terminal, title: thennicke@thennicke:~
[2025-01-17 15:07:30.247178 TRACE watchers::report_client] Reporting app_id: org.gnome.Terminal, title: thennicke@thennicke:~
[2025-01-17 15:07:31.251616 TRACE watchers::report_client] Reporting app_id: org.gnome.Terminal, title: thennicke@thennicke:~

And here's the output of nslookup localhost:

[thennicke@thennicke ~]$ nslookup localhost
Server:		127.0.0.53
Address:	127.0.0.53#53

Non-authoritative answer:
Name:	localhost.modem
Address: 127.0.0.1
Name:	localhost.modem
Address: ::1

I'm not exactly sure how to interpret this last bit of information -- I'm very much a novice at understanding networking & servers. Is there anything I'm doing obviously wrong? Is there any more helpful information I can give to get this working?

Thanks so much.

@2e3s
Copy link
Owner

2e3s commented Jan 18, 2025

Hello! Thank you for nslookup output, it shows a fairly probable suspect.
One fix may be to try setting host = "127.0.0.53" in the configuration (available from tray or ~/.config/awatcher/config.toml). I'm not 100% sure it'll work though, but it may.
I've just made a fix for #37 which may be convenient. Not released yet but you can try the build from here: https://github.com/2e3s/awatcher/releases/tag/v0.3.2-alpha1 it would need host = "localhost" in the configuration file, or try 0.0.0.0 if it doesn't work. 0.0.0.0 should most probably work, but the machine should not be exposed to the network unprotected (e.g. router's NAT or firewall) to avoid unwanted access.

@thennicke
Copy link
Author

After changing the host in the config file I get a similar output:

[thennicke@thennicke ~]$ awatcher -vvvv
[2025-01-18 05:41:47.275981 INFO awatcher] Sending to server 127.0.0.53:5600
[2025-01-18 05:41:47.276022 INFO awatcher] Idle timeout: 180 seconds
[2025-01-18 05:41:47.276033 INFO awatcher] Idle polling period: 5 seconds
[2025-01-18 05:41:47.276040 INFO awatcher] Window polling period: 1 seconds
[2025-01-18 05:41:47.284507 WARN watchers::report_client] Failed to connect on attempt #0, retrying: error sending request for url (http://127.0.0.53:5600//api/0/buckets/aw-watcher-afk_thennicke): error trying to connect: tcp connect error: Connection refused (os error 111)
[2025-01-18 05:41:48.285089 WARN watchers::report_client] Failed to connect on attempt #1, retrying: error sending request for url (http://127.0.0.53:5600//api/0/buckets/aw-watcher-afk_thennicke): error trying to connect: tcp connect error: Connection refused (os error 111)
Error: Failed to create bucket aw-watcher-afk_thennicke

Caused by:
    0: error sending request for url (http://127.0.0.53:5600//api/0/buckets/aw-watcher-afk_thennicke): error trying to connect: tcp connect error: Connection refused (os error 111)
    1: error trying to connect: tcp connect error: Connection refused (os error 111)
    2: tcp connect error: Connection refused (os error 111)
    3: Connection refused (os error 111)

I will try the other option you provided. Thanks.

@thennicke
Copy link
Author

Update: I installed the alpha and got the same errors for both host="localhost" and host="0.0.0.0". Strange!

Is there anything else you recommend trying on my end?

@2e3s
Copy link
Owner

2e3s commented Jan 20, 2025

Did you try setting host="127.0.0.1" btw? It's the default but not sure if it can unexpectedly help.

I have made a small fix for 0.0.0.0, if it doesn't work, you can try this way: https://github.com/2e3s/awatcher#module-for-activitywatch follow the instructions to use it with ActivityWatch distribution.

@thennicke
Copy link
Author

I tried explicitly defining host="127.0.0.1" and that didn't work. I also tried 0.0.0.0 and as you can see the most recent version of awatcher doesn't even seem to be listening to the config file.

Image

I will try redownloading ActivityWatch and running the awatcher module through that, like you suggested.

Also: the most recent awatcher assets have filenames with 0.3.1 in them, even though they're listed as 0.3.2. I can see they're different in size to the 0.3.1 release assets, but shouldn't they have filenames like awatcher-0.3.2-alpha2.x86_64.rpm?

@2e3s
Copy link
Owner

2e3s commented Jan 22, 2025

I've just noticed you're not getting any response from the server, which is why running it as a module could certainly work. Not sure what's up with your environment and how widespread is the problem, I've added another reconnection attempt just in case.

the most recent awatcher assets have filenames with 0.3.1 in them, even though they're listed as 0.3.2

Yes, it's just leveraging CI to make a temporary testing build. New versions can be reinstalled alright.

@thennicke
Copy link
Author

Thanks for this, I'm quite busy today but will try installing as a module when I get a chance.

In the meantime I'll try to install it on my laptop and see if I get the same issue. That might help isolate whatever's wrong with my environment. And if you have any tips or info I could give to figure out whether I'm set up correctly please send it through, because it would be a bother if this affects lots of users besides myself.

I'm running Fedora 41 Gnome/Wayland and haven't really messed with any env stuff so far as I'm aware.

@2e3s
Copy link
Owner

2e3s commented Jan 23, 2025

It would be nice if you try the updated bundle from here first before the module in your problematic setup, to see if the server just doesn't have enough time to start listening, which I wouldn't expect, but anyway.
If this doesn't work and you end up using the original ActivityWatch distribution with the watcher modules replaced, the next helpful step would be to try aw-server-rust instead of aw-server, to see if this is the component which doesn't work with your setup. I use it too and eventually it'll replace python-based original server. In order to use it, you'll need to replace it in ~/.config/ActivityWatch/aw-qt/aw-qt.toml (similar to what you have to do to enable aw-awatcher).

@meinar
Copy link

meinar commented Jan 28, 2025

Hello, I can confirm that this problem also occurs on Fedora 41 KDE Wayland. It still happens with v0.3.2-alpha3.

When I run aw-server-rust from the original ActivityWatch distribution, and then start the aw-awatcher module, it does work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants