Bug 443090

Summary: "error: the package is already installed" error should be ignored and not treated like an error
Product: [Applications] Discover Reporter: Nate Graham <nate>
Component: Updates (offline)Assignee: Dan Leinir Turthra Jensen <leinir>
Status: RESOLVED FIXED    
Severity: normal CC: 4wy78uwh, aleixpol, alex765
Priority: NOR Keywords: usability
Version: git-master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.24.6
Sentry Crash Report:
Attachments: Useless notification that I can't get rid of

Description Nate Graham 2021-09-28 18:13:54 UTC
Created attachment 141996 [details]
Useless notification that I can't get rid of

STEPS TO REPRODUCE
1. Apply an offline update using Discover
2. Get impatient and use your package manager to apply the update (in my case, `sudo dnf update`
3. Reboot


OBSERVED RESULT
Everything seems to work, but Discover shows me a notification that the offline update failed to update one package because it was already installed (see screenshot). This is not a particularly useful error message as there is nothing actionable because the package was already installed. Clicking on the "Repair System" button accordingly does nothing, I guess because there's nothing to do.

This message also appears on every login! There does not seem to be a GUI method to get rid of it.


EXPECTED RESULT
None of that stuff happens
Comment 1 Nate Graham 2021-09-28 18:15:27 UTC
I know that this message comes straight from PackageKit, and we can't really know if the error message is bogus or not. I could see the case being made that "error: the package is already installed" isn't really an error and should be changed on PackageKit's side. However beyond that, the fact that this notification can't be permanently dismissed is a problem we can fix on our side, as is the fact that pressing the "Repair System" button doesn't seem to do anything visible.
Comment 2 Nate Graham 2021-09-28 18:24:44 UTC
Reported the PackageKit side of this issue as https://github.com/PackageKit/PackageKit/issues/509.
Comment 3 Nate Graham 2021-09-28 18:35:42 UTC
OK, Richard Hughes says we should just ignore this error code (PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED) on our side.
Comment 4 Nate Graham 2021-09-28 18:37:46 UTC
Notable, the error we have in our results file is "failed-initialization", so I dunno if that's what Discover saw...

$ cat /var/lib/PackageKit/offline-update-competed
[PackageKit Offline Update Results]
Success=false
ErrorCode=failed-initialization
ErrorDetails=Error running transaction: package kernel-5.13.19-200.fc34.x86_64 is already installed
Comment 5 Aleix Pol 2021-09-28 22:22:50 UTC
Thanks for pulling the thread there. Yes, it would make sense to ignore this error.

Since it's unclear that the error is being set properly, let's see that PackageKit does the right thing then we fix it in Discover?
Comment 6 Nate Graham 2021-09-29 15:24:39 UTC
Yeah I investigated a bit and it looks like PackageKit is sending the wrong error code for a failed offline update.

We should still filter out PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED PK_ERROR_ENUM_ALL_PACKAGES_ALREADY_INSTALLED though, regardless of when that gets fixed upstream.
Comment 7 Nate Graham 2022-07-18 19:48:06 UTC
*** Bug 456777 has been marked as a duplicate of this bug. ***
Comment 8 Bug Janitor Service 2022-07-20 16:38:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/331
Comment 9 Aleix Pol 2022-07-21 01:50:01 UTC
Git commit 4da37b0f9d5ef424232c61a19522e3e9efd264d2 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 21/07/2022 at 01:48.
Pushed by apol into branch 'master'.

pk: Allow some error codes from offline updates

M  +6    -1    libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp

https://invent.kde.org/plasma/discover/commit/4da37b0f9d5ef424232c61a19522e3e9efd264d2
Comment 10 Aleix Pol 2022-07-21 02:16:20 UTC
Git commit c3495090b658337eec406ea637e66d0eb8c79936 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 21/07/2022 at 02:16.
Pushed by apol into branch 'Plasma/5.25'.

pk: Allow some error codes from offline updates


(cherry picked from commit 4da37b0f9d5ef424232c61a19522e3e9efd264d2)

M  +6    -1    libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp

https://invent.kde.org/plasma/discover/commit/c3495090b658337eec406ea637e66d0eb8c79936
Comment 11 Aleix Pol 2022-07-21 02:16:27 UTC
Git commit 08a42e91009f57dd2024f94e427f82e2fa3a7e29 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 21/07/2022 at 02:16.
Pushed by apol into branch 'Plasma/5.24'.

pk: Allow some error codes from offline updates


(cherry picked from commit 4da37b0f9d5ef424232c61a19522e3e9efd264d2)

M  +6    -1    libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp

https://invent.kde.org/plasma/discover/commit/08a42e91009f57dd2024f94e427f82e2fa3a7e29