This question already has an answer here:

Similar questions have been asked already but none of them have solved my problem:

I need to install a package on a standalone Linux box, specifically kdbg. Now I tired the command

sudo apt-get install --download-only kdbg

on a box connected to the internet, but it only downloads the package and dependencies that I don't have installed. Some of those dependencies (that command downloaded 117 total packages) have sub dependencies, and those sub dependencies have even more dependencies and I'm going down a rabbit hole trying to fish those packages out of the repo.

Now I tried using a couple of other commands that supposedly will download all dependencies, even the ones I have installed. I've tried

  1. apt-get download PACKAGE && apt-cache depends -i PACKAGE | awk '/Depends:/ {print $2}' | xargs apt-get download


  1. apt-get download $(apt-rdepends <package>|grep -v "^ ").

Command one only downloads the direct dependencies, like the ones you'd find on packages.ubuntu.com if you were to search kdbg, and command two gives me the error message:

Can't select candidate version for package <package> as it has no candidate

for several different packages.

So, to restate my question, is there a way for me to download kdbg, all of its dependencies, all of those dependencies' dependencies, so on and so forth? Or perhaps I am using one of the above commands incorrectly?

Thanks in advance.

marked as duplicate by user535733, Eric Carvalho, user68186, N0rbert, Melebius May 11 '18 at 9:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Run apt install <package> --simulate on the offline machine to get the complete list of packages the offline machine needs. – user535733 May 8 '18 at 19:08
  • @user535733 Your right, standalone does mean not internet connected. I'm sorry that I bothered you about it. It's still not a duplicate of that question though. It's an "I want it to be a duplicate of that question even though it isn't a duplicate of it" question. – karel May 9 '18 at 11:17
  • I'm probably going to have to take this one to Meta and I'll probably lose in Meta because everyone believes that there is no such thing as a unique offline package management question. – karel May 9 '18 at 11:25

You need to run a command that automatically resolves all the .deb file's dependencies and installs the .deb file and its missing dependencies with the same command. You will need a working internet connection (which you have) and your installed software to be updated with sudo apt update && sudo apt upgrade to download any missing dependencies. Open the terminal and type:

sudo apt-get download package-name  
apt install --simulate ./package-name.deb # dry run doesn't install anything

where package-name should be replaced by the name of the package that you are trying to download and package-name.deb should be replaced by the name of the .deb file that you are trying to install.

The second command doesn't install anything, it's just a dry run simulation to list the dependencies that need to be installed on the offline machine.

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