I can update my Ubuntu 21.04 system using apt, Synaptic and the Software Updater application. But I can no longer use the snap based “Ubuntu Software” application for updates. It keeps telling me “Go online to check for updates” and the update button top left is grayed out. There’s also a “Networks Settings” button available that doesn’t do anything. I can install new applications with Ubuntu Software. It’s only checking for updates that doesn’t work. See screenshot below.
What can I do to convince “Ubuntu Software” that I am online?
If this isn’t where I should report this please let me know. I am very uncertain when it comes to snaps and how and where to report problems.
So, this bug will require a rebuild of the snap-store snap to fix. The fix involves adding the network-status plug to the snap.
Now for a post mortem of how this happened:
snap-store/gnome-software is using GLib’s GNetworkMonitor API to decide whether the machine is currently connected to the Internet.
when portals are enabled, GNetworkMonitor will consult xdg-desktop-portal’s org.freedesktop.portal.NetworkMonitor API to determine whether the computer is online. This avoids using the higher privilege APIs of the other GNetworkMonitor backends (talking to NetworkManager, or using netlink sockets).
Before responding, xdg-desktop-portal checks to see whether the sandboxed application has access to the network. For snaps, this is done by checking for a connected network-status plug (I’d originally had this check for network, but it was decided to change this).
As the snap-store snap does not plug network-status, the connectivity check fails.
Now that explains why the current revision of the snap fails. Why did previous revisions of the snap function correctly?
We can see that portals are enabled in the snap, since its meta/snap.yaml file contains:
environment:
...
GTK_USE_PORTAL: '1'
This fragment of yaml does not occur directly in the snap’s snapcraft.yaml file: it is introduced because the snap uses the gnome-3-34 Snapcraft extension.
The equivalent meta/snap.yaml fragment in revision 518 of the snap reads:
extensions:
...
GTK_USE_PORTALS: '1'
Note the extra ‘S’ in the environment variable name: due to this spelling mistake, portal support was not enabled and a different connectivity check was used (most likely NetworkManager).
So the behaviour change is due to the revisions being built with different versions of Snapcraft. Checking the snap/manifest.yaml files, I can see that r518 was built with Snapcraft 4.4.4, and r542 with Snapcraft 4.8.1. It looks like the environment variable change happened in Snapcraft 4.5.
Just for the record, I could produce the exact same screenshots. I also miss images in the explorer part of Ubuntu Software like @popey in addition to the update issue. I will have to update my posts on Ubuntu Forums and Ask Ubuntu.
Perhaps (given how important and well-deployed) the snap-store snap is (pre installed on Ubuntu, baked into the documentation for ‘how to install snapd’ on every distro) perhaps this application could benefit not only from more QA, but split into tracks. If we look at the current channel map, it’s a bit of a mess:
There are older versions in candidate and edge. With a newer build in beta. Perhaps there should be 3.38/stable and 3.31/stable etc, with builds landing in edge for each, and a time for baking in beta in between.
Sure does. The issue is that I over the last 20+ years have learned myself how to fix a broken Linux/Ubuntu system and get around bugs without being a developer. And then comes Snap and introduces, well I am not sure what it introduces, but bugs are part of it
In addition to all the issues mentioned here, I also cannot install deb packages. Snap packages installs normally, while deb packages got stuck on “pending”.
Edit :
It’s all fine after refreshing snap-store through terminal. I could see updates and could install deb packages. Is it fixed already?
I do not use Ubuntu Software for deb updates. I use apt. The only thing I use it for is the firmware updates for my Thinkpad. I guess I could just use fwupd for that.