Install GitLab-Runner in Ubuntu 19.04 and 19.10

In Ubuntu from 19.04 to 20.04, the GitLab Runner installer doesn't work completely. After installed by apt, you often have to do the post-installation process manually, running /usr/lib/gitlab-runner/ to build some Docker image, but fail at this step.

Here are step you need to do, to successfully build that Docker image (assumed that you already installed Docker).

First, find a Debian repository mirror near to you. I'm in Viet Nam, so the mirror I chose is

Second, open file for editing, find these lines:

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

and add that mirror URL after "./debian-minbase". It becomes:

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

You also have to delete the backslash ("") at the end of line, if later you see this error:

awk: cmd. line:1: warning: regexp escape sequence `\ ' is not a known regexp operator

Third, download the latest version of the two packages libdebian-installer-extra4, libdebian-installer4 from Debian repository. For example, at the time of my writing, those files can be found in the XTDV mirror at:

We will install those *.deb files with dpkg -i command.

Here are the commands to do it quickly (copy/paste):

$ cd /tmp/
$ wget
$ wget
$ sudo dpkg -i *.deb

After that, we run the GitLab's script again. Now it is successful:

$ sudo /usr/lib/gitlab-runner/
I: Generating GitLab Runner Docker image. This may take a while...
I: cdebootstrap; saving build log to /var/cache/gitlab-runner/cdebootstrap.log /
  100 %        53,3 MiB / 197,4 MiB = 0,270   6,9 MiB/s       0:28             
'/usr/bin/gitlab-runner-helper' -> './gitlab-runner-helper'
'/usr/lib/gitlab-runner/gitlab-runner-build' -> './gitlab-runner-build'
'/usr/lib/gitlab-runner/gitlab-runner-cache' -> './gitlab-runner-cache'
'/usr/lib/gitlab-runner/gitlab-runner-service' -> './gitlab-runner-service'
'/usr/lib/gitlab-runner/Dockerfile' -> './Dockerfile'
Sending build context to Docker daemon  65.29MB daemon  557.1kB
Step 1/3 : FROM scratch
Step 2/3 : ADD stable.tar.xz /
 ---> 8770ce53ba90
Step 3/3 : COPY gitlab* /usr/bin/
 ---> 16eb39566cb1
Successfully built 16eb39566cb1
Successfully tagged gitlab-runner-helper:11.2.0
I: Packing image into /var/lib/gitlab-runner/gitlab-runner-helper.tar.xz
  100 %        46,2 MiB / 206,3 MiB = 0,224   2,0 MiB/s       1:41             
Untagged: gitlab-runner-helper:11.2.0
Deleted: sha256:16eb39566cb1a7831f65022eb279825da5369c2410e9fff5af2a3e90a187f95c
Deleted: sha256:a6fc8fe2e360618e6f9562efc8be9d69ab9abf0fdd0a0299463f8651cc9c4da3
Deleted: sha256:8770ce53ba90689c94d61f2543f7a375c05678d48986c1ced354f3de074b6d93
Deleted: sha256:7b9a74a902cafe5ee188d074c8010e9c66a895f4f06deb9b05d1c79a79f6caf3
Website này sử dụng Disqus cho comment. Nếu bạn không thấy các comment dưới đây, có lẽ Disqus đang bị chặn. Bạn cần đổi DNS.