You are not logged in.

#1 2021-10-11 15:41:47

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

[SOLVED] Automatically restarting iwd whenever internet is down

I use systemd-networkd + iwd (both sevice units are enabled).

Whenever I turn my desktop on and log in with my primary user, internet is usually available. I can `sudo pacman -Syu`, `ping google.com`, etc.

Occasionally though, when I turn my desktop on, internet isn't available. My go-to "fix" (it's more like a workaround, really) is to simply do:

# systemctl restart iwd

...and that usually does the trick.

Now, here's my question: I am trying to either

- (i) understand what's going on and see if I can do anything to mitigate this from happening every once in a while (e.g. maybe add a timeout to iwd so I delay its startup? Maybe to systemd-networkd as well?). For this, any ideas which logs I should check and where to look for, the next time it happens?

and/or

- (ii) simply automate restarting iwd when internet is down. The stock iwd.service has:

% systemctl cat iwd | grep Restart
Restart=on-failure

...so the issue isn't about iwd failing per se, it's probably something flaky in my network. Regardless, I am looking for a simple way to augment iwd's unit file (systemctl edit iwd) to "restart when internet is down". I know I could probably do this by writing a custom script that calls `ip addr` periodically and then restart iwd when it happens, but it's overkill for my purposes. Any ideas on how to do this in a simple manner? Maybe there's an existing/native way to detect when the internet is down other than parsing `ip addr` or pinging google.com?

Related (no answers): https://bbs.archlinux.org/viewtopic.php?id=261609

Last edited by thiagowfx (2021-10-22 18:56:49)

Offline

#2 2021-10-11 15:56:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: [SOLVED] Automatically restarting iwd whenever internet is down

First investigate the state when you would restart the service.  Is it just that no IP has been assigned, or is there no link or connection at all to the access-point / router?

Last edited by Trilby (2021-10-11 15:57:05)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2021-10-22 18:56:37

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: [SOLVED] Automatically restarting iwd whenever internet is down

Trilby wrote:

Is it just that no IP has been assigned, or is there no link or connection at all to the access-point / router?

IP was always assigned, the issue turned out to be ~PEBKAC~ something related to DNS (not completely sure what exactly, but I am reasonably confident it is DNS).

I figured that out because I switched internet providers recently (and thus modem/router) and didn't experience any issues so far, since then.

I'll mark this as 'SOLVED'.

Offline

Board footer

Powered by FluxBB