Score:0

Why does 'apt-get remove' leave configuration files in /etc?

tr flag

I can understand keeping configuration files in /home, since these are custom files that have been created/edited by the user when running the corresponding program.

In contrast however, configuration files in /etc must be created and edited as root, and given that most programs do not run as root, they must be created when their corresponding program is installed, and not be edited thereafter. This means they won't differ from their counterparts in the program's package file.

So what is the point in keeping them after the program has been removed?

user535733 avatar
cn flag
This seems a hypothetical question, and the assumption "*and not be edited thereafter*" seems invalid. That's a choice that the admin gets to make. Back in the pre-Ubuntu days, it was more common to uninstall a package in order to reinstall from different source or to change versions. Keeping global config settings (that might be highly customized) was a welcome option. You might not use it, but others do.
Score:1
it flag

A "configuration file", in /etc, is a System Administrator controlled file, and could contain a significant amount of System Administrator effort. It's created by the package installation scripts, but customized locally. Uninstalling a package should not discard local changes. Consider the case where one wants to uninstall a package, then, build the absolute latest version from source. One would not want to lose the old version's configuration file.

To really get rid of everything, configuration files in /etc too, use apt purge package. Read man apt.

EmmaV avatar
tr flag
As far as I know, the configuration files in `/etc` on my system get put there by the package manager, and then are never edited again. They're not system administrator-controlled.
waltinator avatar
it flag
System-wide configuration files in `/etc` are edited by users in the system administrator role to influence system behavior. They're one more way Linux lets one control the system. Just because you haven't found a need to do so yet doesn't mean the need doesn't exist.
cn flag
@EmmaV not true. /etc/apache/* ARE edited and there are many many more You might not edit /etc/ but that does not mean everybody else does not
Score:0
pk flag

You might want them easily accessible if you spent a lot of time configuring a program and then have to uninstall and reinstall for some reason.

Otherwise, you can remove them with

sudo apt autoremove && sudo apt clean

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.