PackageKit / PackageKit

A D-BUS abstraction layer that allows the user to manage packages in a secure way using a cross-distro, cross-architecture API.
https://www.freedesktop.org/software/PackageKit/
GNU General Public License v2.0
257 stars 163 forks source link

Alpm: failed to update database: invalid url for server ( upgrade completed successfully ) #661

Open sidt4 opened 1 year ago

sidt4 commented 1 year ago

Offline update completed and re-booted successfully.

All data below are after offline update boot:

$ pkcon get-updates
Getting updates               [=========================]         
Downloading list of packages  [=========================]         
Finished                      [=========================]         
There are no updates available at this time.
# pacman -Syu
:: Synchronizing package databases...
 core                                                                                              129.5 KiB  24.9 KiB/s 00:05 [#############################################################################] 100%
 extra                                                                                               8.3 MiB  8.98 MiB/s 00:01 [#############################################################################] 100%
:: Starting full system upgrade...
 there is nothing to do
$ cat /var/lib/PackageKit/offline-update-competed 
[PackageKit Offline Update Results]
Success=false
ErrorCode=failed-initialization
ErrorDetails=failed to update database: unexpected system error

/var/lib/PackageKit/transactions.db ( transactions.db.zip )

arch-linux-gs-upgrade-incorrect-failure

OlegAckbar commented 1 year ago

I can confirm this issue on KDE

OlegAckbar commented 1 year ago

Journalctl have next concerning entries

сен 24 23:06:32 oleg-pc PackageKit[512]: не удалось получить файл 'core.db' из mirror.yandex.ru : Could not resolve host: mirror.yandex.ru
сен 24 23:06:32 oleg-pc PackageKit[512]: too many errors from mirror.yandex.ru, skipping for the remainder of this transaction
сен 24 23:06:32 oleg-pc PackageKit[512]: не удалось получить файл 'core.db' из mirror.kpfu.ru : Could not resolve host: mirror.kpfu.ru
сен 24 23:06:32 oleg-pc PackageKit[512]: too many errors from mirror.kpfu.ru, skipping for the remainder of this transaction
сен 24 23:06:32 oleg-pc PackageKit[512]: не удалось получить файл 'core.db' из mirror.nw-sys.ru : Could not resolve host: mirror.nw-sys.ru
сен 24 23:06:32 oleg-pc PackageKit[512]: too many errors from mirror.nw-sys.ru, skipping for the remainder of this transaction
сен 24 23:06:32 oleg-pc PackageKit[512]: не удалось получить файл 'core.db' из mirror.kamtv.ru : Could not resolve host: mirror.kamtv.ru
сен 24 23:06:32 oleg-pc PackageKit[512]: too many errors from mirror.kamtv.ru, skipping for the remainder of this transaction
сен 24 23:06:32 oleg-pc PackageKit[512]: не удалось получить файл 'core.db' из mirror.truenetwork.ru : Could not resolve host: mirror.truenetwork.ru
сен 24 23:06:32 oleg-pc PackageKit[512]: too many errors from mirror.truenetwork.ru, skipping for the remainder of this transaction
sidt4 commented 3 months ago

With https://github.com/PackageKit/PackageKit/pull/784, here is the correct error message.

$ cat offline-update-competed 
[PackageKit Offline Update Results]
Success=false
ErrorCode=failed-initialization
ErrorDetails=failed to update database: invalid url for server

which implies that libalpm tries to connects to network during offline update. This is confirmed by the logs from journalctl -xb -1 as shown in above comment as well.

Should packagekit-offline-update.service depend on network-online.target (which will not be offline anymore) ?

ximion commented 3 months ago

Should packagekit-offline-update.service depend on network-online.target (which will not be offline anymore) ?

It shouldn't. All downloads and preparation should happen prior to the update being executed.

sidt4 commented 3 months ago

Filed https://gitlab.archlinux.org/pacman/pacman/-/issues/180.

sidt4 commented 3 months ago

The invalid url for server was from backends/alpm/pk-alpm-update.c#L267-L272.

    result = alpm_db_update (priv->alpm, dbs, force);
    if (result < 0) {
        g_set_error (error, PK_ALPM_ERROR, alpm_errno (priv->alpm), "failed to update database: %s",
                 alpm_strerror (alpm_errno (priv->alpm)));
        return FALSE;
    }

It appears that we shouldn't be doing db update.

So, maybe PackageKit's use of libalpm API is not correct for the offline update use case. I can confirm the same update succeeds when online (via PK_OFFLINE_UPDATE_TEST=1).