Jandalf81/rclone_script

Rclone reports no internet access when using ethernet

Opened this issue · 2 comments

Was using wifi, plugged in ethernet, reboot Retropie.

When I started a rom (and exited) same error message, Not Connected to Internet.

Problem went away when I did that. (I saw this somewhere maybe but I didn't see on the issues board)

I ran into this problem, here's some more information on it:

If wifi is on AND ethernet is plugged in, getAvailableConnection() returns 2 (can't ping gateway). If I turn off wifi, everything works fine with only ethernet. If I comment out the return 2 line it works just fine with both wifi and ethernet, i.e. 8.8.8.8 is pinged successfully.

With further testing I found that I could ping my gateway from a shell (logged in through SSH) using the exact same ping command as the script, but it fails inside the script. I added a line to the script to ping another machine on my LAN and that was successful.

Possible solution: skip the gateway ping check and rely only on the 8.8.8.8 ping check.

Right after I posted the above comment I realized what's going on. If both wifi and ethernet are connected, the command ip r | grep default | cut -d " " -f 3 returns two results so gatewayIP contains the value 192.168.1.1\n192.168.1.1 in my case. The ping output looks the same as if there was only one gateway listed but the command fails.

Since in my case I'm connecting to the same router with both ethernet and wifi, I could add head -n 1 to the gatewayIP command. As a more general case it might be better to determine which gateway is being used, e.g. ip route get 8.8.8.8.