Packagekit takes too long to refresh cache

Whenever I open discover after booting my PC, it takes forever to be able to use it to install anything due to the endless “Fetching updates”. I realised that this issue is caused by packagekitd taking an absurd amount of time to refresh it’s cache, it seems completely stalled too. I opened and closed Discover a couple times and ran pkmon:

Transactions:
 [none]
daemon connected=1
network status=online
Transactions:
 1      /197_cbbcdeac
Transactions:
 1      /197_cbbcdeac
 2      /198_abdbeaec
Transactions:
 1      /197_cbbcdeac
 2      /198_abdbeaec
 3      /199_edaaabde
Transactions:
 1      /197_cbbcdeac
 2      /198_abdbeaec
 3      /199_edaaabde
 4      /200_cbeaacbe
Transactions:
 1      /197_cbbcdeac
 2      /198_abdbeaec
 3      /199_edaaabde
 4      /200_cbeaacbe
 5      /202_ddeecdde
Transactions:
 1      /197_cbbcdeac
 2      /198_abdbeaec
 3      /199_edaaabde
 4      /200_cbeaacbe
 5      /202_ddeecdde
 6      /203_deeadecd
Transactions:
 1      /197_cbbcdeac
 2      /198_abdbeaec
 3      /199_edaaabde
 4      /200_cbeaacbe
 5      /202_ddeecdde
 6      /203_deeadecd
 7      /204_eecbbabd
/198_abdbeaec   allow_cancel 1
/198_abdbeaec   percentage   -1
/198_abdbeaec   role         resolve
/198_abdbeaec   status       wait
/200_cbeaacbe   allow_cancel 1
/200_cbeaacbe   percentage   -1
/200_cbeaacbe   role         refresh-cache
/200_cbeaacbe   status       wait
/199_edaaabde   allow_cancel 1
/199_edaaabde   percentage   -1
/199_edaaabde   role         resolve
/199_edaaabde   status       wait
/197_cbbcdeac   allow_cancel 1
/197_cbbcdeac   percentage   63
/197_cbbcdeac   role         refresh-cache
/197_cbbcdeac   status       loading-cache
/202_ddeecdde   allow_cancel 1
/202_ddeecdde   percentage   -1
/202_ddeecdde   role         refresh-cache
/202_ddeecdde   status       wait
/203_deeadecd   allow_cancel 1
/203_deeadecd   percentage   -1
/203_deeadecd   role         resolve
/203_deeadecd   status       wait
/204_eecbbabd   allow_cancel 1
/204_eecbbabd   percentage   -1
/204_eecbbabd   role         resolve
/204_eecbbabd   status       wait

Also as a side effect of this stalling whenever I shut down in this state I get:
A stop job is running for PackageKitd [0s/1m30s] and it ticks until the timer runs out and shutdowns.
I am now installing everything using dnf, but having packagekitd broken like this makes automatic offline updates broken too.

I guess dnf is a wise decision. Did you see that you can make parallel downloads and opt for the fastest mirror?

/etc/dnf/dnf.conf

fastestmirror=True
max_parallel_downloads=10

Dnf has also a offline update option:
Automatic Updates :: Fedora Docs

2 Likes

It’s possible that the cache is in an inconsistent state, and that causes it to trip repeatedly. Can you force a refresh and then see if that helps?

pkcon refresh force

I think the docs don’t include information about dnf offline-update, which is the offline update method using dnf, similar to gnome-software/discover where it downloads updates and then reboots into a minimal environment to update.

2 Likes

I already did this to dnf, deltarpms + parallel downloads make downloading faster than packagekit, but I still use discover for flatpaks since it makes exploring available flatpaks easier.

2 Likes