28

I just installed Gitlab Runner on my dev machine (Ubuntu 17.10) for testing. When I run the runner I got:

$: sudo gitlab-runner exec docker test       
   Running with gitlab-ci-multi-runner dev (1.4.2)
   Using Docker executor with image php:5.6 ...
   ERROR: Build failed (system failure): open /var/lib/gitlab-runner/gitlab-runner-prebuilt.tar.xz: no such file or directory
   FATAL: open /var/lib/gitlab-runner/gitlab-runner-prebuilt.tar.xz: no such file or directory 

.gitlab-ci.yml file:

image: php:5.6

before_script:
  - php -v

stages:
  - test

test:
  script:
  - php -v

Current installation process:

sudo apt-get install gitlab-runner

Output:

...
Configuring gitlab-ci-multi-runner (1.4.2+dfsg-1) ...
I: generating GitLab Runner Docker image. This may take a while...
E: No mirror specified and no default available
W: please run 'sudo /usr/lib/gitlab-runner/mk-prebuilt-images.sh' to generate Docker image.
...

So I did:

$: sudo /usr/lib/gitlab-runner/mk-prebuilt-images.sh
   I: generating GitLab Runner Docker image. This may take a while...
   E: No mirror specified and no default available
vpedrosa
  • 811
  • 1
  • 6
  • 17

6 Answers6

66

Got the same problem today. Turns out cdebootstrap command in usr/lib/gitlab-runner/mk-prebuilt-images.sh is causing this error message:

cdebootstrap \
     --flavour=minimal \
     --exclude="dmsetup,e2fsprogs,init,systemd-sysv,systemd,udev" \
     --include="bash,ca-certificates,git,netcat-traditional" \
     stable ./debian-minbase

Change the last line to:

     stable ./debian-minbase https://deb.debian.org/debian/ 

The script should now proceed without any errors. More info on debootstrap can be found here.

Ralph Bisschops
  • 1,888
  • 1
  • 22
  • 34
  • 5
    I'm amazed at how it's now over a year later and I installed gitlab-runner yesterday on 18.04 and this is still how I fixed it... – Max Jun 12 '19 at 18:54
  • Same here, had no problem before, I updated to 18.04 and the problem appeared, editing this line fixed it – Tofandel Jun 15 '19 at 19:41
  • 2
    Any particular reason why you are putting an `http` instead of an `https` URL there? – us2012 Jun 26 '19 at 13:10
  • @us2012 Good point! I didn't check it with https, though. If you can confirm that it works with https, I'll edit the answer to use this protocol instead. – Bartłomiej Zieliński Jun 28 '19 at 15:05
  • Did not help on Elementary OS 5.0 Juno – kyb Aug 14 '19 at 11:52
  • This is the correct answer for Ubuntu 18.04. Just tried today. Thanks! – gimp3695 Aug 24 '19 at 18:34
  • Install cdebootstrap, replace ```cdebootstrap stable ./debian-minbase``` with ```cdebootstrap stable ./debian-minbase https://deb.debian.org/debian/``` and check logs ```nano /var/cache/gitlab-runner/cdebootstrap.log```. I have a problem with RSA 6D33866EDD8FFA41C0143AEDDCC9EFBF77E11517. – pushStack Aug 30 '19 at 15:20
  • @Max Did you use the proper Repo for gitlab-runner as stated in https://docs.gitlab.com/runner/install/linux-repository.html ? I installed `gitlab-runner` without it and got the ubuntu delivered version 10.x where it was still buggy. Using the newest version from the repo fixed it for me. – Roger Lehmann Nov 11 '19 at 15:32
  • 1
    Workaround is in this issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/1605 – dols Apr 24 '20 at 13:25
14

The currently accepted answer (editing mk-prebuilt-images.sh script) didn't worked for me, but I found how to fix it for my case:

I was wrong when just doing apt-get install gitlab-runner, and checked my version:

$ gitlab-runner -v
Version:      10.5.0

which is not the latest version, I expected to have the version 12.

So I found this installation guide:

https://gitlab.com/gitlab-org/gitlab-runner/blob/master/docs/install/linux-repository.md

This guide says to add an up-to-date repository:

# For Debian/Ubuntu/Mint
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash

# For RHEL/CentOS/Fedora
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash

Then install it:

apt-get update
apt-get install gitlab-runner

And now I have:

$ gitlab-runner -v
Version:      12.3.0

And I can run jobs locally.

Alcalyn
  • 1,531
  • 14
  • 25
3

You can try this command to fix your issue:

$ sudo find / -name "mk-prebuilt-images.sh"

Most likely it will then find

/usr/lib/gitlab-runner/mk-prebuilt-images.sh
Dan Bracuk
  • 20,699
  • 4
  • 26
  • 43
1

I had a similar issue on ubuntu 18.04 which was caused because I accidentally installed the native gitlab-runner package which was version 10.5 (instead of 12.2.0).
The fix for this is provided in the gitlab-runner installation guide.

I just had to manually set the source for the package by adding a pinning configuration file with the following content:

cat <<EOF | sudo tee /etc/apt/preferences.d/pin-gitlab-runner.pref
Explanation: Prefer GitLab provided packages over the Debian native ones
Package: gitlab-runner
Pin: origin packages.gitlab.com
Pin-Priority: 1001
EOF

After that i was able to install gitlab-runner version 12.2.0 and the above mention issue was solved.

Michael Aicher
  • 629
  • 12
  • 14
0

As the workaround can use GitLab-Runner docker image. I found this approach https://angristan.xyz/build-push-docker-images-gitlab-ci/ the best one (from https://stackoverflow.com/a/56765508/3743145)

More info is in official documentation https://docs.gitlab.com/runner/install/docker.html

kyb
  • 7,233
  • 5
  • 52
  • 105
0

I got the same problem on Linux Mint 19.3. I was stuck with version 10.5 even when getting the packages from gitlab.com

deb https://packages.gitlab.com/runner/gitlab-runner/linuxmint/ tricia main
deb-src https://packages.gitlab.com/runner/gitlab-runner/linuxmint/ tricia main

I fell back to get the .deb package and installed it manually (follow this howto ).

curl -LJO https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb
sudo dpkg -i ./gitlab-runner_amd64.deb 

It works perfectly.

Michael Dussere
  • 498
  • 7
  • 25