40

I installed Gitlab on Raspberry Pi2, and it had worked well for a couple of months. But since shutting down the power of RPi, it doesn't work anymore. The webpage returns 502 error.

502 Whoops, GitLab is taking too much time to respond.

So I tried reconfigure (sudo gitlab-ctl reconfigure) but, it failed with the error message:

FATAL: Errono::EAFNOSUPPORT: Address family not supported by protocol - socket(2)

I don't know how to resolve this problem.

2
  • 9
    What does gitlab-ctl tail shows ? That should definitely give you a hint about the issue.
    – vikas027
    Nov 28, 2015 at 1:09
  • 1
    @vikas027 It shows very long error log in unicorn_stderr.log file. The error message is FATAL -- : error adding listener addr=127.0.0.1:8080 /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/socket_helper.rb:147:in 'initialize': Cannot assign requested address - bind(2) for "127.0.0.1" port 8080 (Errno::EADDRNOTAVAIL) How to fix it? Nov 29, 2015 at 10:28

13 Answers 13

32

I saw issue like this several times.

If GitLab has been worked fine please do not touch anything. Just wait. It seems GitLab has not been started properly :(

I mean that after booting system you have to wait 1-2 minutes before using GitLab. GitLab needs some time for starting.

3
  • 4
    Waiting wasn't helping me, adding more memory did.
    – 9swampy
    Mar 12, 2017 at 2:41
  • @9swampy, how you add more memory?
    – unbreak
    Nov 13, 2017 at 11:34
  • 2
    I was seeing this issue running GitLab on a Ubuntu VM; allocating a bit more memory helped; from memory I upped from 1 to 2 GB.
    – 9swampy
    Nov 14, 2017 at 20:34
26

I am not adding a comment since my answer needs some good formatting.

So that means, your port 8080 is already being used. I would advise to stop GitLab, and change unicorn port from 8080 to 8081 (or some unused port).

After starting/restarting GitLab wait for 2 minutes, and you should be okay. If not, again check gitlab-ctl tail for any errors.

# gitlab-ctl stop

# vi /etc/gitlab/gitlab.rb   (change only these lines, uncomment if required)
unicorn['port'] = 8081
gitlab_git_http_server['auth_backend'] = "http://localhost:8081"

# gitlab-ctl reconfigure  (to apply the changes)
# gitlab-ctl restart
# lsof -i:8081        (check whether unicorn has started properly)

You need to be root or a sudo user (with root privileges) to run these commands.

7
  • 4
    I changed port number 8080 to 8081 and added a line gitlab_git_http_server['auth_backend'] = "http://localhost:8081" in a gitlab.rb file because it isn't there. But, it still gives same error message. FATAL -- : error adding listener addr=127.0.0.1:8080 Nov 30, 2015 at 6:16
  • The line would definitely be there but with port 8080, you would have to uncomment that and change it to port 8081.
    – vikas027
    Nov 30, 2015 at 6:22
  • I tried reconfigure again. There is another error log in /var/log/gitlab/postgresql/current LOG: received fast shutdown request LOG: database system is shut down LOG: could not bind socket for statistics collector: Cannot assign requested address LOG: trying another address for the statistics collector LOG: could not create socket for statistics collector: Address family not supported by protocol LOG: disabling statistics collector for lack of working socket WARNING: autovacuum not started because of misconfiguration HINT: Enable the "track_counts" option. Nov 30, 2015 at 10:45
  • What does gitlab-ctl status shows ? Are all processes up ? You might have to troubleshoot postgres. Try lsof -i:5432 or sudo -u postgres psql template1
    – vikas027
    Nov 30, 2015 at 10:47
  • All processes are running (logrotate, nginx, postgresql, redis, sidekiq, unicorn). Maybe port 5432 is unused. sudo lsof -i:5432 doesn't return any message. Nov 30, 2015 at 11:04
12

After inspecting the gitlab-ctl tail (reboot loop) it turned out that there is not enough RAM (2GB) and there is no swap file in my fresh Ubuntu setup.

As mentioned in requirements GitLab requires at least 2GB RAM + 2GB swap memory ...

So to create a swap file follow those steps:

gitlab-ctl stop
mkdir /swap && touch /swap/swapfile.img
dd if=/dev/zero of=/swap/swapfile.img bs=1024 count=2M   # if you want 4G change 2M to 4M**
chmod 0600 /swap/swapfile.img
mkswap /swap/swapfile.img
nano /etc/fstab # and add "/swap/swapfile.img swap swap sw 0 0"
swapon /swap/swapfile.img

Verify it works: cat /proc/swaps

    Filename                Type        Size    Used    Priority

    /swap/swapfile.img      file        2097148 0       -1

Finally, run: gitlab-ctl start

More info about creating swap: here

1
  • I meet the 502 error, and I change the virtual box memory from 1GB to 2GB, and the error gone.
    – haiwuxing
    Oct 26, 2018 at 8:01
3

You can follow below steps to fix this kind of issue.

  1. Update unicorn['port'] to ****.(Different port which is not used for process in the system)
  2. Update nginx['port'] to ****.(Different port which is not used for process in the system)
  3. Update web_server username and web_server group in this file as well and set it to apache's/httpd's username and group

Then do gitlab-ctl reconfigure and gitlab-ctl restart

2

You should change your Unicorn Settings If you need to adjust the Unicorn timeout or the number of workers you can use the following settings in /etc/gitlab/gitlab.rb. Change the following:

unicorn['worker_processes'] = 3
unicorn['worker_timeout'] = 120 # or any suitable timeout for your server

do not forget to remove # in line start if commented. Run sudo gitlab-ctl reconfigure for the change to take effect.

0

This error is also occurred when the system, in your case the Raspberry Pi2 (in my case, in an t2.micro AWS EC2 instance) due to not fulfilling the minimum requirements for installing Gitlab.

That is the lack of Memory (t2.micro is 1GiB, but Gitlab requires 4GiB) for further processing. Therefore, provide all the requirements correctly (I occupied a t2.medium instance which is 4GiB instead of t2.micro). It would be appropriate if the system has been enabled accurately.

0

Need to set nginx['listen_port'] and unicorn['port']. For example:

nginx['listen_port'] = 8081
unicorn['port'] = 8082 #the ports should be different

Then:

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
1
  • How is this any different than 3438276? Also, it is always a good idea to point out files which need to be changed too.
    – vikas027
    Oct 21, 2018 at 16:44
0

There was a port collision at my site. Jenkins has already run on my site, which uses the 8080 port also.

Change Gitlab or Jenkins port.

0

Something is listening to the 8080 port, so Unicorn can't start. What does the following command indicate? The ports for Redis, PostgreSQL and Puma can be overridden in

/etc/gitlab/gitlab.rb

as follows:

    redis['port'] = 1234
    postgresql['port'] = 2345
    puma['port'] = 3456

For NGINX port changes please see settings/nginx.md.

see https://docs.gitlab.com/omnibus/common_installation_problems/#tcp-ports-for-gitlab-services-are-already-taken (TCP ports for GitLab services are already taken)

0

Please note if you got 502 Whoops, GitLab is taking too much time to respond before going so much with every step

  • Ensure that your server has at least 4GB of RAM
  • and give her server at least 10 minutes if you are using digital ocean droplet
0

I had that kind of error before and turns out that I had not physicall space (in my case, a virtual machine). Check that you have enough space

-1

It is posyble that you has change change some configuration file, use this lines in your terminal:

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

Now wait a few minutes, and try again.

-2

You should only change external_url http://xxx.xxx.xxx.xx:9090. Don't change # unicorn['port'] = 8080.

1
  • Well, I killed one night and one evening trying to understand what went wrong in my case, I tried different port as It described above and finally I just had extended RAM to 8gb, because I use ubuntu under wmware and 502 is gone. I read ofdoc some time before It, but I thought, that gitlab could run even with less RAM. That behaviour is a bit strange for me :(
    – Nesquik27
    Oct 13, 2019 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.