5

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.

  • apt asks a question when its about to install more than you asked. in other words the dependencies of that app you asked to install. so the 1st time it installed them. when you purged the app, dependencies were left there untouched. you can use synaptic to find all useless dependencies that currently are useless or use dpkg to sort packages per date and find them manually and unistall them, or just forget about them. to get a question again now to install that specific app do what they suggest on their answers below – Pavlos Theodorou Feb 08 '17 at 06:26

3 Answers3

5

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.

steeldriver
  • 136,215
  • 21
  • 243
  • 336
  • This does not help for packages which are installed into the wrong places, when dpkg-reconfigure leaves unwanted (and possibly dangerous) debris behind. Example: gitloite3 – Tino Feb 07 '17 at 18:09
3

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 apt-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 destroy config.dat. And most time you cannot even see it.

Instead use the proper tools (some are in debconf-utils):

  • 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

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 of apt-get

  • If you even dislike the readline interface and want dead simple line editing as well

    add 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.)

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 and debconf are still too confusing.

Tino
  • 720
  • 1
  • 7
  • 16
  • to know which package belongs where is hard... you must have the memory of an elephant haha ! but using dpkg to sort by date is something its easier to remember , find and uninstall. for example i can remember i installed those apps on friday, but i can't remember 20+ packages names ! – Pavlos Theodorou Feb 08 '17 at 06:30
  • The post is so long because it includes the answers to two separate, but related questions: http://askubuntu.com/questions/481/how-do-i-find-the-package-that-provides-a-file and http://askubuntu.com/q/187888/158442 – muru Feb 08 '17 at 06:46
  • Thanks for noting, but an answer is no answer when it raises more questions than it solves. The information "how to have apt ask everything" is so well hidden in the docs, that most will be at a point, where it is too late when they notice. Perhaps packages were installed as recommends. So you need a) a way to locate the package and b) clean it up, such that you can apply the answer. Also cleanups need to be done properly, which is a problem by itself. Hence I must give the right pointers. Thanks for adding the links to them! That is very welcome ;) – Tino Feb 09 '17 at 20:13
1

I too just ran into this same issue (on Ubuntu Server 18.04) where I had installed jackd and wanted to reconfigure it to enable the realtime priorities, which I had selected No to on the initial installation.

I still had the installation text displayed on my screen when I scrolled back. (via Shift-PageUp) and when I saw these two lines:

Setting up jackd1 (1:0.125.0-3) ...
Setting up jackd (5) ...

I figured I could try reconfiguring jackd1 instead of jackd.

Sure enough, I did a sudo dpkg-reconfigure jackd1 and I was prompted for the realtime question again.

When I answered yes this time, it changed the /etc/security/limits.d/audio.conf.disabled file into /etc/security/limits.d/audio.conf which is what I sort of expected.

Out of curiosity, I issued the command that @steeldriver did, and my system did show jackd1 instead of jackd2, so that all makes sense.

sudo debconf-show --listowners | grep jack
jackd1