Bug 407807 - Discover says it is offline when trying to update when NetworkManager is in use but not managing any networks
Summary: Discover says it is offline when trying to update when NetworkManager is in u...
Status: RESOLVED UPSTREAM
Alias: None
Product: Discover
Classification: Applications
Component: discover (show other bugs)
Version: 5.15.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dan Leinir Turthra Jensen
URL: https://github.com/hughsie/PackageKit...
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-21 18:39 UTC by Sol
Modified: 2019-08-26 14:00 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sol 2019-05-21 18:39:10 UTC
SUMMARY

I'm running a Kubuntu 19.04 installation that was upgraded from 18.10, which was also upgrade from 18.04. For some reason, even though I am online, discover is not able to populate the list of packages to upgrade. Going through the command line and running apt does work.

What is even stranger is that the System Tray widget shows the number of packages that needs to update, but when I click on "Update", after a while, I'm greeted by the message "cannot refresh caches whilst offline".


STEPS TO REPRODUCE
1. Wait for the Discover system tray widget to announce that there are packages to update;
2. Click it and click "View Updates"
3. Wait for the window to open and try to load the package list

OBSERVED RESULT
Blank list with the message "cannot refresh caches whilst offline"


EXPECTED RESULT
List of packages do upgrade

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 19.04
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2
Kernel Version: 5.0.0-13-generic
OS Type: 64-bit

ADDITIONAL INFORMATION
Comment 1 celsner 2019-08-16 08:42:00 UTC
Same here. Discover says it's offline, while the network is doing ok. Even this bug reporting works from within Discover.

Error mesg: "Keine Netzwerkverbindung verfügbar / Cannot download packages whilst offline" and "Cannot refresh cache whilst offline".

I also upgraded from kubuntu 18.10 to 19.04. The setup worked fine before the upgrade.
Comment 2 davehill 2019-08-19 17:52:11 UTC
I have this too. It seemed to come with upgrade from Debian 9 to 10 last week. Apper has a similar message ("There is no network connection available. Please check your connection settings and try again.").

Workaround: use apt or apt-get (haven't tried other tools)

Here's what Info Centre says about my setup:
Operating System: Debian GNU/Linux 10
KDE Plasma Version: 5.14.5
Qt Version: 5.11.3
KDE Frameworks Version: 5.54.0
Kernel Version: 4.19.0-5-amd64
OS Type: 64-bit
Comment 3 davehill 2019-08-19 21:56:49 UTC
I wonder if this might actually be a problem with PackageKit - it appears to be behind Apper and Discover. When I try to refresh using its console application, pkcon, I get: 
"Fatal error: Cannot refresh cache whilst offline"
Comment 4 davehill 2019-08-19 22:15:54 UTC
Either use NetworkManager to manage at least one network interface or disable it.

Checked for reports of PackageKit error and found lots. It seems that PackageKit looks to NetworkManager for online status. If NetworkManager is not managing any  network interface (nmcli d), PackageKit concludes its off-line. Disabling NetWorkManager is said to fix the problem: https://github.com/cockpit-project/cockpit/issues/8477. 
sudo systemctl disable NetworkManager.service

That works on my machine. 

Mine is a Xen host, so I need finer control of the network interface than is available in NetworkManager, so I don't use it. Disabling it was fine for my needs at least. It sounds like another solution might be to actually manage the network interface with NetworkManager.
Comment 5 celsner 2019-08-20 09:47:15 UTC
small addition: the update message in the system tray works correctly and acknowlidges pending updates.

And yes, apt works ok.

Thanks to anyone looking into this!
Comment 6 Nate Graham 2019-08-20 21:39:59 UTC
> It seems that PackageKit looks to NetworkManager for online status. If
> NetworkManager is not managing any  network interface (nmcli d), PackageKit
> concludes its off-line.
Thanks for uncovering the key information! Since this is an issue in PackageKit, and Discover uses PackageKit for its updates, it looks like there isn;t a way to fix this in Discover. Can you file a bug on PackageKit: https://github.com/hughsie/PackageKit/issues/

... and then add the link to your PackageKit bug report to the URL field in this one? Thanks!
Comment 7 davehill 2019-08-21 15:44:01 UTC
Done:
https://github.com/hughsie/PackageKit/issues/336
Comment 8 Nate Graham 2019-08-21 15:45:25 UTC
Thank you!
Comment 9 davehill 2019-08-21 21:43:59 UTC
Response from PackageKit, closing bug:
If you have NetworkManager installed, we expect it to be configured and working. I think PK is doing exactly what it should do here, sorry.

In my view, NM is installed, configured and working correctly - unmanaged interfaces are within normal behaviour for NM. Anyone else?
Comment 10 Nate Graham 2019-08-21 21:45:49 UTC
Yeah, disappointing resolution from the PackageKit side. :/

Still, if PK won't work properly in this circumstance, there's nothing Discover can do about it. You'll need to plead your case to the PK maintainer or remove NM entirely. FWIW that's what we did in my last job where I was supporting a lot of Linux boxes; if you're not using NM at all, just get rid of it.
Comment 11 davehill 2019-08-23 16:58:30 UTC
I have plead my case on the PK bug report. I agree that it's hard to see how Apper or Discover could address this, other than perhaps a more informative error message, but that seems counter-productive and contrary to the PK concept.
Comment 12 davehill 2019-08-26 14:00:17 UTC
(In reply to Nate Graham from comment #10)
> Yeah, disappointing resolution from the PackageKit side. :/
> 
> Still, if PK won't work properly in this circumstance, there's nothing
> Discover can do about it. You'll need to plead your case to the PK
> maintainer or remove NM entirely. FWIW that's what we did in my last job
> where I was supporting a lot of Linux boxes; if you're not using NM at all,
> just get rid of it.

I got this reply to my plea to reopen:
Is there anything on the D-Bus interface that tells us to ignore NM? If you work out the library calls we need to do and open a PR I guess we can re-open this.

So I'll dig around and see what I can find. 

Re: removal - yes, sure. I'm not chasing this for me but for the next poor soul who trips across this. It's not exactly obvious what's causing the error.

Re: Discover (and Apper) - I agree. They could in theory I suppose trap the "whilst offline" error message and provide more detail, but that'd be as kludgy as can be - as Wikipedia says "clumsy, inelegant, inefficient, difficult to extend and hard to maintain" - so no.