From b7458213534967d107fe8d508f14ba7ecd6401e0 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 15 Jul 2016 03:24:32 +0000 Subject: [PATCH] yum-minimal: set locale.conf and tz in chroot We should be doing more to ensure initial configuration during configuration. Taken from the steps done by [1], here we set locale.conf and a general timezone. The only reliable UTF8 locale is en_US.UTF-8; we don't want to use C locale as it causes havoc with things like python3 and unicode. We set locale.conf to this. For Fedora 24 ensure we install the en_* locales too (this is really a bug separate to this -- when you log in, by default ssh tries to copy over your locale env variables, so logging into a F24 system would result in using invalid locales for the most common en_* cases). While we are here, setup a timezone link. It turns out infra puppet overwrites this later, but at least we have a sane default. [1] https://www.freedesktop.org/software/systemd/man/systemd-firstboot.html# Change-Id: Ib8951a97f1772bc5228c682e88628ff53400a923 --- elements/yum-minimal/root.d/08-yum-chroot | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/elements/yum-minimal/root.d/08-yum-chroot b/elements/yum-minimal/root.d/08-yum-chroot index e887f7249..074bb331d 100755 --- a/elements/yum-minimal/root.d/08-yum-chroot +++ b/elements/yum-minimal/root.d/08-yum-chroot @@ -151,8 +151,8 @@ function _install_pkg_manager { # uses to get the minimal-langpack and chooses a # random(ish) one that satisfies the locale dependency # (rhbz#1349258). Work-around this by explicitly requring - # the minimal pack. - _lang_pack="glibc-minimal-langpack" + # the minimal and english (for en_US.UTF-8) pack. + _lang_pack="glibc-minimal-langpack glibc-langpack-en" fi sudo -E yum -y \ @@ -241,6 +241,13 @@ else echo -e "# This file intentionally left blank\n" | \ sudo tee $TARGET_ROOT/etc/resolv.conf + # set the most reliable UTF-8 locale + echo -e 'LANG="en_US.UTF-8"' | \ + sudo tee $TARGET_ROOT/etc/locale.conf + # default to UTC + sudo -E chroot $TARGET_ROOT ln -sf /usr/share/zoneinfo/UTC \ + /etc/localtime + # cleanup # TODO : move this into a exit trap; and reconsider how # this integrates with the global exit cleanup path.