3

I had previously asked the question, How do I reduce the size of locale-archive?, and got a great answer to my question, but when I execute build-locale-archive I get disconnected from my RHEL6 host. How can I prevent this?

Update:

I decided to run ...

# strace -f -o /tmp/output build-locale-archive

... and here's the only interesting output ...

17779 truncate("/usr/lib/locale/locale-archive.tmpl", 0) = 0
17779 execve("/usr/sbin/tzdata-update", ["/usr/sbin/tzdata-update"], [/* 0 vars */]) = 0
17779 open("/etc/sysconfig/clock", O_RDONLY) = 3
17779 read(3, "ZONE=\"Africa/Abidjan\"\nUTC=true\n", 32767) = 31
17779 read(3, "", 32736)                = 0
17779 close(3)                          = 0
17779 open("/usr/share/zoneinfo/Africa/Abidjan", O_RDONLY) = 3
17779 read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\2\0\0\0\0"..., 32768) = 156
17779 read(3, "", 32612)                = 0
17779 close(3)                          = 0
17779 open("/etc/localtime", O_RDONLY)  = 3
17779 read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0\2\0\0\0\0"..., 32768) = 156
17779 read(3, "", 32612)                = 0
17779 close(3)                          = 0
17779 open("/var/spool/postfix/etc/localtime", O_RDONLY) = -1 ENOENT (No such file or directory)
17779 _exit(0)                          = ?

... not sure what to make of that.

Also it looks like snmpd and crond died when I ran build-locale-archive.

Update II:

Thanks for the answer Gilles, but it looks like I may not be following your suggestion correctly as I still loss my connection when I execute:

[root@dev-007 ~]# sysctl vm.overcommit_memory=2
vm.overcommit_memory = 2
[root@dev-007 ~]# (ulimit -v 100000; build-locale-archive)
build-locale-archive: cannot read archive header
[root@dev-007 ~]# cd /usr/lib/locale/
[root@dev-007 locale]# mv locale-archive locale-archive.tmpl
[root@dev-007 locale]# (ulimit -v 100000; build-locale-archive)
Connection to dev-007 closed.

Did I follow your instructions correctly? If not please let me know what I did wrong.

Update III

Sorry I has taken me so long to get back to you all.

Here's my swap info:

[root@dev-007 ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda3                               partition       10178552        0       -1
[root@dev-007 ~]# df /dev/sda3 
Filesystem           1K-blocks      Used Available Use% Mounted on
-                       952296       184    952112   1% /dev
3
  • 1
    I meant to look into this sooner for you but I couldn't reproduce it on my machine. I did find this bbs.archlinux.org/viewtopic.php?id=97520 possibly related link which suggests that the locale-gen on Arch can use a lot of RAM. – Joel Taylor Sep 11 '13 at 16:57
  • Works for me (not with build-locale-archive, but with a toy program that allocates a lot of memory). Is there anything in the kernel logs (the OOM killer does leave a log entry)? What does strace -f -o limited.strace -e bash -c 'ulimit -v 100000; build-locale-archive' show? – Gilles 'SO- stop being evil' Sep 12 '13 at 16:31
  • @RedCricket do you have a swap on your machine? – Joel Taylor Sep 12 '13 at 18:04
3

Given that unrelated processes such as snmpd and crond are dying, and given Joel Taylor's observation that locale-gen may use a lot of memory, you're a victim of the OOM killer.

To avoid OOM kills, set the overcommit policy to disable overcommitting: sysctl vm.overcommit_memory=2

Even if you disable overcommitting, it would be better to confine the damage to locale-gen by limiting how much memory it can allocate.

(ulimit -v 100000; build-locale-archive)
1
  • Thank for the answer Gilles, but I couldn't get it to work. Please see my updated question. – Red Cricket Sep 12 '13 at 15:25
0

The problem is the truncation of the locale file. Check: http://bleachbit.sourceforge.net/forum/linux-fedora-core-15-usrliblocalelocale-archive-still-large-after-removing-all-one-locale

So, if you just copy the locale file over the template file and run build-locale-archive, everything works:

cp -f /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl build-locale-archive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.