For the benefit of the reader in case you stumble over a similar thing, this here helps to solve following problem(s):
- After a package is installed you see, that many things are at the wrong place.
dpkg-reconfigure package does not help either, as this might leave unwanted (or even dangerous) debris behind (for example, when switching to username
git for package
gitolite3 it does not clean up the default
gitolite3 user - as it cannot know if this user was used in the meanwhile).
- After uninstalling the package, Debian still "magically" remembers the last values entered at the next install.
- You can see some package configuration values on
dpkg-reconfigure, which are not asked on
- You hate Curses-GUIs or love plain text consoles
apt ask for every possible configuration value
DEBIAN_FRONTEND=readline DEBIAN_PRIORITY=low apt-get install PACKAGE
However, this might not ask for everything if there are already cached answers. These are kept in something called
debconf. The file where it is kept is called
To see all this information, run following command, perhaps before you try to install
See below on some ways to get rid of unwanted entries (there are zillion of more ways, of course).
Never ever edit
/var/cache/debconf/config.dat on your own. Look at it, but do not alter it with an editor. It's a picky file. Spaces, TABs, etc., do not touch these, keep them as-is. Some editors try to do clever things with spaces in text files. They will destroy
config.dat. And most time you cannot even see it.
Instead use the proper tools (some are in
debconf-get-selections to dump everything
debconf-set-selections to set things
debconf-show PACKAGE to see all debconf parameters of
PACKAGE (this is everything
dpkg-reconfigure PACKAGE would ask)
echo PURGE | debconf-communicate PACKAGE to delete all debconf information of a PACKAGE
But beware, these are not designed for normal people.
How to get rid of everything of a package
apt-get purge (aka.
apt-get remove --purge) might destroy valuable user data. Be sure you kept a backup, just in chance. You have been warned.
The opposite of
apt-get install PACKAGE is
apt-get remove --purge PACKAGE. Nowadays we can write
apt-get purge PACKAGE for this, too. Without purging, some things are left behind, such that you can quickly install the PACKAGE again with all the previous settings and data intact. This includes all the questions asked when the PACKAGE was installed the first time.
apt-get purge PACKAGE removes all traces of the PACKAGE, including it's configuration and quite often even valuable user data which was stored by or for the PACKAGE will be removed entirely as well!
So if you see, that something went wrong when installing a PACKAGE, you can use
apt-get purge PACKAGE to get rid of it, such that you can try again to install it correctly. Later, after you have used PACKAGE a while,
apt-get purge PACKAGE probably comes out very evil.
apt-get purge PACKAGE sometimes leaves debris behind when a package was reconfigured with
dpkg-reconfigure PACKAGE, because
purge operates on what is known at "purge-time", and not what was before that, because there is little to no history about what was before the last
But if you are sure there is no valuable data left which is not backed up and you want to start from fresh with some package, do an
apt-get purge PACKAGE. Note that you can do this even after a package was removed with
apt-get remove PACKAGE.
How to find the package
You have know a file, but do not know which package it belongs to, this finds it:
dpkg -S /path/to/file
If this does not output anything, it does not belong to a PACKAGE. So perhaps it is user data or debris. You decide.
For a COMMAND you can type (note that the quotes are important) to find it's PACKAGE:
dpkg -S "`which COMMAND`"
It you found the package, you can get a list of all files in a package:
dpkg -L PACKAGE
(Note that this does not include some files, which are generated by the install scripts.)
However finding a package only works for installed packages. If you need the same info for not yet installed packages, try the tool
apt-file search filename (you need to run
apt-file update first to initialize it's database).
To sum it up
You have a PACKAGE already installed and want to reconfigure it
You want to re-install a PACKAGE with the current settings
apt-get install --reinstall PACKAGE
You want to re-install a PACKAGE from scratch, with deletion of all previous (possible precious) data, and have all possible questions asked again:
apt-get purge PACKAGE
DEBIAN_PRIORITY=low apt-get install PACKAGE
If you dislike Curses interface and want a line-driven interface
DEBIAN_FRONTEND=readline in front of
If you even dislike the readline interface and want dead simple line editing as well
TERM=dumb in front of
apt-get (note that this is nothing special from
debconf, this works since Unix was born).
(Note that you can set this in the Environment as well like
export DEBIAN_FRONTEND=readline, of course.)
The best source known to me, where debconf is explained, such that you can really understand it, and where I took most of the details for this here, is following link, but the page is in German language:
I write this as a reference to myself, too, because I cannot remember all the details. It's all just too exotic and mostly absent from the man pages.
This answer is too long. Which probably means,
debconf are still too confusing.