Removing unused locale once and for all

Hello, I want to clean the many locales holding only one en_US.UTF-8 but i’m not entirely sure how to start it out. Removing glibc-locale looks clean but, i’m not sure if this is correct or solves it?

$ sudo zypper rm glibc-locale
[sudo] password for root: 
Reading installed packages...
Resolving package dependencies...

The following package is going to be REMOVED:
  glibc-locale

1 package to remove.

Package install size change:
              |         0 B    required by packages that will be installed
  -223.4 MiB  |  -  223.4 MiB  released by packages that will be removed

Backend:  classic_rpmtrans
Continue? [y/n/v/...? shows all options] (y):
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
$

locale -a -v
List

That is a list of available locales. As you can see they are not active, that is en_US.UTF-8. AFAIK removing glibclocale is going to seriously bork your system and leave you with no locale at all.

4 Likes

I agree with @knurpht. To avoid any future headaches, please don’t remove glibc-locale.

Why do you want to remove all locales except for en_US.UTF-8? To free up disk space? If that is your goal, it would be better to remove the language packs installed by zypper as recommended packages.

Discussion on how best to do that can be found in this older thread.

2 Likes

Missed the edit window, but if you must remove glibc-locale, make sure you at least have glibc-locale-base installed.

2 Likes

Hello! Thanks for writing knurpht, ikanotheokara. They are not active but present, as soon as i install or update certain package, they are accompanied by a lang-*, which i see as redundant not because of space constraints they don’t take up much space.

/usr/lib/locale
226.7 MiB (237,753,719)
2,841 files, 1,016 sub-folders

But, they’re unnecessary for my use. Just wanted to leave only those two

$ zypper locales
Code  | Language                | Requested
------+-------------------------+----------
en    | English                 | Fallback
en_US | English (United States) | Requested
$

When i first installed my Tumbleweed, i didn’t wanted glibc-locale to be installed at first so i chosed glibc-locale-base as minimal instead. However, the latter took it glibc-locale as dependencie.

Now, i see that i can remove it without taking anything with it according to zypper, but I don’t know the consequences afterwards? You say i shouldn’t, that’s why i’m hesitant, if you recommend that i shouldn’t remove it, I’ll leave it.

The link above is it interesting, more or less what i am asking for, i am reading it. Nevertheless, I will stick to my topic and your suggestions here.

I don’t know if it is relevant, but could you check the output of zypper locales to see what locales are being requested by zypper?

@x0r:

Please take a look at the contents of the package “glibc-locale-base”.

  • If, that’s all that you need then –
 > rpm --query --whatrequires glibc-locale
mutt-2.3.2-1.3.x86_64
libguile-3_0-1-3.0.9-3.5.x86_64
patterns-base-x11_enhanced-20241218-34.1.x86_64
 > rpm --query --whatsuggests glibc-locale
man-2.13.1-7.3.x86_64
 > rpm --query --whatrecommends glibc-locale
patterns-base-enhanced_base-20241218-34.1.x86_64
 >
  • You could remove the “glibc-locale” package and, lock it.

But, please be aware that, the dependencies mentioned above will affect the output of “zypper verify”.

1 Like

@ikanotheokara posted above zypper locales output.

@dcurtisfra Thanks, I have no outputs from below commands on both user/root.

$ rpm --query --whatrequires glibc-locale
no package requires glibc-locale
$ sudo rpm --query --whatrequires glibc-locale
[sudo] password for root: 
no package requires glibc-locale
$
$ rpm --query --whatsuggests glibc-locale
no package suggests glibc-locale
$ sudo rpm --query --whatsuggests glibc-locale
no package suggests glibc-locale
$
 $ rpm --query --whatrecommends glibc-locale
no package recommends glibc-locale
$ sudo rpm --query --whatrecommends glibc-locale
no package recommends glibc-locale
$

Sorry. I missed that!

As long as you have glibc-locale-base, don’t mind character encoding weirdness with legacy character sets and (possibly? probably unlikely) build issues with packages expecting non-English locales, you should be fine to remove and lockglibc-locale.

I mostly recommended against it because, unless you are trying to run an extremely barebones system where 200MB is a huge deal, removing glibc-locale isn’t really worth it.

1 Like

IMHO it should be safe to remove the glibc-locale package; the en_US.utf8 locale is provided by glibc-locale-base:

sh@meteor:~> rpm -q --provides glibc-locale | grep 'locale.glibc' | head -n 15
locale(glibc:aa_DJ)
locale(glibc:aa_DJ.utf8)
locale(glibc:aa_ER)
locale(glibc:aa_ET)
locale(glibc:af_ZA)
locale(glibc:af_ZA.utf8)
locale(glibc:agr_PE)
locale(glibc:ak_GH)
locale(glibc:am_ET)
locale(glibc:an_ES)
locale(glibc:an_ES.utf8)
locale(glibc:anp_IN)
locale(glibc:ar_AE)
locale(glibc:ar_AE.utf8)
locale(glibc:ar_BH)
sh@meteor:~> rpm -q --provides glibc-locale | grep -c 'locale.glibc'
505
sh@meteor:~> rpm -q --provides glibc-locale-base | grep 'locale.glibc'
locale(glibc:C.utf8)
locale(glibc:en_US.utf8)

Output of qdirstat pkg:/glibc-locale

2 Likes

BTW if you try the above QDirStat command and then start opening the branches of glibc-locale you will find that it makes heavy use of hard links, so the disk usage is not anything near what one would expect: A lot of those files are shared between locales.

Is saving ~250 MB worth the trouble? You decide.

Further reading: QDirStat Pkg View documentation

2 Likes

Thanks for suggests, I am deciding not to remove glibc-locale. I have enough NVMe space, just wanted to remove it more for aesthetic cleaning than memory needs.

@shundhammer I did those commands and the result were almost like yours.
I use Ncdu (NCurses Disk Usage) to calculate directories.

My /usr/lib/locale is about *Total disk usage: 235.6 MiB - Apparent size: 226.7 MiB - Items: 7,112

I am convinced that it is not worth it according to the reasons and arguments you presented.

One less package and a few mega less changes nothing, maybe i shouldn’t have opened this topic and taken your time, but let it serve as a info for someone who wants to do something like that and doesn’t gain anything.

Kindly Regards.

@x0r your just wanting to remove the lang files, if so I run;

rpm -qa *-lang --qf "%{name}\n" | xargs zypper --non-interactive rm -u
zypper al *-lang
2 Likes

@x0r: No need to worry about anything – we’re here to help and discuss the various issues which arise from the use of computing systems …

And, one learns something new every day …

  • I’ll bet a newly issued one US dollar coin that, not many people are aware that, at least for Linux systems, the GNU C Library Locale definitions are split into 2 packages – a minimal “basic” package and, another package with “everything else” …
3 Likes