swsnr / turnon

Turn on devices in your local network
https://flathub.org/apps/details/de.swsnr.turnon
Mozilla Public License 2.0
9 stars 3 forks source link

Status monitor not showing device turned on #21

Closed StorageB closed 1 week ago

StorageB commented 2 weeks ago

I'm using this to turn on my server PC from my laptop. It will successfully turn the PC on, but does not show the device as on (the status indicator on the left is always red). Both laptop and PC are running Ubuntu 24.04. I tried using both WiFi and a wired connection from the laptop. Using version 1.3.0 installed from the GNOME Software app via flathub.

Thanks so much for this application! It's exactly what I was hoping for - a straightforward, easy to set up WOL app with a clean interface. I appreciate the work you've done on this.

swsnr commented 2 weeks ago

I can't reproduce this, and with no more information I cannot do anything.

You'll need to provide a debug log obtained with flatpak run --env=G_MESSAGES_DEBUG=all de.swsnr.turnon. It'll contain device names, MAC addresses, and IP addresses; if you consider these too sensitive for a public issue mail it to me.

And check a few things yourself:

StorageB commented 2 weeks ago

With the Server PC turned on, I am able to ping it from my laptop:

https://pastebin.com/YWT7Bdmm

With the Server PC turned on, here is the output from flatpak run --env=G_MESSAGES_DEBUG=all de.swsnr.turnon

https://pastebin.com/9MUjpnxF

I have a WOL app on my phone, and it does report that the PC is on, so it seems to be able to ping the PC.

swsnr commented 2 weeks ago
(de.swsnr.turnon:2): TurnOn-DEBUG: 16:12:05.432: Failed to ping 192.168.1.200: Permission denied (os error 13)

It looks as if your systemd denies ping permission to unprivileged processes. Check sysctl net.ipv4.ping_group_range and then figure out how to configure it to include the group of your user.

May I ask what system you're using? Systemd enabled this by default about five years ago, so it should've made its way into any desktop system by now.

StorageB commented 1 week ago

That fixed the issue. It now correctly shows when the server is online. Here are the steps I followed to get it working:

  1. On my laptop (the device with Turn On installed), the output of sysctl net.ipv4.ping_group_range showed: net.ipv4.ping_group_range = 1 0

  2. The output of id -g showed my group ID to be 1000. The following command allows pings for group IDs in the range of 1000 to 1000: sudo sysctl -w net.ipv4.ping_group_range="1000 1000" After running that command, the status was correctly shown in the app.

  3. The range will get reset after rebooting with this method. To make permanent, I added the following line to /etc/sysctl.conf: net.ipv4.ping_group_range = 1000 1000

Thanks so much for troubleshooting this. I'm running Ubuntu 24.04. I have 2 virtual machines installed with fresh installs of Ubuntu 23.10 and 24.04 so I checked those as well, and they also showed the same default output for sysctl net.ipv4.ping_group_range so I imagine this could be an issue for anyone running Ubuntu (or at least these versions).

swsnr commented 1 week ago

🤷 There's nothing I can do about this. I'll close this ticket.

swsnr commented 1 week ago

On second thought, the app could detect this situation, by attempting to create a PROTO_ICMP socket in startup. If this fails with EPERM, it can then permanently disable ping checks (and perhaps use a grey indicator to indicate this), and popup a warning message with a button to download an appropriate sysctl config snippet and instructions how to install it.

But since it doesn't affect me, and it's not like I'm drowning in issues about this, I'll probably not implement this myself any time soon.

Anyone wants to make a pull request, be my guest :slightly_smiling_face: