You are not logged in.

#1 2025-03-17 22:15:36

redluci4
Member
Registered: 2024-11-09
Posts: 17

Why is (dot)config used as cache?

Hello world,

I've been using Arch Linux for 4 years now in my PC and Laptop, now after getting lots of error with NVIDIA-drivers, Wacom-drivers, and Bluetooth-drivers, I'm going to reinstall the OS from scratch.

So when backing up my home directory after finishing all the data files, I tried to get all the config too, but the (dot)config folder and my home directory is being used as caching location instead of only using (dot)cache for that purpose.

I'm currently going through my (dot)zsh_history file to look at nano command changing config files in (dot)config directory to back up those too, but that means I've to leave the other config files that get changed by the main programs instead of nano with the other junk.

Can someone please tell my how to store, backup, and maintain the actual configs and excluding the cache with other junk - that is found inside the (dot)config dir, but without touching the (dot)config dir as much as possible.

Thank you.

EDIT - 1 :

I'm gonna test the XDG thing in a VM and I need to wipe this system anyway.

But after that I'm gonna store all my configs that I personally edit/manage in an actual (dot)dotfiles directory in my $HOME separately from the XDG stuff with git or something else, and may be even make a custom PKGBUILD package that automatically takes care of sim-links and basic directory structure for  .local .config and .dotfiles directory hosted in GitLab or somewhere.

I'll update after I get some improvement or brake anything else, thanks for the replies and help.

Last edited by redluci4 (2025-03-18 18:11:22)

Offline

#2 2025-03-18 04:04:57

mpan
Member
Registered: 2012-08-01
Posts: 1,593
Website

Re: Why is (dot)config used as cache?

Given config and cache directories usually use the same layout, it’s not possible to tell which files are caches and which are configs. Not without analyzing each application separately, which is going to be tremendous task. Likely not worth doing. Just go through the list of apps, save the data you can’t recreate (e.g. contact lists, notes contents, …), and forget about the configs. You can recreate them later with much less effort.

You may also backup the directory as-is, including both types of data. If it’s too big, use ncdu to idenfity the heaviest directories. Verify only those and delete, where determined to be caches. Should easily save 1/4 to 1/2 of the space.

If your environment was misconfigured to point both cache and config paths to the same directory, also check if the same wasn’t the case with the data directory (“~/.local/share” by default). If this is the case, it’s going to be worse. This is much heavier and you can’t delete it without losing data that is very likely of importance to you.

Also note that system reinstallation is generally a bad idea for Arch. This isn’t Windows. Understand the problem, fix it. Unless it’s some stale config files, reinstallation does literally nothing. It is just replacing files with their identical copies in the very same places. If it’s stale or bad config files, starting from scratch gets rid of them indeed, but you’re very likely to repeat the same mistakes and end up in a similar situation.


Paperclips in avatars? | Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#3 2025-03-18 13:48:02

redluci4
Member
Registered: 2024-11-09
Posts: 17

Re: Why is (dot)config used as cache?

Ya I think you're right about missing some configs that set certain paths to be used for certain purposes.

I tried to search how and where the general systemwide configuration for - config, cache, and other directory variables are set, and I found something called the XDG_ prefix variable (that follows a standard called cross-desktop groups) that other programs use to find what directories should be used for what purpose.

And after

sudo grep -rni -e "XDG_" /etc /usr/share

the only file that sets these variables seems to be :

/etc/profile.d/flatpak.sh
/etc/profile.d/flatpak.csh
/etc/profile.d/locale.sh
/etc/profile.d/flatpak-bindir.sh

And out of these files - the once that set the environment for the base system is the

/etc/profile.d/locale.sh

which belongs to the filesystem package from the core repository, but that doesn't seem to set every XDG_ variable like cache-dir, data-dir, state-dir, runtime-dir, etc. for which I have to manually set them through profile, profile.d, window/desktop-manager, rc-files, services, package, etc.

But since I never configured such "XDG_*" variables, and by what you said that means my system is completely messy, but functional, so I have to look at the zsh_history with regex to find all the configs that I've changed, and I have to back up my ssh_keys, git_configs, gpg_keys, etc.

I'm currently using Wayback Machine to look at the XDG Base Directory Specification since currently XDG Base Directory Specification is inactive till migration finishes (so I'll have to wait and see how it changes).

I can't remember on the top of my head the things I'll have to back up other than the nano-suff, gpg-stuff, pacman, flatpak, dns, proxy, etc.

But thank you for clarifying the solution.

I'll have to test the solution in a VM before wiping and installing in my system.

Offline

#4 2025-03-18 14:40:02

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,450

Re: Why is (dot)config used as cache?

I migrated to a new laptop recently after many years of running Arch on the old one. I guess I disagree with your statement that `the (dot)config folder [..] is being used as caching location`. My procedure is to backup the old $HOME folder without .cache and restore it on the target into a ~/migrate/[username] folder (therefore outside of the new, fresh $HOME). I then manually merged about 50% of the old configuration files (such as .bashrc) with the new autogenerated ones and simply copied the other 50% as-is, such as .ssh, .vimrc.
I'm very minimalist, so I'd rather re-apply (i.e. merge) my config changes into the newly generated config. For example, I noticed that my local .git configuration had ancient configs (old work emails, etc.) that I no longer wanted to apply to the new laptop. I also had prehistoric configs in my Ranger/Rifle setup that I was glad to keep out of the newly autogenerated configs.

But back to your topic subject line: I did not encounter any application that was using .config as a cache.

Offline

#5 2025-03-18 15:02:51

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,372

Re: Why is (dot)config used as cache?

the (dot)config folder and my home directory is being used as caching location instead of only using (dot)cache for that purpose

By what metric?

ls ~/.config/fontconfig/*cache* | wc -l
ls ~/.cache/fontconfig/*cache* | wc -l

Some client might have placed what one would reasonably consider transient data into ~/.config for being too lazy (some local scripts here might do that because they were hacked by some lazy slouch around midnight…) but that doesn't mean there's systematic abuse of that path.

Online

#6 2025-03-18 16:54:06

redluci4
Member
Registered: 2024-11-09
Posts: 17

Re: Why is (dot)config used as cache?

Bro, you don't understand what I'm saying, I come from Windows-7 to 8.1 to 10 to 11 to macOS to Ubuntu to Manjaro to Arch simply because I want to run anything I find - that I like on the internet and I want the latest updates.

I have 1.5Gb out of 4Gb of my boot partition free because I have shit ton of themes, experiments, and crap - I made and forgot about.

When I first installed my Arch system, I had 2 boot loading systems installed because I thought grub2 didn't work because I messed up the installation, then I installed something else on top of grub2 and thought that was grub2 which has finally started working. (I found it and fixed it recently btw, now I only have grub2).

Then, when I say Arch is using (dot)config as caching location, I'm not commenting/talking-dirty about the Arch OS, and it's implementation itself, but rather I'm bitching-about and trying-to-fix my installations of Arch.

And you wouldn't believe, but finding the directory and ASCII-files with names containing cache takes my system 273 seconds to finish, even without printing anything to screen and appending the list to a file while excluding all the pycache, discord-junk, Every-Browser-cache, binary, raw, image-data, etc. and all other kinds of trash in my (dot)config, and the list.txt is 25000 lines long (excluding all the non ASCII/text cache), and including everything else its goes beyond 80000 lines (that is only searching for the word cache).

My (dot)cache is actually 150Gb large and that's understandable - because I use LLM's and sometimes build AOSP's for my phone and as I mentioned before I never configured the different XDG properly, so my system is messy and whatever, but my (dot)config is 25Gb large, and the question I ask is why, what's in there, I only edited few files (like mpv, kitty, cland, helix, firetools, tmux, etc.), so how could there possibly be 25Gb of human-manageable/readable configs than I'm supposed to be aware of in my (dot)config directory exist, and the answer is - it doesn't, most of the things found in my (dot)config is cache of every different kind one can possibly imagine.

And that's not even the worst part - my $HOME directory is just as messy as my (dot)config directory with all the (dot)directory folders storing files of all kind, with names starting from arduino, arduino15, to bin, cargo, ddd, eclips, electrum to gnupg, icons, ipfs, java, jd, logseq to npm, ollama, pencil, plasticity, Power_line, pyenv, ssh, steam, terminfo, vscode, yarn, zen, zsh, etc. on top of my data I store in my home directory (which I know exists because I made them unlike all the (dot)directory folders that appears from using software like steam, wine, vscodium, etc.), I'm assuming that since I didn't configure the XDG properly, software like arduino, vscode, pyenv store libraries, addons, plugins in this directory inside my $HOME instead of using (dot)local directory.

But I guess you'll be right from your POV too, since most of the Linux users I've seen use it for technical and practical reason, and this may seem pointless and a waste of time or resources, but I'm not your typical Linux user, because I use my Linux for basically everything (and I don't mean everything like - Ohh I have only arch, so I have to do everything in it, but rather I mean, whatever I find no matter how small, obscure, or unused it happens to be - if I like it then it's part of my system forever - kind of everything), I still have all of my Windows 7, 10, 11 apps in my Windows VMs, and I still use my iPhone and Apple apps with my Hackintosh VM, I use and make videos, audio, games, apps, picture, models, websites, in my Arch PC so when people say "they come to Arch to reduce bloating" that concept doesn't work for me, sometimes I completely forgot that I changed from Manjaro to Arch because I still use KDE/Plasma as my DE, and all I ever want with Linux is to use anything/everything I find, that I like to use, in the way I like to use it.

So take whatever you find meaningful from this, but that's just me, this is not a rant (I'm not typing this post with mean/angry voices in my mind dictating it), I just don't know why I find myself alone with conditions barely anyone has and no one believes (I mean I know why I do it, but why don't many more people do similar stuff like this), I'm just gonna leave this here in case someone else needs this, that's all.

Offline

#7 2025-03-18 16:54:29

mithrial
Member
Registered: 2017-03-05
Posts: 151

Re: Why is (dot)config used as cache?

All the chromium-based browsers and Electron applications store their cache in .config.
E.g. Vivaldi: ~/.config/vivaldi/Default/GPUCache or Signal: ~/.config/Signal/Cache/

Others, I didn't find.

Offline

#8 2025-03-18 18:22:57

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,450

Re: Why is (dot)config used as cache?

redluci4 wrote:

Bro, you don't understand what I'm saying
[...]
And you wouldn't believe, but finding the directory and ASCII-files with names containing cache takes my system 273 seconds to finish, even without printing anything to screen and appending the list to a file [..]

Well, I challenge any intelligent being to understand what the hell you are saying, indeed.

Offline

#9 2025-03-18 18:41:13

redluci4
Member
Registered: 2024-11-09
Posts: 17

Re: Why is (dot)config used as cache?

twelveeighty wrote:
redluci4 wrote:

Bro, you don't understand what I'm saying
[...]
And you wouldn't believe, but finding the directory and ASCII-files with names containing cache takes my system 273 seconds to finish, even without printing anything to screen and appending the list to a file [..]

Well, I challenge any intelligent being to understand what the hell you are saying, indeed.

I see, let me clarify:

What I'm trying to explain is that when I search through the files and folders in the .config directory for those that contain the word "cache" in their names, it results in a very long list. The process of using the find or grep command to go through all these files takes over 3 minutes to complete. And that's just the time it takes to read the output and append it to a text file—if I were to print everything to the screen, it would take even longer.

This is only for searching the term "cache," but there are many other types of caches stored in the .config directory. These range from raw data, image data, and pycache to other proprietary formats that belong to applications like Discord, Steam, etc.

Offline

#10 2025-03-18 20:20:40

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,372

Re: Why is (dot)config used as cache?

So take whatever you find meaningful from this

how could there possibly be 25Gb of human-manageable/readable configs

twelveeighty wrote:

use ncdu to idenfity the heaviest directories

But yes,

mithrial wrote:

All the chromium-based browsers and Electron applications store their cache in .config.

and it's likely gonna be some browser profiles.
Avoid deleting those directores if you care about stored passwords etc., the browser will typically allow you to wipe the cache.

searching the term "cache,"

Grepping for strings will neither tell you what kind of data that is nor how much space it occupies, "bro".

Online

#11 2025-03-18 20:57:56

redluci4
Member
Registered: 2024-11-09
Posts: 17

Re: Why is (dot)config used as cache?

seth wrote:

So take whatever you find meaningful from this

how could there possibly be 25Gb of human-manageable/readable configs

twelveeighty wrote:

use ncdu to idenfity the heaviest directories

But yes,

mithrial wrote:

All the chromium-based browsers and Electron applications store their cache in .config.

and it's likely gonna be some browser profiles.
Avoid deleting those directores if you care about stored passwords etc., the browser will typically allow you to wipe the cache.

searching the term "cache,"

Grepping for strings will neither tell you what kind of data that is nor how much space it occupies, "bro".

Obviously, I was able to grep for patterns and keyword to identify the files I need and subtract their total size from the overall directory size.

In my case, the configuration data (which I can recover from .zsh_history and .bash_history for both user and root) is only a few hundred KB, but the entire .config directory totals around 25GB.

I don't need the cache since I can always generate, sync or retrieve it later. What I need are the configurations, but the directory structure is quite similar across various apps for cache and config. So, I’ve been manually going through and backing up the necessary data as suggested by here for a while now.

Offline

#12 2025-03-18 21:11:08

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,372

Re: Why is (dot)config used as cache?

Obviously, I was able to grep for patterns and keyword to identify the files I need

searching the term "cache,"

And ifff you had a list of all the files you need, what'd be the remaining issue?
You'd archive them and delete the rest.

This is going absolutely nowhere.
Use ncdu to determine what makes up the payload, though it's most likely going to be some browser profiles.

Online

#13 2025-03-19 10:33:05

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,640
Website

Re: Why is (dot)config used as cache?

You mentioned git as a backup solution. What's preventing you from just including the desired configuration files in the backup git repo and to exclude/.gitignore the rest?


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#14 2025-03-19 11:25:14

redluci4
Member
Registered: 2024-11-09
Posts: 17

Re: Why is (dot)config used as cache?

schard wrote:

You mentioned git as a backup solution. What's preventing you from just including the desired configuration files in the backup git repo and to exclude/.gitignore the rest?

Nothing, I just haven't done it at the start/installation of my OS, so now the directory is a mess, so I'm going through the files that needs to be moving it to a .dotfile directory with symlinks in the config pointing back, and I'll git init that directory into a repo, that way I don't have to have a huge .gitignore and manage the list constantly.

Now I'm just preceding with that plan for the past day and half making list of directories and configs that I need in the (dot)dotfiles repo, looking out for elegant, repeatable and timely solutions on the way, I'm also testing this neat XDG thing in a clean VM before making drastic changes in my system.

Last edited by redluci4 (2025-03-19 11:35:05)

Offline

Board footer

Powered by FluxBB