Fix locales on Ubuntu
The new Ubuntu base image we use does not ship with any locales
or locale configuration. A fix[1] attempted to remedy this by
copying the default locale configuration from the host, but it
is not a valid fix since the locale from the host is not present
or generated in the container cache. This causes things to break
on the system when valid locales are used, such as database
systems[2].
Instead, to prepare locales in Ubuntu[3], we should install the
locales package and provide a list of valid locales to prep
the base image. It is not necessary to copy /etc/default/locale
from the system. The first locale provided will be used as
the system's base locale by running 'update-locale' which
builds /etc/default/locale.
[1] e62de979cb
[2] http://paste.openstack.org/show/719241/
[3] https://www.thomas-krenn.com/en/wiki/Configure_Locales_in_Ubuntu#No_locale_set
Change-Id: Iaa5351777d7db464e8a897fdf33c0f440bfa601b
This commit is contained in:
parent
1871fbec7b
commit
9ad190a7c8
@ -218,6 +218,10 @@ lxc_cache_download_template_options: >-
|
||||
--variant {{ lxc_cache_default_variant }}
|
||||
{{ lxc_cache_download_template_extra_options }}
|
||||
|
||||
# Locales to populate in the LXC base cache
|
||||
lxc_cache_locales:
|
||||
- en_US.UTF-8
|
||||
|
||||
# LXC must be installed from a COPR repository on CentOS 7 since the version
|
||||
# provided in EPEL is much too old (1.x).
|
||||
lxc_centos_package_baseurl: https://copr-be.cloud.fedoraproject.org/results/thm/lxc2.0/epel-7-x86_64/
|
||||
|
@ -35,6 +35,13 @@ for action in disable mask; do
|
||||
systemctl ${action} systemd-networkd-resolvconf-update.service || true
|
||||
done
|
||||
|
||||
{% for locale in lxc_cache_locales %}
|
||||
locale-gen {{ locale }}
|
||||
{% if loop.first | bool %}
|
||||
update-locale LANG={{ locale }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
# Set the IP of the lxcbr0 interface as the DNS server
|
||||
echo "nameserver {{ lxc_net_address }}" > /etc/resolv.conf
|
||||
systemctl enable systemd-networkd
|
||||
|
@ -23,10 +23,8 @@ _lxc_cache_map:
|
||||
- /etc/apt/sources.list
|
||||
- /etc/apt/apt.conf.d/
|
||||
- /etc/apt/preferences.d/
|
||||
- /etc/default/locale
|
||||
- /etc/environment
|
||||
- /etc/localtime
|
||||
- /etc/locale.conf
|
||||
- /root/repo.keys
|
||||
- /etc/protocols
|
||||
|
||||
@ -37,11 +35,13 @@ _lxc_cache_distro_packages:
|
||||
- ca-certificates
|
||||
- cron # xenial doesn't have cronie
|
||||
- dbus
|
||||
- debianutils # for 'which' executable
|
||||
- gcc
|
||||
- iproute2
|
||||
- iputils-ping
|
||||
- libffi-dev
|
||||
- libssl-dev
|
||||
- locales
|
||||
- netbase
|
||||
- openssh-server
|
||||
- openssl
|
||||
@ -54,4 +54,3 @@ _lxc_cache_distro_packages:
|
||||
- systemd-sysv
|
||||
- tar
|
||||
- wget
|
||||
- debianutils # for 'which' executable
|
||||
|
Loading…
Reference in New Issue
Block a user