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

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

5万

积分

0

好友

1万

主题
发表于 2022-9-11 20:40:14 | 查看: 2108| 回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。' `; s% U5 p' r7 ?8 V& K
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
2 A" ]" N9 T9 S- o! `  C运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。9 v3 u3 N! Z5 q
接着设置语言和本地化设置:5 |; T7 v9 T& l& B$ c0 x; z
export LC_ALL=en_US.UTF-8- [' b( B* |0 H9 m. Q
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。+ ^3 m& Q  ^+ \: E
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?0 F  c6 {, ^) H# y5 m% N) w9 V& e
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
3 `( l) D9 v7 I0 s) dRecipe: gitlab::database_migrations# @2 Y2 O  B" r" f
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)1 b5 \! _0 _1 r7 [( h" G6 \
  * rails_migration[gitlab-rails] action run
3 N3 p3 O  T+ i# ?, b    * bash[migrate gitlab-rails database] action run
8 I- I: t& c  |5 x, b      - V7 G  x4 W8 x5 x$ i
      ================================================================================
4 {3 [4 j- G/ f/ @      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
1 Q: {% \; Y# Y- ~6 P      ================================================================================' S% `' @7 }8 n" A$ R5 V
      
. L: E: v2 [& i. @, @& J7 i9 Y: C9 _1 I      Mixlib::ShellOut::ShellCommandFailed
, ~9 W# k% N: u2 {  S9 O3 ]6 [      ------------------------------------
$ J: y" l, w; c9 e/ `      Command execution failed. STDOUT/STDERR suppressed for sensitive resource7 N8 S" T- ^$ L7 f" @0 w
      
' l' w/ f& N% ~/ O" z) }7 R      Resource Declaration:! D# v9 s! U- B6 P% Q0 }+ x
      ---------------------
" n/ V( x* [  h      suppressed sensitive resource output" k* \. M) I& Q2 K1 `* W0 @
      0 i6 M) l: g6 J- \2 A: d
      Compiled Resource:  V: O' Q: Z" t1 Z9 J! K) [, ]
      ------------------8 F6 R- C; h8 D# r' }& e  W" F
      suppressed sensitive resource output& C0 }* q* _" `' X- \
      9 s  t% S  R  w! c! `
      System Info:
2 J& r5 J) Z5 }9 A- b      ------------
$ d" d  b; r" m2 ~7 ?$ T/ i7 |      chef_version=15.17.48 S9 G/ K2 I- ?2 g
      platform=ubuntu
  l5 Q% Q% f, }" c. H- S- l      platform_version=20.04
2 s) h' }9 ~" [4 N5 O3 |      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]5 B: s: U5 ^9 u
      program_name=/opt/gitlab/embedded/bin/chef-client
% _! d4 v6 I, s      executable=/opt/gitlab/embedded/bin/chef-client7 P# N/ Q% s1 J% h( G" ~9 I
      4 c. Y- P( q  [. U
   
1 j( {7 o- M0 j; C+ M9 f3 r+ _' g    ================================================================================
% M& z( a) \+ g6 B    Error executing action `run` on resource 'rails_migration[gitlab-rails]'1 t+ c* ^! |& `9 `$ L" r- \
    ================================================================================
# E" b" E* @' |$ c9 `5 p3 E/ B. e   
" g9 K- F  l2 y3 ?9 x    Mixlib::ShellOut::ShellCommandFailed9 H% P) ^8 V' ^8 b
    ------------------------------------
4 V2 Q6 V' {; C6 x/ @( t    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
: z1 S$ P( @* d2 S. `   
, }2 E$ l4 _7 v" ^0 P    Resource Declaration:
7 I( G, C! H- e" a2 x5 m    ---------------------2 d3 F' P, i# g) ]6 q0 [
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb+ L0 p( _( G( Y9 ?9 T& e: n" {
    6 F+ a3 B$ @& j  ~. b8 i1 Q9 W
     51: rails_migration "gitlab-rails" do9 \2 X- \5 u: U* O1 a
     52:   rake_task 'gitlab:db:configure'0 v7 t: ~5 c( H4 N, Q
     53:   logfile_prefix 'gitlab-rails-db-migrate'! }: _$ j, R! T+ W$ _
     54:   helper migration_helper
( U' d7 X" z3 C/ Z7 s2 F     55: + B7 C/ ~& i4 U5 @  n/ h0 M; W
     56:   environment env_variables
/ ^4 C* U% o3 m9 V6 \% n     57:   dependent_services dependent_services
. g9 Y* F( Q( T+ G4 `     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately0 O& s7 l) S8 M
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately* V& ?* o- {1 g
     60: " V" Y& y1 u# I( u
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }7 m0 F5 }9 V2 i+ u' I8 H
     62: end
3 t+ ^) s, N" U2 B    # s5 k. H1 y& ~( m
    Compiled Resource:
. w4 Q$ h, l, u% S    ------------------4 C3 G+ m/ e+ Y! i' {7 J; S4 ~
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
: d  Q$ \: L" A3 _    " t( s' v) w, w$ q6 _( G- l' U
    rails_migration("gitlab-rails") do
! L  u9 f. O8 j$ L( J( u5 Q      action [:run]. n/ I6 i, [! Z  w$ ~* y
      default_guard_interpreter :default3 M) }& e5 u$ f4 U8 I
      declared_type :rails_migration
2 S6 L+ ~  B! O      cookbook_name "gitlab"
& H# a4 _& s! z: F3 B4 v; _5 l' ?      recipe_name "database_migrations"; l+ m. y2 X2 C+ P) K! h6 ~
      rake_task "gitlab:db:configure"( O/ v; d/ u% ?. r3 V' R
      logfile_prefix "gitlab-rails-db-migrate"0 Y9 X2 w1 ?( @$ t) l. p; n7 l
      helper "*sensitive value suppressed*"' |# [% y5 I: F* l1 M$ u6 j( g; i
      environment "*sensitive value suppressed*"0 j# c# D% H7 I; Z/ W9 n" h  }
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]7 C* \4 R# a2 M8 u
      only_if { #code block }# L9 J1 S  j) A" z  D# ^
    end
8 n* @4 y& Q8 U# ~   
' G2 k# m7 j) f    System Info:- G+ n1 ?: }, ]9 V8 ~5 j+ W8 `+ i4 G
    ------------
0 ~  O7 ]( @: ]) z    chef_version=15.17.4
* p/ Z' Z& E" K! f  S    platform=ubuntu
4 _$ I( k4 g  b" R  S2 U! u7 [    platform_version=20.04
, A7 D* S6 U+ o+ G& t    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
3 m: ^, b5 F9 I2 N    program_name=/opt/gitlab/embedded/bin/chef-client
4 P: c3 F& g+ C8 [/ ~    executable=/opt/gitlab/embedded/bin/chef-client- m. k8 ^3 y  e0 W& D  l+ H
    2 \5 l5 [9 S3 z- z7 `: F8 R7 Z
Running handlers:
, g! V8 O0 g. B9 cThere was an error running gitlab-ctl reconfigure:1 t. s, n8 w, s  P/ }  D  |+ ?6 C
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/ P) i# [9 V7 c, b
Running handlers complete
% \3 u/ k$ }2 _& d* x+ yChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:1 l3 O. @7 q# w& o4 j
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;. _' V' n; q2 T) Z7 o# F! ~
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
# z3 q$ G7 V5 h7 }4 y3. 再次运行 gitlab-rake db:migrate,确认不会再报错;4 l' m! Y- v) n5 X
4. 运行 gitlab-ctl reconfigure;
* F, d( ^" b! N: A- Y% k( g5. 重启Gitlab:gitlab-ctl restart。, q0 D" k* @3 O! H
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
8 d( x+ b/ p* H0 R- C参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated! ^5 M+ I; r/ `4 r0 A2 V
2. gitlab-ctl reconfigure failing due to migration issue7 Y+ n) D/ k' E$ P3 S) F
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)

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

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

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

GMT+8, 2026-10-17 08:13 , Processed in 0.122351 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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