Elinvention / gnome-shell-extension-nasa-apod

Change your wallpaper daily to the NASA's astronomy picture of the day
https://extensions.gnome.org/extension/1202/nasa-apod/
GNU General Public License v3.0
120 stars 23 forks source link

get_network_available returns false even when api.nasa.gov can be reached #29

Closed soconn closed 4 years ago

soconn commented 4 years ago

Hello, I've been receiving an odd issue as of late where I'm unable to download new wallpaper. Linux ubuntu 5.3.0-26-generic #28-Ubuntu SMP Wed Dec 18 05:37:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Ubuntu 19.10

The extention states that "Media type video not supported" as well as "No picture today (for quite ome time)"

When I perform a journalctl -o cat -f /usr/bin/gnome-shell I receive the following : NASA APOD extension: refresh: network is not available NASA APOD extension: Next check in less than a minute NASA APOD extension: Refresh done.

Cleared out the folder (permissions 775) and restarted the extension. I am using my own personal API key as well as those that were loaded with the extension. Any ideas? image

Elinvention commented 4 years ago

Mhm... "network is not available" is interesting. Do you have access to the internet?

If you do this code should return true:

const Gio = imports.gi.Gio;
let nm = Gio.network_monitor_get_default();
nm.get_network_available();

You can try to paste that in gjs.

soconn commented 4 years ago
gjs> const Gio = imports.gi.Gio;
gjs> let nm = Gio.network_monitor_get_default();
gjs> nm.get_network_available();
false

I do have internet access - I was pulling containers just prior. This is on a development VM on VM-Workstation, unsure if that matters. Is there a specific port gjs uses? Thank you for looking into this by the way!

Elinvention commented 4 years ago

Apparently get_network_available is too dumb for your case.

"Available" here means that the system has a default route available for at least one of IPv4 or IPv6.

you can try what happens with nm.get_connectivity(); or nm.can_reach(new Gio.NetworkAddress({'hostname': "api.nasa.gov"}), null);, but that's a way more expensive check.

soconn commented 4 years ago

Get connectivity provides a 1, the others err'd out (chances are I'm not inputting them correctly as I'm not knowledgable in gjs

gjs> const Gio = imports.gi.Gio;
gjs> let nm = Gio.network_monitor_get_default();
gjs> nm.can_reach(new);
typein:3:16 expected expression, got ')':
typein:3:16 nm.can_reach(new);
typein:3:16 ................^
  @<stdin>:1:34
gjs> nm.get_connectivity();
1
gjs> Gio.NetworkAddress({'hostname': "api.nasa.gov"}), null);
typein:5:54 unexpected token: ')':
typein:5:54 Gio.NetworkAddress({'hostname': "api.nasa.gov"}), null);
typein:5:54 ......................................................^
  @<stdin>:1:34
gjs> 
Elinvention commented 4 years ago

Yep, you shouldn't paste the line break in the middle of the command, but never mind, that's still not a solution.

However why you don't have a default route? Can you post the output of ip route?

soconn commented 4 years ago

root@ubuntu:~|⇒ ip route

default via 192.168.181.2 dev ens38 proto dhcp src 192.168.181.140 metric 100 
10.1.35.0/24 dev cni0 proto kernel scope link src 10.1.35.1 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 
172.18.0.0/16 dev br-ba3f8cab366a proto kernel scope link src 172.18.0.1 linkdown 
172.19.0.0/16 dev br-1f7d57ac266d proto kernel scope link src 172.19.0.1 linkdown 
172.20.0.0/16 dev br-c4ea3538c524 proto kernel scope link src 172.20.0.1 linkdown 
172.21.0.0/16 dev br-de1afab212e7 proto kernel scope link src 172.21.0.1 linkdown 
172.22.0.0/16 dev br-d9da3b865fe2 proto kernel scope link src 172.22.0.1 linkdown 
172.23.0.0/16 dev docker_gwbridge proto kernel scope link src 172.23.0.1 
192.168.181.0/24 dev ens38 proto kernel scope link src 192.168.181.140 
192.168.181.2 dev ens38 proto dhcp scope link src 192.168.181.140 metric 100 
Elinvention commented 4 years ago

So there is a default route. I'm clueless. Somehow NetworkManager thinks there is no internet connection. get_connectivity() = 1 means local connectivity only.

soconn commented 4 years ago

It's probably an issue with the way I have the VM networking set up. I'll mess around with it and if I discover anything, I'll come back and post the solution. Thanks for looking at this with me.