Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AFlyingNut opened this issue Aug 10, 2024 · 6 comments

Comments

@AFlyingNut
Copy link

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
Copy link

Na-Sizuku commented Aug 10, 2024

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
Copy link
Member

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

- name: Get the SELinux packages from build job
uses: actions/download-artifact@v4
with:
name: Arch Linux packages for SELinux support
path: /tmp/boots/repo
- name: Create package repository files
run: |
sudo /tmp/boots/usr/bin/arch-chroot /tmp/boots /bin/bash -c \
'repo-add /repo/selinux.db.tar.xz /repo/*'
- name: Upload the ready repository as an artifact
uses: actions/upload-artifact@v4
with:
name: SELinux pacman repository
path: /tmp/boots/repo

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.

@Na-Sizuku
Copy link

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

- name: Get the SELinux packages from build job
uses: actions/download-artifact@v4
with:
name: Arch Linux packages for SELinux support
path: /tmp/boots/repo
- name: Create package repository files
run: |
sudo /tmp/boots/usr/bin/arch-chroot /tmp/boots /bin/bash -c \
'repo-add /repo/selinux.db.tar.xz /repo/*'
- name: Upload the ready repository as an artifact
uses: actions/upload-artifact@v4
with:
name: SELinux pacman repository
path: /tmp/boots/repo

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
Copy link
Member

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
Copy link

Na-Sizuku commented Aug 10, 2024

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants