Is it possible to purge un-needed language files?  [Solved]

Message
Author
User avatar
MikeR
Posts: 227
Joined: Sun Jun 25, 2023 6:42 am

Is it possible to purge un-needed language files?

#1 Post by MikeR »

There are many directories holding specific language files for languages that are useless to most users (Swahili, anyone)
e.g. /usr/share/gnupg/help* or /usr/share/tcltk/tcl8.6/msgs/
These directories are mostly not large (less than 1M each) but there do seem to be many of them, so they add up...
Admittedly disk space is not a burning issue, but if there were a supported or semi-supported way of clearing these files,
or even just listing them, it would be nice to have. By the way, Bleachbit does not touch these files.
Any suggestions? Anyone?

In case it is of interest, my QSI

Code: Select all

Snapshot created on: 20250701_0407
System:
  Kernel: 6.1.0-37-amd64 [6.1.140-1] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1.0-37-amd64 root=UUID=<filter> ro quiet splash
  Desktop: GNOME v: 43.9 info: gnome-panel wm: Metacity v: 3.46.1 dm: LightDM v: 1.32.0
    Distro: MX-23.6_x64 Libretto June 26 2024 base: Debian GNU/Linux 12 (bookworm)
Machine:
  Type: Desktop System: HP product: HP ProDesk 400 G4 DM (TAA) v: SBKPF
    serial: <superuser required> Chassis: type: 6 serial: <superuser required>
  Mobo: HP model: 83F3 v: KBC Version 07.D2.00 serial: <superuser required> UEFI: HP
    v: Q23 Ver. 02.25.00 date: 09/28/2023
CPU:
  Info: model: Intel Core i5-8500T bits: 64 type: MCP arch: Coffee Lake gen: core 8 level: v3
    note: check built: 2018 process: Intel 14nm family: 6 model-id: 0x9E (158) stepping: 0xA (10)
    microcode: 0xFA
  Topology: cpus: 1x cores: 6 smt: <unsupported> cache: L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB
    L2: 1.5 MiB desc: 6x256 KiB L3: 9 MiB desc: 1x9 MiB
  Speed (MHz): avg: 800 min/max: 800/3500 scaling: driver: intel_pstate governor: powersave
    cores: 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 bogomips: 25199
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling mitigation: Microcode
  Type: indirect_target_selection status: Not affected
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled
  Type: mds mitigation: Clear CPU buffers; SMT disabled
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT disabled
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed mitigation: IBRS
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: IBRS; IBPB: conditional; STIBP: disabled; RSB filling;
    PBRSB-eIBRS: Not affected; BHI: Not affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort mitigation: TSX disabled
Graphics:
  Device-1: Intel CoffeeLake-S GT2 [UHD Graphics 630] vendor: Hewlett-Packard driver: i915
    v: kernel arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: DP-1 empty: DP-2,
    DP-3, HDMI-A-1, HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:3e92 class-ID: 0300
  Device-2: Jieli USB PHY 2.0 type: USB driver: snd-usb-audio,uvcvideo bus-ID: 1-4.3:50
    chip-ID: 1224:2a25 class-ID: 0102
  Display: x11 server: X.Org v: 1.21.1.7 with: Xwayland v: 22.1.9 driver: X: loaded: intel
    dri: i965 gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22") s-diag: 582mm (22.93")
  Monitor-1: DP-1 mapped: DP1 model: Lenovo C24-20 serial: <filter> built: 2021 res: 1920x1080
    hz: 60 dpi: 92 gamma: 1.2 size: 530x300mm (20.87x11.81") diag: 604mm (23.8") ratio: 16:9 modes:
    max: 1920x1080 min: 720x400
  API: OpenGL v: N/A renderer: N/A direct-render: N/A
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: Hewlett-Packard driver: snd_hda_intel v: kernel
    bus-ID: 1-4.3:50 alternate: snd_soc_skl,snd_sof_pci_intel_cnl chip-ID: 1224:2a25 class-ID: 0102
    bus-ID: 00:1f.3 chip-ID: 8086:a348 class-ID: 0403
  Device-2: Jieli USB PHY 2.0 type: USB driver: snd-usb-audio,uvcvideo
  API: ALSA v: k6.1.0-37-amd64 status: kernel-api tools: alsamixer,amixer
  Server-1: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: off 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Hewlett-Packard
    driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: 3000 bus-ID: 02:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Realtek RTL8192EU 802.11b/g/n WLAN Adapter type: USB driver: rtl8xxxu bus-ID: 1-8:3
    chip-ID: 0bda:818b class-ID: 0000 serial: <filter>
  IF: wlan0 state: up mac: <filter>
Drives:
  Local Storage: total: 238.47 GiB used: 20.89 GiB (8.8%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung model: MZVLB256HAHQ-000H7 size: 238.47 GiB
    block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
    rev: EXD70H2Q temp: 38.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 40 GiB size: 39.08 GiB (97.69%) used: 9.51 GiB (24.3%) fs: ext4
    dev: /dev/nvme0n1p5 maj-min: 259:2
  ID-2: /home raw-size: 40 GiB size: 39.08 GiB (97.69%) used: 11.38 GiB (29.1%) fs: ext4
    dev: /dev/nvme0n1p6 maj-min: 259:3
Swap:
  Kernel: swappiness: 15 (default 60) cache-pressure: 50 (default 100)
  ID-1: swap-1 type: partition size: 10 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/nvme0n1p7
    maj-min: 259:4
Sensors:
  System Temperatures: cpu: 39.0 C pch: 48.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Repos:
  Packages: pm: dpkg pkgs: 2525 libs: 1213 tools: apt,apt-get,aptitude,gnome-software,nala,synaptic
    pm: rpm pkgs: 0
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
    1: deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/debian.list
    1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
    2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/mx.list
    1: deb http://nl.mxrepo.com/mx/repo/ bookworm main non-free
Info:
  Processes: 257 Uptime: 2d 2m wakeups: 1 Memory: 7.6 GiB used: 1.31 GiB (17.3%) Init: SysVinit
  v: 3.06 runlevel: 5 default: graphical tool: systemctl Compilers: gcc: 12.2.0 alt: 12
  Client: shell wrapper v: 5.2.15-release inxi: 3.3.26
Boot Mode: UEFI
Old RSTS hack
Registered Linux user #542196

User avatar
dolphin_oracle
Developer
Posts: 22368
Joined: Sun Dec 16, 2007 12:17 pm

Re: Is it possible to purge un-needed language files?  [Solved]

#2 Post by dolphin_oracle »

sometimes localizations are in special localization packages, but often such files are part of the particular package. so sometimes you can remove packages, but otherwise you can probably manually delete them, but they will come back if those files ever update.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
MikeR
Posts: 227
Joined: Sun Jun 25, 2023 6:42 am

Re: Is it possible to purge un-needed language files?

#3 Post by MikeR »

So no cigar, then. Thanks anyway
checking solved
Old RSTS hack
Registered Linux user #542196

BV206
Posts: 508
Joined: Sat Mar 09, 2019 10:55 am

Re: Is it possible to purge un-needed language files?

#4 Post by BV206 »

This is what I did.

1. Run MX Locale and make sure all unwanted languages are disabled and the system default locale is set to the one you want.

2. Install the package "localepurge" from the main repo and run "sudo localepurge" in a terminal. It has several steps.

3. Install the package "bleachbit" from the test repo. It will create two .desktop files in your menu. One for normal user and one for Administrator/Root. You may have to edit the .desktop files to find the one with "pkexec bleachbit" for root priviledges and rename it.

4. When you run Bleachbit as administrator uncheck everything in the left side column (unless you want to clean other things) except System/Localizations.
The upper right side of the toolbar has a 3 dot hamburger menu. Click that, Click Preferences, Click the Languages tab.
Make sure only the languages you want to keep are checked. In my case I have:
en
en_US
en_US.UTF-8

5. Click the Preview button and it will show everything that will be deleted when you click Clean. Also you can right click Localizations (or any other item in the left side column) and preview or clean only that item.

If you install new packages or current ones get upgraded the language/localizations for those packages will probably be reinstalled so you will probably have to use localepurge and bleachbit periodically to get rid of them.

User avatar
MikeR
Posts: 227
Joined: Sun Jun 25, 2023 6:42 am

Re: Is it possible to purge un-needed language files?

#5 Post by MikeR »

From OP:

@BV206
Please note that I have already tried Bleachbit, both per system and per user, on several Linux versions
quoting myself:
By the way, Bleachbit does not touch these files.
-- Check for yourself
e.g. do

Code: Select all

sudo updatedb
sudo locate zh # or pick a different language code *after* running Bleachbit 
I will try localpurge on a test system, probably tomorrow, and hope for the best.
I shall of course report back with results, if any.

Mike
Old RSTS hack
Registered Linux user #542196

User avatar
MikeR
Posts: 227
Joined: Sun Jun 25, 2023 6:42 am

Re: Is it possible to purge un-needed language files?

#6 Post by MikeR »

@BV206

Have you actually tried your recommendations?
Well I tried installing and running localepurge

Unfortunately the choice of which languages to install seemed an exact copy of the setup section in Bleachbit, which in turn seemed identical to the selection section in dpkg-reconfigure locales

No unnecessary language files were purged.
e.g.

Code: Select all

dir /usr/share/tcltk/tcl8.6/msgs/
total 516K
drwxr-xr-x 2 root root 4.0K Jul 30  2023 .
drwxr-xr-x 7 root root 4.0K Jul 30  2023 ..
-rw-r--r-- 1 root root  989 Feb  1  2023 af.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 af_za.msg
-rw-r--r-- 1 root root  259 Feb  1  2023 ar_in.msg
-rw-r--r-- 1 root root 1.8K Feb  1  2023 ar_jo.msg
-rw-r--r-- 1 root root 1.8K Feb  1  2023 ar_lb.msg
-rw-r--r-- 1 root root 2.0K Feb  1  2023 ar.msg
-rw-r--r-- 1 root root 1.8K Feb  1  2023 ar_sy.msg
-rw-r--r-- 1 root root 2.1K Feb  1  2023 be.msg
-rw-r--r-- 1 root root 1.8K Feb  1  2023 bg.msg
-rw-r--r-- 1 root root  259 Feb  1  2023 bn_in.msg
-rw-r--r-- 1 root root 2.3K Feb  1  2023 bn.msg
-rw-r--r-- 1 root root 1.1K Feb  1  2023 ca.msg
-rw-r--r-- 1 root root 1.3K Feb  1  2023 cs.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 da.msg
-rw-r--r-- 1 root root  812 Feb  1  2023 de_at.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 de_be.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 de.msg
-rw-r--r-- 1 root root 2.2K Feb  1  2023 el.msg
-rw-r--r-- 1 root root  300 Feb  1  2023 en_au.msg
-rw-r--r-- 1 root root  305 Feb  1  2023 en_be.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 en_bw.msg
-rw-r--r-- 1 root root  288 Feb  1  2023 en_ca.msg
-rw-r--r-- 1 root root  279 Feb  1  2023 en_gb.msg
-rw-r--r-- 1 root root  321 Feb  1  2023 en_hk.msg
-rw-r--r-- 1 root root  279 Feb  1  2023 en_ie.msg
-rw-r--r-- 1 root root  310 Feb  1  2023 en_in.msg
-rw-r--r-- 1 root root  300 Feb  1  2023 en_nz.msg
-rw-r--r-- 1 root root  321 Feb  1  2023 en_ph.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 en_sg.msg
-rw-r--r-- 1 root root  245 Feb  1  2023 en_za.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 en_zw.msg
-rw-r--r-- 1 root root 1.3K Feb  1  2023 eo.msg
-rw-r--r-- 1 root root  242 Feb  1  2023 es_ar.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_bo.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_cl.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_co.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_cr.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_do.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_ec.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_gt.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_hn.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 es.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_mx.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_ni.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_pa.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_pe.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_pr.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_py.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_sv.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_uy.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 es_ve.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 et.msg
-rw-r--r-- 1 root root  287 Feb  1  2023 eu_es.msg
-rw-r--r-- 1 root root  985 Feb  1  2023 eu.msg
-rw-r--r-- 1 root root 2.0K Feb  1  2023 fa_in.msg
-rw-r--r-- 1 root root  417 Feb  1  2023 fa_ir.msg
-rw-r--r-- 1 root root 1.7K Feb  1  2023 fa.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 fi.msg
-rw-r--r-- 1 root root  279 Feb  1  2023 fo_fo.msg
-rw-r--r-- 1 root root  986 Feb  1  2023 fo.msg
-rw-r--r-- 1 root root  279 Feb  1  2023 fr_be.msg
-rw-r--r-- 1 root root  279 Feb  1  2023 fr_ca.msg
-rw-r--r-- 1 root root  281 Feb  1  2023 fr_ch.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 fr.msg
-rw-r--r-- 1 root root  279 Feb  1  2023 ga_ie.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 ga.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 gl_es.msg
-rw-r--r-- 1 root root  950 Feb  1  2023 gl.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 gv_gb.msg
-rw-r--r-- 1 root root 1.1K Feb  1  2023 gv.msg
-rw-r--r-- 1 root root 1.9K Feb  1  2023 he.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 hi_in.msg
-rw-r--r-- 1 root root 1.7K Feb  1  2023 hi.msg
-rw-r--r-- 1 root root 1.1K Feb  1  2023 hr.msg
-rw-r--r-- 1 root root 1.3K Feb  1  2023 hu.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 id_id.msg
-rw-r--r-- 1 root root  914 Feb  1  2023 id.msg
-rw-r--r-- 1 root root 1.3K Feb  1  2023 is.msg
-rw-r--r-- 1 root root  244 Feb  1  2023 it_ch.msg
-rw-r--r-- 1 root root 1.3K Feb  1  2023 it.msg
-rw-r--r-- 1 root root 1.7K Feb  1  2023 ja.msg
-rw-r--r-- 1 root root  279 Feb  1  2023 kl_gl.msg
-rw-r--r-- 1 root root  978 Feb  1  2023 kl.msg
-rw-r--r-- 1 root root  254 Feb  1  2023 kok_in.msg
-rw-r--r-- 1 root root 2.0K Feb  1  2023 kok.msg
-rw-r--r-- 1 root root  346 Feb  1  2023 ko_kr.msg
-rw-r--r-- 1 root root 1.6K Feb  1  2023 ko.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 kw_gb.msg
-rw-r--r-- 1 root root  966 Feb  1  2023 kw.msg
-rw-r--r-- 1 root root 1.3K Feb  1  2023 lt.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 lv.msg
-rw-r--r-- 1 root root 2.1K Feb  1  2023 mk.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 mr_in.msg
-rw-r--r-- 1 root root 1.8K Feb  1  2023 mr.msg
-rw-r--r-- 1 root root  910 Feb  1  2023 ms.msg
-rw-r--r-- 1 root root  259 Feb  1  2023 ms_my.msg
-rw-r--r-- 1 root root  690 Feb  1  2023 mt.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 nb.msg
-rw-r--r-- 1 root root  279 Feb  1  2023 nl_be.msg
-rw-r--r-- 1 root root 1.1K Feb  1  2023 nl.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 nn.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 pl.msg
-rw-r--r-- 1 root root  279 Feb  1  2023 pt_br.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 pt.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 ro.msg
-rw-r--r-- 1 root root 2.0K Feb  1  2023 ru.msg
-rw-r--r-- 1 root root  242 Feb  1  2023 ru_ua.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 sh.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 sk.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 sl.msg
-rw-r--r-- 1 root root 1.3K Feb  1  2023 sq.msg
-rw-r--r-- 1 root root 2.0K Feb  1  2023 sr.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 sv.msg
-rw-r--r-- 1 root root  991 Feb  1  2023 sw.msg
-rw-r--r-- 1 root root  251 Feb  1  2023 ta_in.msg
-rw-r--r-- 1 root root 1.8K Feb  1  2023 ta.msg
-rw-r--r-- 1 root root  411 Feb  1  2023 te_in.msg
-rw-r--r-- 1 root root 2.1K Feb  1  2023 te.msg
-rw-r--r-- 1 root root 2.3K Feb  1  2023 th.msg
-rw-r--r-- 1 root root 1.2K Feb  1  2023 tr.msg
-rw-r--r-- 1 root root 2.1K Feb  1  2023 uk.msg
-rw-r--r-- 1 root root 1.4K Feb  1  2023 vi.msg
-rw-r--r-- 1 root root  312 Feb  1  2023 zh_cn.msg
-rw-r--r-- 1 root root  752 Feb  1  2023 zh_hk.msg
-rw-r--r-- 1 root root 3.3K Feb  1  2023 zh.msg
-rw-r--r-- 1 root root  339 Feb  1  2023 zh_sg.msg
-rw-r--r-- 1 root root  346 Feb  1  2023 zh_tw.msg
and other, similar, directories.
Old RSTS hack
Registered Linux user #542196

Post Reply

Return to “General”