Skip to content

[已解決] GitLab 無法正常啟動且 "systemctl start gitlab-runsvdir.service" 凍結

Last Updated on 2022-03-24 by Clay

今天我碰到一個情況,是伺服器中所安裝的 GitLab 無法正常啟動,且透過終端機使用 sudo systemctl start gitlab-runsvdir.service 會使畫面凍結freeze)住。

無論使用:

sudo gitlab-ctl status
sudo gitlab-ctl stop
sudo gitlab-ctl start


都會出現:

fail: alertmanager: runsv not running
fail: crond: runsv not running
fail: gitaly: runsv not running
fail: gitlab-exporter: runsv not running
fail: gitlab-workhorse: runsv not running
fail: grafana: runsv not running
fail: logrotate: runsv not running
fail: nginx: runsv not running
fail: node-exporter: runsv not running
fail: postgres-exporter: runsv not running
fail: postgresql: runsv not running
fail: prometheus: runsv not running
fail: redis: runsv not running
fail: redis-exporter: runsv not running
fail: registry: runsv not running
fail: sidekiq: runsv not running
fail: unicorn: runsv not running


所以即便想要重新啟動 GitLab 也無法。


解決方法

或許有一種可能,是被 plymouth-quit-wait.service 這項行程給堵塞住了。這是參考自 https://forum.gitlab.com/t/plymouth-quit-wait-service-preventing-gitlab-runsvdir-service-possible/48442 這篇討論。發文者提到他花了兩小時在啟動他的 GitLab CE我所遇到的也同樣是此版本),最後他鎖定了 plymounth-quit-wait.service 是問題的根源。

而我也是同樣的狀況。

我在使用以下指令後,會看到許多阻塞的行程:

sudo systemctl list-jobs


Output:

JOB UNIT                                 TYPE  STATE  
 98 gitlab-runsvdir.service              start waiting
  1 graphical.target                     start waiting
120 systemd-update-utmp-runlevel.service start waiting
182 ureadahead-stop.timer                start waiting
104 plymouth-quit-wait.service           start running
174 system-getty.slice                   start waiting
 14 setvtrgb.service                     start waiting
  2 multi-user.target                    start waiting

8 jobs listed.

而這些行程都在等待編號 104 的 plymouth-quit-wait.service

接著我通過查詢網路上的說明,得知此行程僅只是在開機過程中讀取啟動的圖示、並應該在啟動結束卸載掉。

而我的伺服器自然是已經開機完成了,於是我毫無顧忌地使用以下指令結束掉該行程:

sudo systemctl stop plymouth-quit-wait.service

sudo systemctl start gitlab-runsvdir.service
sudo systemctl list-jobs


Output:

No jobs running.


確認沒有任何行程阻塞,接著嘗試啟動 gitlab

sudo gitlab-ctl start


Output:

ok: run: alertmanager: (pid 28589) 31s
ok: run: crond: (pid 28570) 31s
ok: run: gitaly: (pid 28574) 31s
ok: run: gitlab-exporter: (pid 28571) 31s
ok: run: gitlab-workhorse: (pid 28586) 31s
ok: run: grafana: (pid 28588) 31s
ok: run: logrotate: (pid 28566) 31s
ok: run: nginx: (pid 28562) 31s
ok: run: node-exporter: (pid 28572) 31s
ok: run: postgres-exporter: (pid 28585) 31s
ok: run: postgresql: (pid 28565) 31s
ok: run: prometheus: (pid 28575) 31s
ok: run: redis: (pid 28569) 31s
ok: run: redis-exporter: (pid 28577) 31s
ok: run: registry: (pid 28578) 31s
ok: run: sidekiq: (pid 28584) 31s
ok: run: unicorn: (pid 28587) 31s

這一次果然沒有任何問題了。

或許這是一個可以參考的解決步驟,很感謝當初留下紀錄的發文者。


References


Read More

Tags:

Leave a Reply取消回覆

Exit mobile version