Skip to main content

apt-rdepends

This helps download apt dependencies and is pretty neat! I was on a pentest where the Ubuntu box we had did not have general Internet access and I needed to install the nfs-common package. I learned about apt download to download packages offline, but the problem was when I went to do sudo dpkg -i nfs-common.deb there were a bunch of dependencies that also needed to be installed.

Reading this page I learned about apt-rdepends.

Install apt-rdepends

sudo apt install apt-rdepends

Build an offline install package

In the case of nfs-common I tried this but had issues:

apt-get download $(apt-rdepends nfs-common|grep -v "^ ")
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Can't select candidate version from package debconf-2.0 as it has no candidate
E: Can't select candidate version from package mime-support as it has no candidate

Reading further into the StackOverflow article, I modified the command:

apt-get download $(apt-rdepends nfs-common|grep -v "^ "| grep -v "^debconf-2.0$" | grep -v "^mime-support$")

Back at my airgapped box, I was able to sudo dpkg -i for the rpcbind and keyutils packages that came from my apt-rdepends command, and once that was done, the install of nfs-common completed! Cool!