青浦修电脑 青浦笔记本维修 青浦手机维修 青浦电器维修

找回密码
立即注册
搜索
热搜: 活动 交友 discuz
发新帖

5万

积分

0

好友

1万

主题
发表于 2022-9-11 20:40:14 | 查看: 2030| 回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
0 `+ p! S- V( e5 b7 A$ t0 G# ?- C登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。% O3 Q0 ^+ t  c7 k# x3 j& P; m
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
0 ^$ o( d" s. Q接着设置语言和本地化设置:
8 j4 Z* m. p& h$ r9 v' U* |" ]export LC_ALL=en_US.UTF-8  o, P0 q3 Z" R& E! q) n5 H- ^& F
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
) j1 A8 ], @" Z9 T) i2 l但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?% N# q- j8 ~8 a. M1 R. Z1 M/ Q
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:/ j+ h% B+ O; @3 y) C2 x
Recipe: gitlab::database_migrations* \3 \0 @4 m1 Z  U0 j& _7 E. ]7 i
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)* h7 S4 d3 n/ I+ e
  * rails_migration[gitlab-rails] action run
; R. ?" Q7 E" h  _+ ^    * bash[migrate gitlab-rails database] action run& G, q9 G6 v7 ~1 j
      0 j! f( f. S( f" Y0 q/ \0 C
      ================================================================================
- H3 ^( @2 a7 e4 z      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
5 v0 [' Z* M: g1 j1 C      ================================================================================# q; ?& n, r) N4 @" x: E$ A/ F/ Z0 a) p  y
      ; W1 \4 e& U& @
      Mixlib::ShellOut::ShellCommandFailed+ g, @6 E/ J3 n, F- f) Q3 D
      ------------------------------------/ |5 ^: B, }% e4 m# _# ]3 m
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource/ ^' ^  F0 n/ Q5 H/ J2 K) x
      % C9 L! P3 {8 k$ s: ?5 n/ M( A
      Resource Declaration:2 i, N& U5 C5 V( o
      ---------------------- s: ~( U/ e8 n
      suppressed sensitive resource output
) V! \# ?: t4 ?. f: Q: d      
$ Z) v2 I( `/ Z% w! k) F      Compiled Resource:1 s# [9 E  K. }9 X
      ------------------
* i" p$ V# M! ~* {# w8 ^7 g      suppressed sensitive resource output# w8 |2 P0 \* w& m( }/ U
      
, M; W6 M0 R9 E      System Info:6 P& I+ u9 M' ^6 r5 j
      ------------7 ?1 h- Y5 L- B% _- |! W
      chef_version=15.17.4
! Z: i& j  z. f9 o. [3 F      platform=ubuntu
7 d0 F5 J; z- s2 O' Y  `. j      platform_version=20.040 [/ N, w6 r& h4 x: ]8 l$ B
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
6 Y. a0 V; `' d! q* j6 U      program_name=/opt/gitlab/embedded/bin/chef-client
) s4 [, H3 _+ X2 p& V! ~      executable=/opt/gitlab/embedded/bin/chef-client3 Z' g4 S* b9 ~- w9 o8 l& o4 [
      + l) r! M' Z6 j% R. U1 |  G
    # m. g9 y" T1 t. T9 {
    ================================================================================* L" v- v  x2 n% i
    Error executing action `run` on resource 'rails_migration[gitlab-rails]', _. c( N1 P5 z: n/ V% _# h
    ================================================================================
8 g1 _$ c$ R! M2 X   
% O! H" O. D, o    Mixlib::ShellOut::ShellCommandFailed
5 _7 I4 i/ N* V" v' k# B5 W. n    ------------------------------------; z' B# e, r' [- C5 a+ P" G1 k. H$ V: P
    bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource
0 C3 ^* J' C; `+ x8 i9 [- h    & y0 R3 I0 U; z
    Resource Declaration:
* Q6 u, E' L: s5 y" W$ C$ Z  Y    ---------------------8 r3 _0 P/ Q. ~" _) w
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
) u$ _( T9 Y3 `! i9 X9 |, l% K$ |   
  `2 c5 Y+ @  M; y$ {2 A3 w     51: rails_migration "gitlab-rails" do/ I( K$ n+ ]& R# G6 R  c; G
     52:   rake_task 'gitlab:db:configure'
2 }+ J; E  {! k4 B+ q$ }6 l     53:   logfile_prefix 'gitlab-rails-db-migrate'
/ P+ j% i4 D8 D" d' U) m     54:   helper migration_helper+ l# @2 j# a6 t7 P/ W
     55:
- [/ |1 ]7 d9 G  Z- p# ?  z     56:   environment env_variables, R4 n: [0 y: _6 w
     57:   dependent_services dependent_services
5 f7 O5 |4 j  x2 ]  c1 Y' F( m     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately6 |6 m7 C4 D# ?2 j) x- k  h; T; S
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately( E7 c5 s! I8 O) A2 a7 V* p0 a
     60:
3 ?8 f: J$ e, k: |- ^0 V     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
8 V$ a' Q1 X# D     62: end! Q9 J4 B9 \. C- V
   
. O. e: F! J& o5 h    Compiled Resource:6 k* U% E! R# }
    ------------------7 P- Y# G1 s" Z( [+ b- {+ B
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
# J3 m; r' y9 T   
1 @6 _( {$ x4 J/ A8 Z/ y; z    rails_migration("gitlab-rails") do, E0 W, E2 L( {* G/ }% C% C1 Q
      action [:run]
0 u6 x4 T/ A. x5 g) E, U      default_guard_interpreter :default
  _0 Z& Y8 W% c' n* ~4 e& e0 }      declared_type :rails_migration
  D! X0 i& V; F      cookbook_name "gitlab"4 l: Z7 Z% C% p
      recipe_name "database_migrations"
# b3 W8 N) i9 r- J6 A" s      rake_task "gitlab:db:configure"0 W4 T( l  V' N0 T& J4 d4 c
      logfile_prefix "gitlab-rails-db-migrate"
5 `7 D! l$ R# P& q      helper "*sensitive value suppressed*"' y; `. G8 s0 n- R5 p  G
      environment "*sensitive value suppressed*") Q; U$ I. |6 u
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]! T& U) w  z4 a* ]  W
      only_if { #code block }$ ^$ K5 I5 ~9 @7 {# V1 Q
    end( e& f  p! w% S$ i. w
   
2 q& O3 L* L/ F/ l" d3 K    System Info:
+ a; h9 H- O2 L% E    ------------
, N# q' j" S& ^6 g5 `    chef_version=15.17.49 W6 h, v/ d3 }5 Z' `
    platform=ubuntu) v" g* L! U! Q& y9 |0 t
    platform_version=20.04
$ h' g- O# t, O& e5 z    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
. w. L' ]/ f  L) `& N, o( n" y    program_name=/opt/gitlab/embedded/bin/chef-client1 _; |1 K$ i' c/ d- ]+ o. [
    executable=/opt/gitlab/embedded/bin/chef-client( g& M; b2 [) R3 R! |3 u
    : K3 B5 k# j6 B8 B! J$ U
Running handlers:
* |% D% t1 t$ @  }5 A" j0 f* PThere was an error running gitlab-ctl reconfigure:+ B* K+ z' {4 p3 W/ E; U/ S
rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource
* E* |- J: Z% E) p/ Y9 ?' CRunning handlers complete
8 S! ]* b7 s+ P2 Y2 fChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:, P" S- ~* A2 l0 h7 `, M
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;6 o- O, {; P/ L8 H- R/ f
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
$ l6 a/ j7 \1 z9 n/ }3 I3. 再次运行 gitlab-rake db:migrate,确认不会再报错;, K4 ~2 K3 ~$ q& F! \2 {# q! C9 u
4. 运行 gitlab-ctl reconfigure;1 _; x* h! Q% P# t4 [+ {/ t. c. ?
5. 重启Gitlab:gitlab-ctl restart。
# l! N- `4 q: D) C; _- a0 k, [需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
- b+ P3 l8 s0 v/ S% }0 h. @# R( l参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated/ I  X( T: K& i9 `6 O
2. gitlab-ctl reconfigure failing due to migration issue) Z' D9 |# `" G! {! ?
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)

收藏回复 显示全部楼层 道具 举报

您需要登录后才可以回帖 登录 | 立即注册

QQ|Archiver|手机版|小黑屋|青浦海洋数码电脑城 ( 沪ICP备18024137号 )

GMT+8, 2026-9-22 18:44 , Processed in 0.065157 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表