首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行gitlab-ctl重新配置时"initdb:编码不匹配“

运行gitlab-ctl重新配置时"initdb:编码不匹配“
EN

Stack Overflow用户
提问于 2018-06-14 13:03:42
回答 2查看 1.7K关注 0票数 9

我正在安装Gitlab-ce Omnibus在一个真空盒(Debian18.04LTS)。在我的配置脚本中,我运行gitlab-ctl reconfigure。我收到一个错误:

initdb:编码不匹配

控制台输出:

代码语言:javascript
复制
default: * execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] action run
default: 
default:     [execute] The files belonging to this database system will be owned by user "gitlab-psql".
default:               This user must also own the server process.
default:               
default:               The database cluster will be initialized with locale "en_US".
default:               initdb: encoding mismatch
default:               The encoding you selected (UTF8) and the encoding that the
default:               selected locale uses (LATIN1) do not match.  This would lead to
default:               misbehavior in various character string processing functions.
default:               Rerun initdb and either do not specify an encoding explicitly,
default:               or choose a matching combination.
default:     
default: 
default:     
default: ================================================================================
default:     
default: Error executing action `run` on resource 'execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8]'
default:     
default: ================================================================================
default:     
default: 
default: 
default:     
default: Mixlib::ShellOut::ShellCommandFailed
default:     
default: ------------------------------------
default:     
default: Expected process to exit with [0], but received '1'
default: 
default:     
default: ---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
default: 
default:     
default: STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
default: 
default:     
default: This user must also own the server process.
default:     
default:     The database cluster will be initialized with locale "en_US".
default:     STDERR: initdb: encoding mismatch
default:     The encoding you selected (UTF8) and the encoding that the
default:     selected locale uses (LATIN1) do not match.  This would lead to
default:     misbehavior in various character string processing functions.
default:     Rerun initdb and either do not specify an encoding explicitly,
default:     or choose a matching combination.
default:     ---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
default:     Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
default:     
default:     Resource Declaration:
default:     ---------------------
default:     # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb
default:     
default:      80: execute "/opt/gitlab/embedded/bin/initdb -D #{postgresql_data_dir} -E UTF8" do
default:      81:   user postgresql_username
default:      82:   not_if { pg_helper.bootstrapped? }
default:      83: end
default:      84: 
default:     
default:     Compiled Resource:
default:     ------------------
default:     # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb:80:in `from_file'
default:     
default:     execute("/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8") do
default:       action [:run]
default:       default_guard_interpreter :execute
default:       command "/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8"
default:       backup 5
default:       returns 0
default:       user "gitlab-psql"
default:       declared_type :execute
default:       cookbook_name "postgresql"
default:       recipe_name "enable"
default:       domain nil
default:       not_if { #code block }
default:     end
default:     
default:     System Info:
default:     ------------
default:     chef_version=13.6.4
default:     platform=ubuntu
default:     platform_version=18.04
default:     ruby=ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]
default:     program_name=/opt/gitlab/embedded/bin/chef-client
default:     executable=/opt/gitlab/embedded/bin/chef-client
default:     
default: Recipe: gitlab::gitlab-rails
default:   
default: * execute[clear the gitlab-rails cache] action run
default: 
default:     - execute /opt/gitlab/bin/gitlab-rake cache:clear
default: 
default: 
default: Recipe: gitlab::redis
default:   * ruby_block[restart redis svlogd configuration] action create
default: 
default:     - execute the ruby block restart redis svlogd configuration
default:   * ruby_block[reload redis svlogd configuration] action create
default:     
default: - execute the ruby block reload redis svlogd configuration
default: 
default: 
default: 
default: Running handlers:
default: There was an error running gitlab-ctl reconfigure:
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'
default: ---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
default: STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
default: This user must also own the server process.
default: 
default: The database cluster will be initialized with locale "en_US".
default: STDERR: initdb: encoding mismatch
default: The encoding you selected (UTF8) and the encoding that the
default: selected locale uses (LATIN1) do not match.  This would lead to
default: misbehavior in various character string processing functions.
default: Rerun initdb and either do not specify an encoding explicitly,
default: or choose a matching combination.
default: ---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
default: Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
default: Running handlers complete
default: 
default: Chef Client failed. 141 resources updated in 01 minutes 00 seconds
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

已经试过了,但没有帮助:

代码语言:javascript
复制
cat > /etc/default/locale <<EOF
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
EOF

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 || true
EN

回答 2

Stack Overflow用户

发布于 2019-03-06 11:51:04

我遇到了同样的问题,我就这样解决了,希望我能帮到你。

代码语言:javascript
复制
-bash-4.1# export LANG=en_US.UTF-8
票数 2
EN

Stack Overflow用户

发布于 2018-10-04 06:10:09

作为参考,尝试的解决方案似乎来自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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50858251

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档