Is "dnf remove" supposed to clear the package's cache folders?

On my system (both Fedora 32 and 33) this certainly doesn’t happen, ~/.cache has even had folders of packages removed months ago (albeit they could have been wiped if the location had grown past a certain size).

What is the reasoning not to touch the package’s data in ~/.cache since by definition no persistent storage should be located there?

2 Likes

https://docs.fedoraproject.org/en-US/packaging-guidelines/#_no_files_or_directories_under_srv_usrlocal_or_homeuser

dnf only removes files and directories owned by a package, and according to the packaging guidelines linked above, Fedora packages cannot put files and directories to the user’s home directory at the installation time (the program itself can create files and directories in there after it is launched by the user, but those files and directories are not owned by the package). So in short: no, dnf does not touch user’s home directories, you need to clean it yourself.

4 Likes

Hi, I know this isn’t related to your question to start from, but I see that you like to “keep things clean”, so a good tip is to run sudo dnf autoremove once in a while, to see and remove unnecessary packages left behind. :slight_smile:

1 Like

Is that command safe to use without removing dependent packages?

Yes, I believe so. It removes packages that were dependencies of packages that were already removed, not dependents of them.

However, sometimes those can be packages that you still want to have. In those cases, just reinstall them on their own.

2 Likes