Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 636658 - Broken locales in sys-libs/glibc-2.25
Summary: Broken locales in sys-libs/glibc-2.25
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-05 19:53 UTC by Oleg
Modified: 2018-04-04 17:41 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Logs after reboot before locale-gen (log.before.tar.gz,1.33 KB, application/octet-stream)
2017-11-07 17:43 UTC, Oleg
Details
logs after locale-gen (log.after.tar.gz,2.75 KB, application/octet-stream)
2017-11-07 17:44 UTC, Oleg
Details
emerge --info (emerge-info.txt,6.37 KB, text/plain)
2017-11-23 21:16 UTC, Sergey Morozov
Details
rc.log (rc.log,76.01 KB, text/x-log)
2017-11-24 05:59 UTC, Sergey Morozov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg 2017-11-05 19:53:40 UTC
When updated to sys-libs/glibs-2.25-r8 I encountered next error:
After reboot I lose selected locale (all program runs with C locale). When I run `eselect locale list` I get

```
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_COLLATE to default locale: No such file or directory
Available targets for the LANG variable:
  [1]   C
  [2]   POSIX
  [3]   en_US.utf8
  [4]   ru_RU.koi8r
  [5]   ru_RU.utf8 *
  [ ]   (free form)
```
After I run `locale-gen` it fixes:
```
Available targets for the LANG variable:
  [1]   C
  [2]   en_US
  [3]   en_US.iso88591
  [4]   en_US.utf8
  [5]   ja_JP.eucjp
  [6]   ja_JP.utf8
  [7]   POSIX
  [8]   ru_RU.cp1251
  [9]   ru_RU.koi8r
  [10]  ru_RU.utf8 *
  [ ]   (free form)
```
But next reboot breaks it.

Content of `/etc/locale.gen`:
```
# /etc/locale.gen: list all of the locales you want to have on your system.
# See the locale.gen(5) man page for more details.
#
# The format of each line:
# <locale name> <charset>
#
# Where <locale name> starts with a name as found in /usr/share/i18n/locales/.
# It must be unique in the file as it is used as the key to locale variables.
# For non-default encodings, the <charset> is typically appended.
#
# Where <charset> is a charset located in /usr/share/i18n/charmaps/ (sans any
# suffix like ".gz").
#
# All blank lines and lines starting with # are ignored.
#
# For the default list of supported combinations, see the file:
# /usr/share/i18n/SUPPORTED
#
# Whenever glibc is emerged, the locales listed here will be automatically
# rebuilt for you.  After updating this file, you can simply run `locale-gen`
# yourself instead of re-emerging glibc.

ru_RU.utf8 UTF-8
ru_RU.CP1251 CP1251
ru_RU.KOI8-R KOI8-R
#en_US ISO-8859-1
en_US.utf8 UTF-8
en_US ISO-8859-1
ja_JP.EUC-JP EUC-JP
ja_JP.utf8 UTF-8
#ja_JP.SHIFT_JIS SHIFT_JIS
#ja_JP EUC-JP
#en_HK ISO-8859-1
#en_PH ISO-8859-1
#de_DE ISO-8859-1
#de_DE@euro ISO-8859-15
#es_MX ISO-8859-1
#fa_IR UTF-8
#fr_FR ISO-8859-1
#fr_FR@euro ISO-8859-15
#it_IT ISO-8859-1
```
Comment 1 Oleg 2017-11-05 19:55:20 UTC
Portage 2.3.8 (python 2.7.14-final-0, default/linux/amd64/13.0/desktop, gcc-5.4.0, glibc-2.25-r9, 4.12.12-gentoo x86_64)
=================================================================
System uname: Linux-4.12.12-gentoo-x86_64-Intel-R-_Core-TM-_i7-6700K_CPU_@_4.00GHz-with-gentoo-2.4.1
KiB Mem:    24644844 total,   1984440 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sun, 05 Nov 2017 10:30:01 +0000
Head commit of repository gentoo: d35edc8b07c6df6642c824ec1e209d73ce022baf
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.28.1 p1.0) 2.28.1
app-shells/bash:          4.3_p48-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.3::gentoo
dev-lang/python:          2.7.14::gentoo, 3.4.5::gentoo, 3.5.4::gentoo
dev-util/cmake:           3.8.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.32.1::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.28.1::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r9::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

x-my
    location: /usr/local/portage/my
    masters: gentoo
    priority: 0

booboo
    location: /usr/local/portage/layman/booboo
    sync-type: laymansync
    sync-uri: git://github.com/l29ah/booboo.git
    masters: gentoo
    priority: 50

gamerlay
    location: /usr/local/portage/layman/gamerlay
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/gamerlay.git
    masters: gentoo
    priority: 50

nektoo
    location: /usr/local/portage/layman/nektoo
    sync-type: laymansync
    sync-uri: https://bitbucket.org/neko259/nektoo
    masters: gentoo
    priority: 50

rion
    location: /usr/local/portage/layman/rion
    sync-type: laymansync
    sync-uri: https://github.com/rion-overlay/rion-overlay.git
    masters: gentoo
    priority: 50

rust
    location: /usr/local/portage/layman/rust
    sync-type: laymansync
    sync-uri: git://github.com/gentoo/gentoo-rust.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 PUEL AdobeFlash-10 AdobeFlash-10.1 skype-eula Oracle-BCLA-JavaSE AdobeFlash-10.3 skype-4.0.0.7-copyright AdobeFlash-11.x NVIDIA-CUDA OPERA-12 RAR"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"
DISTDIR="/mnt/devel/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildsyspkg collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-O1"
MAKEOPTS="-j7"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/tmp"
USE="10bit 12bit X Xaw3d a52 aac aacplus aacs aalib abiword acl acpi alsa amd64 amr animgif anthy archive ass audiofile bash-completion bdplus bidi bluetooth bluray branding bzip2 c++0x c++11 cairo canna caps cdda cdr cg chasen cjk cli consolekit cracklib crypt css cuda cups curl cxx cyrillic dbus dga dia djvu dri dts dv dvd dvdr dvdread egl emboss enca encode evdev exif expat faac faad fam ffmpeg fftw firefox flac fontconfig fontforge fortran freewnn fribidi ftp fuse gallium gd gdbm ggi gif gimp ginac git gl3plus glade glamor gles gles1 gles2 gles3 glut gmp gnome-keyring gnuplot gpg gphoto2 gpm graphviz gs gsf gsm gtk gtk3 gzip hddtemp hdf5 hwaccel iconv id3 id3tag idn ieee1394 imagemagick imap imlib inotify ipv6 irc irda jabber jadetex java7 java8 jbig jingle joystick jpeg jpeg2k kate lame latex lcdfilter lcms libass libcanberra libmpd libnotify librtmp libsecret libv4l libv4l2 libwww lm_sensors lz4 lzma lzo m17n-lib mad math mathml matroska mbrola mercurial midi migemo mime mmap mmx mmxext mng modules mozilla mp3 mp4 mpd mpeg mplayer mpris mule multilib musepack musicbrainz natspec ncurses nls nntp nocd nptl nptlonly nsplugin nspluginwrapper ntfs nvidia odf ofx ogg openal opencl opencv openexr opengl opengl3 openmp openxml opus pango pch pcre pdf pgf pgo png policykit posix postscript ppds qrcode qt3support quicktime rar raw readline rle romio rss rtc rtmp scanner schroedinger scripts sctp sdl seccomp sensord session sharedmem shorten sip skk slang smp sndfile sockets socks5 sourceview sox speex spell sqlite sse sse2 sse3 ssl ssse3 startup-notification subversion svg syslog system-sqlite szip taglib tcpd teletext theora threads thunar tiff timidity truetype udev udf udisks unicode upower usb v4l v4l2 vaapi vcd vdpau videos vim vim-syntax vorbis vpx vulkan webgl webkit webp wma wmf x264 x265 xa xattr xcb xetex xfce xfce4 xft xhtml xinerama xml xosd xpm xscreensaver xulrunner xv xvid xvmc zip zlib zvbi" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias proxy proxy_http" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="canon ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse evdev joystick libinput" KERNEL="linux" L10N="ru ru_RU en en_US ja ja_JP eo uk uk_UA yi" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer pdfimport" LINGUAS="ru ru_RU en en_US ja ja_JP eo uk uk_UA yi" LLVM_TARGETS="X86 Mips NVPTX RISCV BPF" NETBEANS_MODULES="apisupport java profiler websvccommon" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python3_4 python3_5" QEMU_SOFTMMU_TARGETS="i386 x86_64 or32 mips mips64 mips64el mipsel or1k" QEMU_USER_TARGETS="i386 x86_64 or32 mips mips64 mips64el mipsel mipsn32 mipsn32el or1k" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="nvidia vesa intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Oleg 2017-11-05 19:56:07 UTC
Both sys-libs/glibc-2.25-r8 and sys-libs/glibc-2.25-r9 affected.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-05 23:14:19 UTC
It's a bit strange you see changes after reboot. I have only vague guesses why
reboot is special. Do you have anything unusual in your setup?
Like separate /usr/ partition or userspace-assisted boot to deal with /home/ mounts?

Some generic things to try (and get the idea where locales fail to populate for you):

Can you post output of the following command right after reboot:
- strace -f -o/tmp/log date (attach both the date output and /tmp/log output)
- echo $LANG
- locale
- locale -a

And then the same commands after locale-gen. So we could diff the result.
Comment 4 Oleg 2017-11-07 17:43:24 UTC
Created attachment 502942 [details]
Logs after reboot before locale-gen
Comment 5 Oleg 2017-11-07 17:44:43 UTC
Created attachment 502944 [details]
logs after locale-gen
Comment 6 Oleg 2017-11-07 17:46:40 UTC
I don't use separate /usr and it happened even for root so it isn't /home issue too.
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-07 20:32:34 UTC
Interesting!

Looking at the 'strace' and 'locale -a' outputs
my guess is the following file
    /usr/lib64/locale/locale-archive
has different content after each reboot. That's unexpected.

Can you verify that the file changes after reboot?
If it does the next step will be to find what changes that file.

For me
    $ sha1sum /usr/lib64/locale/locale-archive
stays the same after each 'locale-gen' run.
Comment 8 Oleg 2017-11-12 18:19:07 UTC
Yep, I gets:

0aabbb59cf38131b7d7b6e9f9441dde2e42e33bd  after reboot
6ac977b958ffddd7b5b88538e3907cb71579f09a  after first locale-gen (there it becomes correct)
01c288da64bb52bfdda249c586d9987d0dd73328  after second and so on locale-gen and before reboot (it still correct)
Comment 9 Sergey Morozov 2017-11-23 19:47:44 UTC
Same problem.
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-23 20:12:25 UTC
Can you find out what keeps overwriting the
    /usr/lib64/locale/locale-archive
on your system?
Comment 11 Sergey Morozov 2017-11-23 20:16:51 UTC
/usr/lib64/locale/locale-archive changes after every reboot, but attributes such ctime are not changing. If it is important, / is located on the LVM, which is located on the RAID-1 (using mdadm).
Comment 12 Sergey Morozov 2017-11-23 20:18:10 UTC
(In reply to Sergei Trofimovich from comment #10)
> Can you find out what keeps overwriting the
>     /usr/lib64/locale/locale-archive
> on your system?

I don't known how to do it.
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-23 20:37:19 UTC
> I don't known how to do it.

Can you provide 'emerge --info'?

It looks like people occasionally have this problem but nobody got to the bottom of it:
    https://bugs.gentoo.org/275039
Comment 14 Oleg 2017-11-23 20:52:34 UTC
I tried to remove write permissions on `/usr/lib64/locale/locale-archive` and parent folder but it didn't help.
Comment 15 Sergey Morozov 2017-11-23 21:16:19 UTC
Created attachment 506228 [details]
emerge --info
Comment 16 Oleg 2017-11-23 22:10:41 UTC
I've just checked from liveUSB and it looks like `local-archive` breaks on shutdown.
Comment 17 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-23 22:44:29 UTC
If you are using openrc in /etc/rc.conf you can enable
    rc_logger="YES"
and check /var/log/rc.log after reboot. If it's done by
one of the services it might output typical locale-gen
output and give out what process does it.

That culd give you a list of services to disable one by one
and check it they alter locale-archive.

Another shot would be to enable audit subsystem in kernel
and setup audit daemon to track write access to locale-archive.

Example audit config for /etc/ files:
    http://xmodulo.com/how-to-monitor-file-access-on-linux.html

The trick is to keep auditd running long enough at system shutdown.
Comment 18 Sergey Morozov 2017-11-24 05:59:51 UTC
Created attachment 506250 [details]
rc.log
Comment 19 Sergey Morozov 2017-11-26 10:41:18 UTC
Looks like this is not a glibc problem. First, I tried to update glibc to 2.26-r3, but problem is remained. Then I tried to use audit to determine who writing to /usr/lib64/locale/locale-archive, but unsuccessfully. Nobody writes there, at least while the auditd is launched.

But, I found a workaround.
Solution:
1. Generate locale-archive (locale-gen)
2. Create a copy of locale-archive file (cp /usr/lib64/locale/locale-archive /root)
3. Boot system from live CD (SystemResqueCD for example)
4. Mount /
5. Replace /usr/lib64/locale/locale-archive by a created copy (cp /mnt/gentoo/root/locale-archive /mnt/gentoo/usr/lib64/locale/locale-archive)
6. Reboot to system

Maybe the cause of the problem is mdadm with lvm?
Comment 20 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-26 19:23:30 UTC
Yeah, it sounds very much like underlying block layer confusion
which is very scary. It means there is already data loss happening.
Comment 21 Oleg 2017-11-26 19:35:51 UTC
I don't use lvm and it is too stable to be a data corruption.
Comment 22 Sergey Morozov 2017-11-26 20:01:21 UTC
(In reply to Oleg from comment #21)
> I don't use lvm and it is too stable to be a data corruption.

Do you use mdadm?
Comment 23 Oleg 2017-11-26 20:08:31 UTC
> Do you use mdadm?

No
Comment 24 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-26 22:46:22 UTC
(In reply to Sergey Morozov from comment #18)
> Created attachment 506250 [details]
> rc.log

Don't see anything suspicious there :(
Comment 25 Oleg 2018-04-04 17:41:24 UTC
It was fixed in sys-libs/glibc-2.25-r11 .