Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installing Gitlab newer than 10.5 fails with encoding error on clean install of Ubuntu 16.04 (but not 14.04) #318

Open
bobweston opened this issue Jul 26, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@bobweston
Copy link

bobweston commented Jul 26, 2019

I'm getting encoding errors when trying to spin up a clean install of any gitlab version newer than 10.5.8. Oddly, the problem seems to be restricted to Ubuntu 16.04. Everything just works with Ubuntu 14.04. (Versions prior to 10.6 work as expected on Ubuntu 16.04)

puppet 5.5.16
ruby 2.6.0
Ubuntu 16.04.2
version 2.1.0 of the module.

My expectation is that we can create a fresh VM with gitlab installed. But it's failing due to encoding errors when it attempts to run reconfigure.

STDERR: initdb: encoding mismatch
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     The encoding you selected (UTF8) and the encoding that the
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     selected locale uses (LATIN1) do not match.  This would lead to
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     misbehavior in various character string processing functions.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Rerun initdb and either do not specify an encoding explicitly,
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     or choose a matching combination.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Resource Declaration:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ---------------------
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      80: execute "/opt/gitlab/embedded/bin/initdb -D #{postgresql_data_dir} -E UTF8" do
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      81:   user postgresql_username
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      82:   not_if { pg_helper.bootstrapped? }
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      83: end
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      84:

More error detail below.

Here's our gitlab manifest:

class profile::gitlab {
  include ::gitlab

  # ##parameters set in hiera
  $gitlab_ssl_crt = 'puppet:///modules/profile/gitlab.xxxxxx.org.crt'
  $gitlab_ssl_key = 'puppet:///modules/profile/gitlab.xxxxxxx.org.key'


  $user = 'interact'
  exec{'create_git_user':
    command => '/usr/bin/sudo /usr/sbin/adduser git',
    user    => 'root',
    unless  => '/usr/sbin/adduser {user} || true',
  }

  file {'ssl_cert':
    path    => hiera('gitlabx::ssl_cert_path'),
    source  => $gitlab_ssl_crt,
    owner   => root,
    group   => root,
    mode    => '0600',
    replace => true,
  }
  file {'ssl_key':
    path    => hiera('gitlabx::ssl_key_path'),
    source  => $gitlab_ssl_key,
    owner   => root,
    group   => root,
    mode    => '0600',
    replace => true,
  }

  file { '/opt/nginx/conf/sites-available/gitlab-http.conf':
    mode   => '0664',
    owner  => 'interact',
    group  => 'interact',
    source => 'puppet:///modules/profile/servers/admin01/gitlab-http.conf',
  }

  file { '/opt/nginx/conf/sites-enabled/gitlab-http.conf':
    ensure  => 'link',
    owner   => 'interact',
    group   => 'interact',
    target  => '/opt/nginx/conf/sites-available/gitlab-http.conf',
    require => File['/opt/nginx/conf/sites-available/gitlab-http.conf'],
  }
}

Our gitlab hiera configs (bare bones, no runner detail)

# GITLAB SECTION BELOW    
lookup_options:
  gitlab::gitlab_rails:
    merge:
      strategy: deep
gitlab::external_url: 'https://gitlab.xx.org'
gitlab::letsencrypt:
  enable: false
gitlab::unicorn:
  port: 8890
gitlab::enabled_git_access_protocol: 'nil' #(allows both ssh and https)
gitlab::gitlab_rails:
  gitlab_username_changing_enabled: false
  gitlab_default_can_create_group: 'false'
  gitlab_default_projects_features_visibility_level: 'public'
  gitlab_email_from: '[email protected]'
  gitlab_email_reply_to: '[email protected]'
  backup_keep_time: '604800'
  ldap_enabled: true
  ldap_servers:
    myldapserver:
      label: 'LDAP'
      host: 'xxxx.xxx.org'
      port: 636
      uid: 'sAMAccountName'
      method: 'ssl' # "tls" or "ssl" or "plain"
      bind_dn: 'CN=svc.xxxxxx-gitlab,OU=Resource Accounts,OU=Active Directory,OU=IT Infrastructure,OU=Services,DC=xxxxx,DC=org'
      password: 'xxxxxxx'
      active_directory: true
      allow_username_or_email_login: true
      verify_certificates: false
      block_auto_created_users: false
      base: 'DC=xxxx,DC=org'
      # group_base: ''
      # user_filter: ''
gitlab::nginx:
  enable: true
gitlab::edition: 'ce'
gitlab::package_ensure: '10.8.6-ce.0'

the error:

   * execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] action run
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     [execute] The files belonging to this database system will be owned by user "gitlab-psql".
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:               This user must also own the server process.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:               The database cluster will be initialized with locale "en_US".
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:               initdb: encoding mismatch
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:               The encoding you selected (UTF8) and the encoding that the
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:               selected locale uses (LATIN1) do not match.  This would lead to
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:               misbehavior in various character string processing functions.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:               Rerun initdb and either do not specify an encoding explicitly,
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:               or choose a matching combination.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ================================================================================
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Error executing action `run` on resource 'execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8]'
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ================================================================================
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Mixlib::ShellOut::ShellCommandFailed
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ------------------------------------
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Expected process to exit with [0], but received '1'
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     This user must also own the server process.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     The database cluster will be initialized with locale "en_US".
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     STDERR: initdb: encoding mismatch
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     The encoding you selected (UTF8) and the encoding that the
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     selected locale uses (LATIN1) do not match.  This would lead to
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     misbehavior in various character string processing functions.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Rerun initdb and either do not specify an encoding explicitly,
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     or choose a matching combination.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Resource Declaration:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ---------------------
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      80: execute "/opt/gitlab/embedded/bin/initdb -D #{postgresql_data_dir} -E UTF8" do
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      81:   user postgresql_username
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      82:   not_if { pg_helper.bootstrapped? }
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      83: end
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:      84:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     Compiled Resource:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ------------------
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb:80:in `from_file'
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     execute("/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8") do
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       action [:run]
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       default_guard_interpreter :execute
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       command "/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8"
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       backup 5
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       returns 0
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       user "gitlab-psql"
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       declared_type :execute
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       cookbook_name "postgresql"
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       recipe_name "enable"
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       domain nil
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:       not_if { #code block }
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     end
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     System Info:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ------------
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     chef_version=13.6.4
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     platform=ubuntu
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     platform_version=16.04
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     ruby=ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     program_name=/opt/gitlab/embedded/bin/chef-client
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:     executable=/opt/gitlab/embedded/bin/chef-client
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: Running handlers:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: There was an error running gitlab-ctl reconfigure:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: 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'
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: ---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: This user must also own the server process.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: The database cluster will be initialized with locale "en_US".
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: STDERR: initdb: encoding mismatch
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: The encoding you selected (UTF8) and the encoding that the
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: selected locale uses (LATIN1) do not match.  This would lead to
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: misbehavior in various character string processing functions.
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: Rerun initdb and either do not specify an encoding explicitly,
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: or choose a matching combination.
==> admin01:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: ---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns:
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: Running handlers complete
==> admin01: Notice: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]/returns: Chef Client failed. 3 resources updated in 06 seconds
==> admin01: Error: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]: Failed to call refresh: '/usr/bin/gitlab-ctl reconfigure' returned 1 instead of one of [0]
==> admin01: Error: /Stage[main]/Gitlab::Config/Exec[gitlab_reconfigure]: '/usr/bin/gitlab-ctl reconfigure' returned 1 instead of one of [0]
==> admin01: Info: Class[Gitlab::Config]: Unscheduling all events on Class[Gitlab::Config]
==> admin01: Notice: /Stage[main]/Gitlab::Service/Service[gitlab-runsvdir]: Dependency Exec[gitlab_reconfigure] has failures: true

As noted, this failure only happens with Ubuntu 16.04. 14.04 works as expected.

I can upgrade a 14.04 VM to Ubuntu 16.4 and then upgrade gitlab to a version greater than 10.5. But attempting to do so with a clean install of Ubuntu 16.04 fails.

I've tried using file_line resources to set the environmental variable. But it is still failing. Below you can see a sample of directives I've tried. (all without success).

file_line { "lc_all_env_var":
    ensure  => present,
    line    => 'LC_ALL="en_US.UTF-8"',
    path    => "/etc/default/locale",
  }

  file_line { "lc_type_env_var":
    ensure  => present,
    line    => 'LC_TYPE="en_US.UTF-8"',
    path    => "/etc/default/locale",
  }


   file_line { "lang_env_var":
     ensure  => present,
     line    => 'LANG="en_US.UTF-8"', #behavior differs from ubuntu 14.04
     path   => "/etc/default/locale",
   }
  
   file_line { "language_env_var":
     ensure  => present,
     line    => 'LANGUAGE="en_US"',
     path   => "/etc/default/locale",
   }

One thing I noticed though is that if I ran echo $LANG in ubuntu 14.04, the result was what I expected: en_US.UTF-8

If I ran the same command in ubuntu 16.04, I got the following:

en_US

I really appreciate it if someone could help point me in the right direction.

Of note, I found the following issue over on the gitlab-ce site. It isn't exactly the same error. But it's curious that it's recent and involves similar encoding issues with gitlab 10.6 on Ubuntu 16.04.

https://gitlab.com/gitlab-org/gitlab-ce/issues/44869

Here's another similar issue

https://forum.gitlab.com/t/install-on-fresh-ubuntu-16-04-fails/15652

@bobweston bobweston changed the title installing Gitlab gt 10.5 fails with encoding error on Ubuntu 16.04 (but not 14.04) installing Gitlab 10.6, 10.7, 10.8 fails with encoding error on Ubuntu 16.04 (but not 14.04) Jul 27, 2019
@bobweston bobweston changed the title installing Gitlab 10.6, 10.7, 10.8 fails with encoding error on Ubuntu 16.04 (but not 14.04) installing Gitlab newer than 10.6 fails with encoding error on clean install of Ubuntu 16.04 (but not 14.04) Jul 29, 2019
@bobweston bobweston changed the title installing Gitlab newer than 10.6 fails with encoding error on clean install of Ubuntu 16.04 (but not 14.04) installing Gitlab newer than 10.5 fails with encoding error on clean install of Ubuntu 16.04 (but not 14.04) Jul 29, 2019
@juniorsysadmin juniorsysadmin added the bug Something isn't working label Aug 3, 2019
@LongLiveCHIEF
Copy link
Contributor

related #215 #297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants