2

I have a Debian wheezy server which has many sources configured under /etc/apt

There's seems to be a lot of duplicate sources, and I would like to simplify this. In order to avoid breaking anything, and miss any package upgrades, I don't want to remove any sources which are the only available source of a package.

I know that I can see the source of packages for which there are upgrades available, by using

apt-get upgrade --just-print

How can I list the sources of all installed packages?

  • have a look at dpkg-query --showformat flag – Dan Apr 14 '16 at 16:34
1

Good question. As far as I know there is no way to find out where a package was installed from after you removed the deb-line from you sources.list-file.

The only way to save all the sources would look something like this:

% grep -h -e "^.*deb " /etc/apt/sources.list /etc/apt/sources.list.d/* | sort | uniq
deb http://apt.spideroak.com/ubuntu-spideroak-hardy/ release restricted
deb http://APT.spideroak.com/ubuntu-spideroak-hardy/ release restricted
deb     http://deb.grml.org/ grml-stable  main
deb http://debian.lagis.at/debian/ jessie main contrib non-free
deb http://debian.lagis.at/debian/ jessie-updates main contrib non-free
deb http://download.virtualbox.org/virtualbox/debian jessie contrib
deb http://extra.linuxmint.com betsy main
deb http://http.debian.net/debian jessie-backports main
deb     http://http.debian.net/debian stretch main contrib non-free
deb http://mirror.karneval.cz/pub/linux/linuxmint/packages betsy main upstream import 
deb http://repo.linrunner.de/debian jessie main
deb http://repository.spotify.com stable non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://www.deb-multimedia.org jessie main non-free

To verify my statement I tried this:

% apt-cache policy | sed -n -e "/^.[0-9]/p" | cut -f3,4 -d' ' | sort | uniq
http://apt.spideroak.com/ubuntu-spideroak-hardy/ release/restricted
http://APT.spideroak.com/ubuntu-spideroak-hardy/ release/restricted
http://deb.grml.org/ grml-stable/main
http://debian.lagis.at/debian/ jessie/contrib
http://debian.lagis.at/debian/ jessie/main
http://debian.lagis.at/debian/ jessie/non-free
http://debian.lagis.at/debian/ jessie-updates/contrib
http://debian.lagis.at/debian/ jessie-updates/main
http://debian.lagis.at/debian/ jessie-updates/non-free
http://download.virtualbox.org/virtualbox/debian/ jessie/contrib
http://extra.linuxmint.com/ betsy/main
http://http.debian.net/debian/ jessie-backports/main
http://mirror.karneval.cz/pub/linux/linuxmint/packages/ betsy/import
http://mirror.karneval.cz/pub/linux/linuxmint/packages/ betsy/main
http://mirror.karneval.cz/pub/linux/linuxmint/packages/ betsy/upstream
http://repo.linrunner.de/debian/ jessie/main
http://repository.spotify.com/ stable/non-free
http://security.debian.org/ jessie/updates/contrib
http://security.debian.org/ jessie/updates/main
http://security.debian.org/ jessie/updates/non-free
http://www.deb-multimedia.org/ jessie/main
http://www.deb-multimedia.org/ jessie/non-free
/var/lib/dpkg/status

which basically is the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.