Debian Installation Instructions curl fails

I decided I would install gitlab on my own server. It’s running debian 10. I followed this guidehttps://about.gitlab.com/install/#debian, but when I ran this command:

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash

I got the following:

   X@Y:~# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
100  5933  100  5933    0     0  22473      0 --:--:-- --:--:-- --:--:-- 22473
curl: (23) Failed writing body (0 != 5933)

Instead using the following command:

source <(curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh)

made everything work correctly. Not sure if this happened to anyone else, but it might be good to update the instructions.

NEVER do curl | sh style commands! You don’t know what you’re executing. It only gets worse whenyou add sudo to the mix.

A lot of documentation online tells you to, but it’s a terrible idea. The way around it is to download the script, inspect it and execute the downloaded and inspected copy. (the download might change between two downloads, so it has to be the downloaded copy you execute).

Making problems (like this) harder to debug is another reason not to do it.

Only a few things can be said for sure:

  • for some reason curl couldn’t write the downloaded script to disk
  • subsequent installation of GitLab didn’t cause problems, so unless your working directory is on another partition, it wasn’t a problem with diskspace

In my mind the most likely explanation is that you ran the command in a directory where you don’t have write permissions. Note that curl (sanely) isn’t executed with sudo.