Force apt-get to ask all install questions again?
While installing jackd
using apt-get, I gave the wrong answer to some questions. How do I force apt-get to ask me the question again? I'd really rather do this through the package manager than making the changes manually.
I tried to purge it and install it again. I have also tried dpkg-reconfigure jackd
.
It's likely that dpkg-reconfigure
is the solution, but sometimes the package to which the question belongs is not named the same as the package you installed - either because it was a meta-package, or because the question belonged to one of the dependent packages.
In that case, it can be helpful to look at the debconf database to see if there is a likely candidate, using debconf-show
e.g.
$ sudo debconf-show --listowners | grep jack
jackd2
and it turns out that
$ sudo dpkg-reconfigure jackd2
does indeed prompt the question that you are looking for.
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 usernamegit
for packagegitolite3
it does not clean up the defaultgitolite3
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 onapt-get install
- You hate Curses-GUIs or love plain text consoles
Have 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 /var/cache/debconf/config.dat
.
To see all this information, run following command, perhaps before you try to install PACKAGE
:
debconf-show PACKAGE
See below on some ways to get rid of unwanted entries (there are zillion of more ways, of course).
Warning:
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 destroyconfig.dat
. And most time you cannot even see it.Instead use the proper tools (some are in
debconf-utils
):
debconf-get-selections
to dump everythingdebconf-set-selections
to set thingsdebconf-show PACKAGE
to see all debconf parameters ofPACKAGE
(this is everythingdpkg-reconfigure PACKAGE
would ask)echo PURGE | debconf-communicate PACKAGE
to delete all debconf information of a PACKAGEBut beware, these are not designed for normal people.
How to get rid of everything of a package
Warning!
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.
However 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.
Note that 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 dpkg-reconfigure
.
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
dpkg-reconfigure PACKAGE
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
add
DEBIAN_FRONTEND=readline
in front ofapt-get
-
If you even dislike the readline interface and want dead simple line editing as well
add
TERM=dumb
in front ofapt-get
(note that this is nothing special fromdebconf
, this works since Unix was born).
(Note that you can set this in the Environment as well like export DEBIAN_FRONTEND=readline
, of course.)
FYI
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:
http://debiananwenderhandbuch.de/debconf.html
BTW:
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,
apt
anddebconf
are still too confusing.