4

I'm trying to download APT and all it's dependencies so I can use dpkg to install APT offline. Since you can't simply use apt-get download apt the approach I've taken is trying to generate a list of dependencies which I can then manually use apt-get download package-name to retrieve.

I've tried these:

apt-cache showpkg package-name

apt-cache depends packagename

dpkg -I pkg-name1_version.deb

They don't work properly. I need a way to list not only the dependencies of APT, but also the dependency dependencies; the entire tree. According to "sudo apt-get install apt --reinstall" APT has 302 depenencies+sub-depenencies. The lists generated using the answers I've found appear only to list the first level of dependencies, because they are too short.

1

4 Answers 4

2

Either I am gravely mistaken, or there's something fundamentally wrong with apt having 302 dependencies + sub-dependencies. How can any distribution claim to lightweight if it depends on apt, then? At least, in my laptop, reinstalling apt doesn't mention any dependencies at all, so I am not sure where you got that figure from. I cooked up a script to check. On Ubuntu 14.04, I get 24 dependencies:

dpkg gcc-4.8-base gcc-4.9-base gnupg gpgv install-info libacl1 libapt-pkg4.12 libattr1 libbz2-1.0 libc6 libgcc1 liblzma5 libpcre3 libreadline6 libselinux1 libstdc++6 libtinfo5 libusb-0.1-4 multiarch-support readline-common tar ubuntu-keyring zlib1g

I then learned about apt-rdepends: http://xmodulo.com/2013/07/how-to-check-package-dependencies-on-ubuntu-or-debian.html

I installed and ran it, filtered the dependencies, sorted and compared to find the same list I got with the script. So I can safely conclude that these are all the packages you need to install apt. I think one of those gcc-4.[89] can be ignored depending on which one you want to install. Note that this list has trimmed down from Ubuntu 12.04, on which running this script (on a server) gave me 28 dependencies:

coreutils debconf dpkg gcc-4.6-base gnupg gpgv install-info libacl1 libapt-pkg4.12 libattr1 libbz2-1.0 libc6 libc-bin libgcc1 liblzma5 libreadline6 libselinux1 libstdc++6 libtinfo5 libusb-0.1-4 multiarch-support perl-base readline-common tar tzdata ubuntu-keyring xz-utils zlib1g

Presumably the packages have been trimmed down. The lack of dependency on coreutils and debconf is startling, I must say.

On a side note, I agree with this bug given in apt-rdepends man page:

  apt-rdepends exists.  This functionality should really reside in apt-
   cache itself.

The apt-cache tool provides four relevant commands that Braiam, unorthodox-grammar and I have discussed:

  • depends: List the (forward) dependencies. This also includes all the packages that are recommended, and also includes packages in the Breaks, Conflicts and Replaces sections. We just need to look at the Depends and Pre-Depends packages.
  • rdepends: There's an unfortunate naming clash with apt-rdepends. Both apt-rdepends and my aforementioned script check for dependencies recursively, whereas the apt-cache command is looking for reverse dependencies - packages which depend on the package in consideration. Use this command to check for potentially breakages caused by a package depending on a specific version of the one you are going got change.
  • showsrc: This command gives information about the source package that was use to build a package. A single source package can be used to build multiple binary packages - each of which may or may not depend on the others. apt, for example, depends on libapt-pkg, but not on libapt-inst, both of which are provided by the apt source package. Use this command to gain some insight into other packages you should install, which may not be dependencies, but which may be needed for greater utility,
  • showpkg: This command, among other things, lists both reverse and forward dependencies. The reverse dependencies are listed in a straightforward list, but the forward ones are a bit of a jumble - I still am not sure what the numbers mean. In any case, the individual commands depends and rdepends are clearer.

Thus, if we need to look at all the packages that a package might depend on directly or indirectly, apt-rdepends is what we need.

5
  • 1
    "<code>apt-rdepends apt</code>" gives me 28 packages, "<code>apt-cache rdepends apt</code>" gives me 54 packages, and @Braiam's suggestion about "<code>apt-cache showsrc apt</code>" lists "libapt-inst1.5" while neither of the above do. Every tool seems to have a different opinion??? Jul 7, 2014 at 4:12
  • apt-cache rdepends is looking for Reverse dependencies, my script and apt-rdepends are recursively looking for dependencies. libapt-inst1.5 is a package provided by the source package apt, which is different from the binary package apt. apt binary package may or may not depend on anything else provided by the apt source package (it depends on at least one). Thus, it is a sibling in the dependency relationship, not a parent or a child. That said, you should install the four packages mentioned by @Braiam, using apt-rdepends to find the dependencies of all four.
    – muru
    Jul 7, 2014 at 4:19
  • @unorthodoxgrammar see packages.ubuntu.com/source/precise/apt for the source package and a list of binary packages compiled from it. You can probably use the source packages and its build-depends to build the packages on the target system.
    – muru
    Jul 7, 2014 at 4:23
  • "apt-cache showpkg apt" lists packages that aren't in the previous methods. Jul 7, 2014 at 4:28
  • 1
    @unorthodoxgrammar showpkg lists all the packages listed by depends and rdepends. You can immediately tell which ones are the reverse dependencies. The dependencies list includes suggests, recommends, breaks and conflicts packages as well, using numbers in the parenthesis to indicate the status, which are listed in a much cleaner way in depends , so that you can filter out the unnecessary bits. It doesn't add any new information that I can see.
    – muru
    Jul 7, 2014 at 12:07
2

There are only 4 packages which you should to be preoccupated with: libapt-pkg4.12, apt-utils, libapt-inst1.5 and apt. The other dependencies to the apt packages are standard to all installations of Ubuntu. Why do I say only those 4 packages?

apt-cache showsrc apt
[...]
Package-List: 
 apt deb admin important arch=any
 apt-doc deb doc optional arch=all
 apt-transport-https deb admin optional arch=any
 apt-utils deb admin important arch=any
 libapt-inst1.5 deb libs important arch=any
 libapt-pkg-dev deb libdevel optional arch=any
 libapt-pkg-doc deb doc optional arch=all
 libapt-pkg4.12 deb libs important arch=any

As you can see, the only packages that really comes from apt sources and are important are those.

Through the libapt-pkg4.12 package is pretty stable (there isn't right now a version on experimental, through all other packages have a new version) is recommended that you install them all together.

Also remember that product of this upgrade, you may break reverse dependencies to all those packages. First do apt-cache rdepends libapt-pkg4.12 apt-utils libapt-inst1.5 apt and check for any package that depends on a specific version of apt.

1

You can use Cube in that case. Cube downloads apps and all of its dependencies, and you can set whether to use apt-get or dpkg in installing them. Just select dpkg as default installer instead of apt-get in "Settings=>Preferences=>Installer Tab"

Check this tutorial to know more : http://community.linuxmint.com/tutorial/view/1583

1

Xubuntu includes in the base installation apt-offline to get around this situation provided you already have apt in place. It determines what dependencies need to be downloaded and maps it out so that you do not have issues handling such download bundles. The online documentation set contains a chapter on how to use the tool.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .