Fwupd failed to get updates

I enabled fwupd through services.fwupd.enable = true

And I tried fwupdmgr refresh -v --force, got the outputs:

# fwupdmgr refresh -v --force
(fwupdmgr:3463): GLib-GIO-DEBUG: 15:25:10.745: _g_io_module_get_default: Found default implementation dummy (GDummyProxyResolver) for ‘gio-proxy-resolver’
(fwupdmgr:3463): Fwupd-DEBUG: 15:25:10.997: Emitting ::status-changed() [idle]
Updating lvfs
Fwupd-INFO: 15:25:11.000: downloading https://cdn.fwupd.org/downloads/firmware.xml.zst.jcat
(fwupdmgr:3463): GLib-GIO-DEBUG: 15:25:11.000: Failed to initialize portal (GNetworkMonitorPortal) for gio-network-monitor: Not using portals
(fwupdmgr:3463): GLib-GIO-DEBUG: 15:25:11.000: _g_io_module_get_default: Found default implementation networkmanager (GNetworkMonitorNM) for ‘gio-network-monitor’
(fwupdmgr:3463): Fwupd-DEBUG: 15:25:11.012: Emitting ::status-changed() [downloading]
Downloading...              [          |                            ]Fwupd-INFO: 15:25:11.394: download progress: 17%
Downloading...              [******                                 ]Fwupd-INFO: 15:25:11.394: download progress: 54%
Downloading...              [*********************                  ]Fwupd-INFO: 15:25:11.396: download progress: 72%
Downloading...              [****************************           ]Fwupd-INFO: 15:25:11.398: download progress: 90%
Downloading...              [***********************************    ]Fwupd-INFO: 15:25:11.399: download progress: 100%
Downloading...              [***************************************](fwupdmgr:3463): Fwupd-DEBUG: 15:25:11.399: Emitting ::status-changed() [idle]
Fwupd-INFO: 15:25:11.399: status-code was 200
Fwupd-INFO: 15:25:11.399: changing metadata URI from https://cdn.fwupd.org/downloads/firmware.xml.zst to https://cdn.fwupd.org/downloads/firmware-08350-stable.xml.zst
Fwupd-INFO: 15:25:11.400: downloading https://localhost:27500/firmware-08350-stable.xml.zst?sha256=c86e908a32947782fc46cde734743e09443338670cdedab522b0e91121506f62
(fwupdmgr:3463): Fwupd-DEBUG: 15:25:11.400: Emitting ::status-changed() [downloading]
(fwupdmgr:3463): Fwupd-DEBUG: 15:25:11.400: Emitting ::status-changed() [idle]
Fwupd-INFO: 15:25:11.400: failed to download https://localhost:27500/firmware-08350-stable.xml.zst?sha256=c86e908a32947782fc46cde734743e09443338670cdedab522b0e91121506f62: failed to download file: Failed to connect to localhost port 27500 after 0 ms: Could not connect to server, trying next URI…
Fwupd-INFO: 15:25:11.400: downloading https://cdn.fwupd.org/downloads/firmware-08350-stable.xml.zst

Failed to download metadata for lvfs: network is unreachable: host is unreachable

Is the service running in background ? You can check with systemctl status.

No. Then I manually started “fwupd.service”, and tried refresh again. Still got the same result.

I found the issue is related to GIO_USE_NETWORK_MONITOR env variable. I set it to base and refresh, fwupdmgr gives me a successful output.

The root cause of the problem was false reporting by GNetworkMonitor. I give two solutions here:

  1. As I said before, set GIO_USE_NETWORK_MONITOR environment variable to base.
  2. Install glib-networking package.

I’m gonna post a issue to nikpkgs repository to let them package glib-networking in the fwupd source.