postgresql – 运行gitlab-ctl reconfigure时的“initdb:encoding mismatch”

前端之家收集整理的这篇文章主要介绍了postgresql – 运行gitlab-ctl reconfigure时的“initdb:encoding mismatch”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在一个Vagrant框中安装 Gitlab-ce Omnibus(Debian 18.04 LTS).
在我的配置脚本中,我运行gitlab-ctl reconfigure.我收到一个错误

initdb: encoding mismatch

控制台输出

  1. default: * execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] action run
  2. default:
  3. default: [execute] The files belonging to this database system will be owned by user "gitlab-psql".
  4. default: This user must also own the server process.
  5. default:
  6. default: The database cluster will be initialized with locale "en_US".
  7. default: initdb: encoding mismatch
  8. default: The encoding you selected (UTF8) and the encoding that the
  9. default: selected locale uses (LATIN1) do not match. This would lead to
  10. default: misbehavior in varIoUs character string processing functions.
  11. default: Rerun initdb and either do not specify an encoding explicitly,default: or choose a matching combination.
  12. default:
  13. default:
  14. default:
  15. default: ================================================================================
  16. default:
  17. default: Error executing action `run` on resource 'execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8]'
  18. default:
  19. default: ================================================================================
  20. default:
  21. default:
  22. default:
  23. default:
  24. default: Mixlib::ShellOut::ShellCommandFailed
  25. default:
  26. default: ------------------------------------
  27. default:
  28. default: Expected process to exit with [0],but received '1'
  29. default:
  30. default:
  31. default: ---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
  32. default:
  33. default:
  34. default: STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
  35. default:
  36. default:
  37. default: This user must also own the server process.
  38. default:
  39. default: The database cluster will be initialized with locale "en_US".
  40. default: STDERR: initdb: encoding mismatch
  41. default: The encoding you selected (UTF8) and the encoding that the
  42. default: selected locale uses (LATIN1) do not match. This would lead to
  43. default: misbehavior in varIoUs character string processing functions.
  44. default: Rerun initdb and either do not specify an encoding explicitly,default: or choose a matching combination.
  45. default: ---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
  46. default: Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
  47. default:
  48. default: Resource Declaration:
  49. default: ---------------------
  50. default: # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb
  51. default:
  52. default: 80: execute "/opt/gitlab/embedded/bin/initdb -D #{postgresql_data_dir} -E UTF8" do
  53. default: 81: user postgresql_username
  54. default: 82: not_if { pg_helper.bootstrapped? }
  55. default: 83: end
  56. default: 84:
  57. default:
  58. default: Compiled Resource:
  59. default: ------------------
  60. default: # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb:80:in `from_file'
  61. default:
  62. default: execute("/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8") do
  63. default: action [:run]
  64. default: default_guard_interpreter :execute
  65. default: command "/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8"
  66. default: backup 5
  67. default: returns 0
  68. default: user "gitlab-psql"
  69. default: declared_type :execute
  70. default: cookbook_name "postgresql"
  71. default: recipe_name "enable"
  72. default: domain nil
  73. default: not_if { #code block }
  74. default: end
  75. default:
  76. default: System Info:
  77. default: ------------
  78. default: chef_version=13.6.4
  79. default: platform=ubuntu
  80. default: platform_version=18.04
  81. default: ruby=ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]
  82. default: program_name=/opt/gitlab/embedded/bin/chef-client
  83. default: executable=/opt/gitlab/embedded/bin/chef-client
  84. default:
  85. default: Recipe: gitlab::gitlab-rails
  86. default:
  87. default: * execute[clear the gitlab-rails cache] action run
  88. default:
  89. default: - execute /opt/gitlab/bin/gitlab-rake cache:clear
  90. default:
  91. default:
  92. default: Recipe: gitlab::redis
  93. default: * ruby_block[restart redis svlogd configuration] action create
  94. default:
  95. default: - execute the ruby block restart redis svlogd configuration
  96. default: * ruby_block[reload redis svlogd configuration] action create
  97. default:
  98. default: - execute the ruby block reload redis svlogd configuration
  99. default:
  100. default:
  101. default:
  102. default: Running handlers:
  103. default: There was an error running gitlab-ctl reconfigure:
  104. default: execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] (postgresql::enable line 80) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0],but received '1'
  105. default: ---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
  106. default: STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
  107. default: This user must also own the server process.
  108. default:
  109. default: The database cluster will be initialized with locale "en_US".
  110. default: STDERR: initdb: encoding mismatch
  111. default: The encoding you selected (UTF8) and the encoding that the
  112. default: selected locale uses (LATIN1) do not match. This would lead to
  113. default: misbehavior in varIoUs character string processing functions.
  114. default: Rerun initdb and either do not specify an encoding explicitly,default: or choose a matching combination.
  115. default: ---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
  116. default: Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
  117. default: Running handlers complete
  118. default:
  119. default: Chef Client Failed. 141 resources updated in 01 minutes 00 seconds
  120. The SSH command responded with a non-zero exit status. Vagrant
  121. assumes that this means the command Failed. The output for this command
  122. should be in the log above. Please read the output to determine what
  123. went wrong.

已经尝试过,没有帮助:

  1. cat > /etc/default/locale <<EOF
  2. LC_ALL=en_US.UTF-8
  3. LANG=en_US.UTF-8
  4. LANGUAGE=en_US.UTF-8
  5. EOF
  6.  
  7. localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 || true
作为参考,尝试的解决方案似乎来自 this answer.

我不确定this question究竟是如何相关的,但它提供了一个对我有用的答案,即设置CTYPE变量的语言环境.在安装gitlab-ee之前运行以下代码对我有用:

update-locale LC_CTYPE = en_US.UTF-8 LANG = en_US.UTF-8 LANGUAGE = en_US.UTF-8 ALL = en_US.UTF-8

猜你在找的Postgre SQL相关文章