Not able to add GitLab package repository

I am unable to add the GitLab package repository as described in Step 2 of “Download a GitLab Omnibus package” at this link

The error/message I am receiving on the command line is:
curl: (6) Could not resolve host: packages.gitlab.com

Regards,
Kurt

Hi @kurtreynolds11, good question!

From the error message, it sounds like a networking issue.

To help troubleshoot, can you confirm that the instance has internet access?

Are you using IPv6?

Can you share the output of: grep nameserver /etc/resolv.conf to see if DNS is causing the URL to be unresolvable?

We should be able to diagnose where the issue is occurring by reviewing the output of any/all of the following commands executed on the GitLab server:

  • ping packages.gitlab.com
  • curl -v packages.gitlab.com
  • host packages.gitlab.com
  • dig packages.gitlab.com
  • traceroute packages.gitlab.com

Let us know what you find out!

1 Like

Yes, I also believe it is a network connection issue.

The output of grep nameserver /etc/resolv.conf is "nameserver 127.0.0.53

GitLab server:

  • ping packages.gitlab.com = Temporary failure in name resolution

  • curl -v packages.gitlab.com

  • host packages.gitlab.com = Host packages.gitlab.com not found: 2(SERVFAIL)

  • dig packages.gitlab.com
    Got answer:
    opcode: QUERY, status: SERVFAIL, id: 63684
    flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

        OPT PSEUDOSECTION
        EDNS: version: 0, flags: ; udp: 65494
        QUESTION SECTION 
         packages.gitlab.com
    
  • traceroute packages.gitlab.com = Command ‘traceroute’ not found, but can be installed with: …
    When I try to install any additional commands/utilities, I receive "E: Unable to locate package ".

Regards,
Kurt

The output of grep nameserver /etc/resolv.conf is nameserver 127.0.0.53

This indicates that your machine is using itself (localhost) to handle DNS.

If you’re not running a DNS server on port 53 of this machine, then your system will not be able to translate packages.gitlab.com into an IP address, which is required to resolve the DNS query and fetch the packages.

To fix this, I suggest using a publicly available DNS provider like Google (8.8.8.8), Cloudflare (1.1.1.1), OpenDNS (208.67.222.222) or quad 9 (9.9.9.9).

What does this mean? How do I do this?

Note: I added nameserver 8.8.8.8 to file resolv.conf.

Regards,
Kurt

If you’ve set nameserver 8.8.8.8 in resolv.conf, that should basically tell the system to use Google for DNS (ip 8.8.8.8)

Did you try to add the GitLab package repository after having added nameserver 8.8.8.8 in your /etc/resolv.conf?

How do I do this?

Editing /etc/resolv.conf directly is a one quick and easy way to change switch dns - it works, but its not a best practice. https://support.rackspace.com/how-to/changing-dns-settings-on-linux/
For best results, I suggest a good old-fashioned Google search for “change DNS settings on <linux_distribution> ”

I still cannot ping packages.gitlab.com

This may not be the correct way of doing things, but I find it is a way that often works for me. If you are using Ubuntu as your OS, you may find you are using Dnsmasq, so your machine is using its self for DNS lookups. The guide below changes this to use a normal resolv.conf file. As I say it may not be the correct way of sorting this, but it seems to work a majority of the time.

You will either need to sudo su - (to become root) or run all these commands starting with sudo.

cd /etc

ls -l

Check resolv.conf for me. It will probably be a link to /run/systemd/resolve/stub-resolv.conf

If it is.

rm /etc/resolv.conf

This will remove the link.

ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

This will create a new link to the normal resolv.conf file.

Do an nslookup of the packages.gitlab.com again and check the connection like before. The second run of the nslookup should be from a different DNS server rather than from 127.0.0.53. It should be a normal DNS server this time.

When you mentioned this

If you’re not running a DNS server on port 53 of this machine

Does that mean that I should have a proxy setup? Because I did not setup a proxy.

I no longer have the server set to 127.0.0.53. I commented this out in the resolv.conf. So now when I run grep nameserver /etc/resolv.conf, I get an output of

  • #nameserver 127.0.0.53
  • nameserver 8.8.8.8
  • nameserver 8.8.4.4

Is nslookup a Linux command? I’m not familiar with the terminology.

Okay, so I followed your instructions and then ran the command nslookup packages.gitlab.com. The output was connection timed out; no servers could be reached
I get the same output when I run nslookup yahoo.com.

Pinging yahoo.com and packages.gitlab.com still produces Temporary failure in name resolution.

nslookup is a fairly standard command, used in both windows and Linux. What do you get if you just run.

nslookup

Then you should get a prompt like >

then type

server

This should tell you your default server. To switch DNS servers you can just add the IP address, so to switch to google type this.

server 8.8.8.8

Also from the > prompt, you can type what you are searching for.

packages.gitlab.com

I finally installed the desktop edition of Ubuntu and am able to connect to the web via both wired (ethernet) and Wi-Fi. I’m not sure if I somehow installed the server edition wrong or if there was something wrong with the iso image that I downloaded.

I now have the GitLab Repo package installed and am playing around with it. Thank you everyone for your input and help!

Cheers,
Kurt

1 Like