Broken gitlab-runner debian packaging

:hugs: Please help fill in this template with all the details to help others help you more efficiently. Use formatting blocks for code, config, logs and ensure to remove sensitive data.

Problem to solve

Preparing to unpack .../gitlab-runner-helper-images_17.7.0-1_all.deb ...
Unpacking gitlab-runner-helper-images (17.7.0-1) ...
dpkg: error processing archive /var/cache/apt/archives/gitlab-runner-helper-images_17.7.0-1_all.deb (--unpack):
 trying to overwrite '/usr/lib/gitlab-runner/helper-images/prebuilt-ubuntu-x86_64-pwsh.tar.xz', which is also in package gitlab-runner 17.6.0-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../gitlab-runner_17.7.0-1_amd64.deb ...
Unpacking gitlab-runner (17.7.0-1) over (17.6.0-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/gitlab-runner-helper-images_17.7.0-1_all.deb

Problem is caused by introducing a new package taking over files from an existing package without declaring Replaces: gitlab-runner (<< 17.7) (exact version needs to be determined) and equivalent Breaks:. See also the Debian Policy Manual, chapter 7.6 (no link provided because of restriction banning me from posting) .

Steps to reproduce

apt upgrade from 17.6.0-1 to 17.7.0-1

Configuration

gitlab-runner on Debian bookworm.

Versions

Please add an x whether options apply, and add the version information.

  • Self-managed
  • GitLab.com SaaS
  • Dedicated

Versions

  • GitLab (Web: /help or self-managed system information sudo gitlab-rake gitlab:env:info):

Helpful resources

  1. Check the FAQ for helpful documentation, issues/bugs/feature proposals, and troubleshooting tips.
  2. Before opening a new topic, make sure to search for keywords in the forum search
  3. Check the GitLab project for existing issues. If you encounter a bug, please create a bug report issue.
  4. Review existing troubleshooting docs.

Thanks for taking the time to be thorough in your request, it really helps! :blush:

Workaround

dpkg --force-overwrite -i /var/cache/apt/archives/gitlab-runner-helper-images_17.7.0-1_all.deb /var/cache/apt/archives/gitlab-runner_17.7.0-1_amd64.deb
4 Likes

I can confirm this, we had the same issue tonight, running Debian Bookworm.

dpkg: error processing archive /var/cache/apt/archives/gitlab-runner-helper-images_17.7.0-1_all.deb (--unpack):
 trying to overwrite '/usr/lib/gitlab-runner/helper-images/prebuilt-ubuntu-x86_64-pwsh.tar.xz', which is also in package gitlab-runner 17.6.0-1

I had similar this morning. I just ran the updated process again and it pulled in the gitlab-runner-helper-image package without problems.

Thanks! Same issue here on Ubuntu as well. Our systems auto-upgraded on December 19th and then the services went offline as the systemd unit unit files got deleted. Appreciate your posting here so I could confirm it was the same issue we were seeing. Can confirm the workaround seems to work on both intel and arm64 (and same issue):

# x86_64 builder
dpkg --force-overwrite -i /var/cache/apt/archives/gitlab-runner-helper-images_17.7.0-1_all.deb /var/cache/apt/archives/gitlab-runner_17.7.0-1_amd64.deb
# arm64 builder
dpkg --force-overwrite -i /var/cache/apt/archives/gitlab-runner-helper-images_17.7.0-1_all.deb /var/cache/apt/archives/gitlab-runner_17.7.0-1_arm64.deb

gitlab-runner-helper-images does not replace gitlab-runner, so declaring Replaces: gitlab-runner (<< 17.7) is wrong! It does conflict with gitlab-runner version 17.6 (17.5 doesn’t contain those files), so a Conflicts: gitlab-runner (= 17.6) (I don’t remember the syntax, maybe it has to be different).

@grove: please read the Debian Policy Manual before you post such falsehoods.

I expect what they could have done was put a depends to make the gitlab-runner-helper-image depend on gitlab-runner-17.7.0-1 to ensure that was installed first. This would seem to be true, since on my system when running apt-get upgrade I got an error message, but on the subsequent run, gitlab-runner-helper-images was installed, and the helper package got installed without problems. So I never had to use the force-overwrite parameters.

Start-Date: 2024-12-20  10:43:07
Install: gitlab-runner-helper-images:amd64 (17.7.0-1, automatic)
Upgrade: gitlab-runner:amd64 (17.6.0-1, 17.7.0-1)
Error: Sub-process /usr/bin/dpkg returned an error code (1)
End-Date: 2024-12-20  10:43:14

Start-Date: 2024-12-20  10:43:51
Install: gitlab-runner-helper-images:amd64 (17.7.0-1, automatic)
End-Date: 2024-12-20  10:44:37

and:

Log started: 2024-12-20  10:43:07
Selecting previously unselected package gitlab-runner-helper-images.
(Reading database ... 42845 files and directories currently installed.)
Preparing to unpack .../gitlab-runner-helper-images_17.7.0-1_all.deb ...
Unpacking gitlab-runner-helper-images (17.7.0-1) ...
dpkg: error processing archive /var/cache/apt/archives/gitlab-runner-helper-images_17.7.0-1_all.deb (--unpack):
 trying to overwrite '/usr/lib/gitlab-runner/helper-images/prebuilt-ubuntu-x86_64-pwsh.tar.xz', which is also in package gitlab-runner 17.6.0-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../gitlab-runner_17.7.0-1_amd64.deb ...
Unpacking gitlab-runner (17.7.0-1) over (17.6.0-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/gitlab-runner-helper-images_17.7.0-1_all.deb
Log ended: 2024-12-20  10:43:14

Log started: 2024-12-20  10:43:51
(Reading database ... 42831 files and directories currently installed.)
Preparing to unpack .../gitlab-runner-helper-images_17.7.0-1_all.deb ...
Unpacking gitlab-runner-helper-images (17.7.0-1) ...
Setting up gitlab-runner-helper-images (17.7.0-1) ...
Setting up gitlab-runner (17.7.0-1) ...
GitLab Runner: detected user gitlab-runner
Runtime platform                                    arch=amd64 os=linux pid=4132 revision=3153ccc6 version=17.7.0
gitlab-runner: the service is not installed
Runtime platform                                    arch=amd64 os=linux pid=4139 revision=3153ccc6 version=17.7.0
gitlab-ci-multi-runner: the service is not installed
Runtime platform                                    arch=amd64 os=linux pid=4159 revision=3153ccc6 version=17.7.0
Runtime platform                                    arch=amd64 os=linux pid=4193 revision=3153ccc6 version=17.7.0

Check and remove all unused containers (both dangling and unreferenced)
-----------------------------------------------------------------------
Total reclaimed space: 0B
Log ended: 2024-12-20  10:44:37

either that or the Replaces/Breaks what was already mentioned.

@iwalker: Depends: won’t work reliably because it only orders the configure phases of the packages (you would need Pre-Depends: to order the other package’s configure before your own unpack phase)
BTW: the issue is addressed in Broken debian packaging after MR !5190 (#38394) · Issues · GitLab.org / gitlab-runner · GitLab

2 Likes

I read the Debian Policy manual years ago (I’ve used Debian since 1999, so it’s since then, but I can’t remember when) but it seems I forgot a major usecase (it’s even explicitly mentioned) for “Replaces”. Sorry for that.

And checking everything I wrote I found that 17.5 does contain those files (I checked on one of our runners, that has 17.5, but must have made a typo when not being able to see anything in /usr/lib/gitlab-runner. Looking on our mirror server, there have been files in /usr/lib/gitlab-runner (the amount of files have changed, haven’t done a full investigation into that) since gitlab-runner 11.1.

After seeing this error, I have “solved” the problem by issuing the command sudo apt --fix-broken install.