Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab CI Build failed gitlab-runner-prebuilt.tar.xz: no such file or directory

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
like image 815
vpedrosa Avatar asked Feb 20 '18 17:02

vpedrosa


3 Answers

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.

like image 158
Bartłomiej Zieliński Avatar answered Oct 23 '22 06:10

Bartłomiej Zieliński


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.

like image 14
Alcalyn Avatar answered Oct 23 '22 06:10

Alcalyn


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
like image 3
Tammy Rabbit Avatar answered Oct 23 '22 06:10

Tammy Rabbit