I am just starting to get how purge and remove are different from each other, but one thing I don't get is:
How does purge know where to look for user config files, and how much does it actually delete when purging?
Practically speaking, how can I remove a package and every single last directory or file that installing and configuring the package might have left behind so that when I uninstall it was like the package was never there?
Scenarios that help explain this remove thing to me are:
- I install a package and it installs a whole bunch of dependencies that only it needs.
- I install a package and it tries to install a whole bunch of dependencies that it needs, but finds out that some other packages have already installed those dependencies because they need them and so, it does not install them.
- I remove a package and it removes all the dependencies that it once needed, regardless of it other programs need them or not.
- I remove a package and it sees that other programs need some of the dependencies and so, it leaves them, but removes the ones that only it needed.
I think my logic covers all the scenarios. I'm sure there are ways to implement each of these scenarios, despite their possibly inherent uselessness. Just spelling out the logic. Anyway, the question is more about purge, not remove, so let's stick with purge, but correct my understanding of remove if you feel it is relevant or necessary.
The practical examples to illustrate the purging question are:
I installed tightvncserver or openssh-server which created folders in the user's home directory to save their configurations. What about these two packages can tell purge "Hey, when you delete my package from the system you might want to look in ~/.vnc or ~/.ssh and just delete those folders so nothing is left behind."
Also, do these packages for example or even in particular leave behind other stuff in /var or other directories that purge might want to delete? I don't know, like man-db, bash aliases. Really, I don't know, you tell me, I'm new to this.
When you install Apache it seems like there's stuff thrown every which way. Doesn't apache2 have its own folder in /etc, and use space in /var for the sites themselves? If I purge apache2, will purge know to look in /etc and /var and get rid of all that garbage? If it does know to look there for removal of those directories, how does it know? Is there code in the package files themselves that tell the kernel or at least purge that "Hey, when you purge me, please look in the following places and get rid of all those things because no one else uses them but me. Oh and while you're at it, tell that one part of the system that lets all us programs use it to find stuff we need to forget about me completely (systemctl? bash? others?). I'm gone and not coming back."
It seems to me that I have seen traces of removed packages in the following places:
- when querying systemctl for services status
- bash aliases
- where the heck else do package installs put stuff that I haven't listed?
It's obvious I'm asking about likely existing or available information. But, I would really like a nice concise treatment of the questions. I think it would help a lot of folks demystify how package installation and removal works. Maybe I'm asking about things that are not truly connected, but to me they seem connected, so demystifying or correcting how these things are or are not connected obviously can help set the record straight as well.