archlinuxhardened / selinux

PKGBUILDs to build SELinux enabled packages for Arch Linux
146 stars 25 forks source link

Arch Linux: error: could not open file /var/lib/pacman/sync/selinux.db: Unrecognized archive format #124

Closed AFlyingNut closed 1 month ago

AFlyingNut commented 1 month ago

Since a few days ago, I have been facing an issue where running sudo pacman -Syu and sudo pacman -Syyu outputs the following error, then the command will end. It does look like this started with the release that was done 4 days ago.

:: Synchronizing package databases...
 core is up to date
 extra                                                                                 7.3 MiB  4.90 MiB/s 00:01 [###################################################################] 100%
 selinux is up to date
:: Starting full system upgrade...
error: could not open file /var/lib/pacman/sync/selinux.db: Unrecognized archive format
error: failed to prepare transaction (invalid or corrupted database

When inspecting /var/lib/pacman/sync/selinux.db it seems that all that files contains is the text "selinux.db.tar.xz". I have tried deleting the file, but it regenerates with the same contents. If i comment out the selinux lines from /etc/pacman.conf, it at least lets pacman upgrade the core and extra packages, but selinux will no longer update.

Does anyone have any ideas on how to fix this?

Na-Sizuku commented 1 month ago

Same error for me,

:: Synchronising package databases...
 core is up to date
 extra is up to date
 community is up to date
 archlinuxcn is up to date
 selinux is up to date
:: Starting full system upgrade...
error: could not open file /var/lib/pacman/sync/selinux.db: Unrecognized archive format
error: failed to prepare transaction (invalid or corrupted database)

But i manule download all release packges and manule install it, in short time is ok, but is not a good idea for it

fishilico commented 1 month ago

Hello, Thanks for the bug report. It seems GitHub recently changed the way symbolic links are hosted in release artifacts :confused:.

For information, the command which created the SELinux repository are https://github.com/archlinuxhardened/selinux/blob/d6b4793e26e7a369644119aa44d606301fa9e342/.github/workflows/main.yml#L187-L202

These commands download all built packages, run repo-add /repo/selinux.db.tar.xz /repo/* and upload the result as a GitHub Actions Artifact. Command repo-add creates selinux.db.tar.xz and makes selinux.db a symlink to it.

... And searching about similar issues, I found out this appears to be a GitHub issue in actions/upload-artifact v4.3.5 released last week, fixed in v4.3.6 release 4 days ago to fix https://github.com/actions/upload-artifact/issues/590 with https://github.com/actions/upload-artifact/pull/594.

I've just triggered the build&release workflow again (https://github.com/archlinuxhardened/selinux/actions/runs/10334164646). Let's see if this un-breaks things.

Na-Sizuku commented 1 month ago

Hello, Thanks for the bug report. It seems GitHub recently changed the way symbolic links are hosted in release artifacts 😕.

For information, the command which created the SELinux repository are

https://github.com/archlinuxhardened/selinux/blob/d6b4793e26e7a369644119aa44d606301fa9e342/.github/workflows/main.yml#L187-L202

These commands download all built packages, run repo-add /repo/selinux.db.tar.xz /repo/* and upload the result as a GitHub Actions Artifact. Command repo-add creates selinux.db.tar.xz and makes selinux.db a symlink to it.

... And searching about similar issues, I found out this appears to be a GitHub issue in actions/upload-artifact v4.3.5 released last week, fixed in v4.3.6 release 4 days ago to fix actions/upload-artifact#590 with actions/upload-artifact#594.

I've just triggered the build&release workflow again (https://github.com/archlinuxhardened/selinux/actions/runs/10334164646). Let's see if this un-breaks things.

Thanks, is look like need take some time to build packges, later I will test it and give you feed back.

fishilico commented 1 month ago

The workflow succeeded and my test environment was able to download and use selinux.db. Could you please check whether you still have any issue using the package repository?

Na-Sizuku commented 1 month ago

The workflow succeeded and my test environment was able to download and use selinux.db. Could you please check whether you still have any issue using the package repository?

Is work now thanks for you help.

:: Synchronising package databases...
 core is up to date
 extra                                                                           7.3 MiB  5.63 MiB/s 00:01 [################################################################] 100% 
community is up to date
 archlinuxcn                                                                  1472.5 KiB  2.67 MiB/s 00:01 [################################################################] 100% 
selinux                                                                        11.2 KiB  7.35 KiB/s 00:02 [################################################################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Packages (42) bash-5.2.032-1  binutils-2.43+r4+g7999dae6961-1  ca-certificates-mozilla-3.103-1  cryptsetup-2.7.4-1  curl-8.9.1-2  gcc-14.2.1+r32+geccf707e5ce-1
              gcc-libs-14.2.1+r32+geccf707e5ce-1  git-2.46.0-1  glib-networking-1:2.80.0-3  glibc-2.40+r16+gaa533d58ff-2  gsettings-desktop-schemas-46.1-2
              gsettings-system-schemas-46.1-2  hwdata-0.385-1  iproute2-selinux-6.10.0-2  lib32-gcc-libs-14.2.1+r32+geccf707e5ce-1  lib32-glibc-2.40+r16+gaa533d58ff-2
              libtirpc-1.3.5-1  libtool-2.5.1-2  libx11-1.8.10-1  libxtst-1.2.5-1  licenses-20240728-1  linux-zen-6.10.3.zen1-2  logrotate-selinux-3.22.0-1  lz4-1:1.10.0-2
              mesa-1:24.1.5-1  nss-3.103-1  pkgfile-22-1  python-jaraco.functools-4.0.2-1  python-jaraco.text-4.0.0-1  python-networkx-3.3-2  python-numpy-2.0.1-1
              readline-8.2.013-1  selinux-refpolicy-git-RELEASE_2_20240226.r99.g71f4bd199-1  sudo-selinux-1.9.15.p5-2  systemd-libs-selinux-256.4-1
              systemd-resolvconf-selinux-256.4-1  systemd-selinux-256.4-1  systemd-sysvcompat-selinux-256.4-1  systemd-ukify-selinux-256.4-1  vim-9.1.0648-1
              vim-runtime-9.1.0648-1  xmlsec-1.3.5-1

Total Download Size:    349.33 MiB
Total Installed Size:  1137.77 MiB
Net Upgrade Size:         3.47 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages...
AFlyingNut commented 1 month ago

Hello. Yes it works for me now. Thanks for the quick fix!