Install packages, manage dependencies without Internet access

I just installed a fresh Waldorf on a desktop without Internet access. I'm trying to figure out how to work around dependencies problems when installing new packages.

Previously I was working with a Xubuntu 10.04 VM, and what I did when I needed some software was:

go to packages.ubuntu.com with a second desktop (one with Internet access)

download the .deb for that software, as well as the .deb for each of its dependencies

run

dpkg-scanpackages <download dir> /dev/null | gzip -9c > Packages.gz

transfer that folder (e.g. via USB key) into <some folder> on the first desktop

run

apt-get update

on that first desktop (<some folder> figures in my /etc/apt/sources.list)

run

apt-get install <package I actually need>

if I met any dependencies problems (i.e. some package from packages.ubuntu.com needs a newer version of a package that's already installed), go to launchpad.net and download an older version of that .deb

Now with Waldorf so far I used packages.debian.org, but trying to install openjdk-6-jre and its dependencies, apt choked on the following packages:

With Xubuntu, I'd just have gone to launchpad.net, found the older .deb and tried again, but here I'm not sure. Since Ubuntu is Debian-based, I guess I could find those older packages on launchpad.net, but I figured this would be a good time to actually think about my method and see if there's some cleaner way to manage packages and dependencies on a computer with no Internet access.

So yeah, if the method I described seems horribly dumb, it's probably because it is... And I'm willing to be taught how wrong I am :p

Re: Install packages, manage dependencies without Internet access

And then run apt-get update && apt-get upgrade? I've thought about that. I guess that could work (and actually be better from a security standpoint). I guess I did not want to try that because the amount of dependencies to fetch for one software is finite, while the amount of packages to upgrade when one starts needing an upgrade is... Well, I guess it's finite too, I'm just afraid I'll end up downloading the whole website.

Seriously though, this sounds like a good approach. Now before doing that (actually I won't have access to the computer before Monday, that's why I'm just sitting there pondering rather than actually doing something), say I have two entries in my /etc/apt/sources.list, one for this folder where I copy stuff I downloaded on another computer, and one for the LiveCD on which I can find some packages.

If the folder has newer versions of packages that are also available (but older) on the CD, and I run apt-get upgrade, is apt going to go "Oh hey this folder has newer versions of packages I have installed, might as well install them", or will it go "Woah hey wait I have two versions of the same packages what the heck should I do with those" ?

Re: Install packages, manage dependencies without Internet access

Peniblec, your approach seems overly complicated.why don't you just install the .deb's with dpkg or gdebi?of course you have to start with the dependencies.

you should also know that crunchbang is based on debian stable.it is, as the name says, rather stable, but some apps are using old versions.

there is also debian testing and unstable; i think ubuntu was originally based on debian testing, but has morphed far away from it. do not use ubuntu packages.

if you are trying to install an application with a higher version than what is in stable, you are likely to go into "dependency hell".there are ways around that, but if you don't necessarily need that newest version, it's better to install an older version.

basically, installing apps offline is no different than online, you just have to provide your system with everything it asks for.

i would remove your additions to /etc/apt/sources.list and just install the packages "manually" with dpkg -i or gdebi.

you can search packages.debian only for packages in stable, which is wheezy iirc, and it also lists all dependencies for a certain package, with links, so you can download everything very conveniently, then move it to your other computer and install.i have done that myself many times.

Re: Install packages, manage dependencies without Internet access

@ohnonot:I actually started using dpkg -i, basically the same way I'm using apt-get now, until I found this "add local folder to sources.list" trick. It does seem overly complicated, but I figured it looked "cleaner" somehow. Probably isn't.

The problem even with stable .deb's on packages.debian is that some of them need newer versions of packages already installed on the system. For example, take this package, it's wheezy, it's stable, yet it needs tzdata (= 2014a-0wheezy1). On a fresh Waldorf install, 2013b-2 is installed. So it's not me wanting the newest version, it's just the stable packages from the website being newer than those on a LiveCD from 2013

Thanks for the suggestions, I'll have a look on Monday and let you know how it went.

Re: Install packages, manage dependencies without Internet access

Peniblec wrote:

The problem even with stable .deb's on packages.debian is that some of them need newer versions of packages already installed on the system. For example, take this package, it's wheezy, it's stable, yet it needs tzdata (= 2014a-0wheezy1). On a fresh Waldorf install, 2013b-2 is installed. So it's not me wanting the newest version, it's just the stable packages from the website being newer than those on a LiveCD from 2013

yes.of course you have to update your linux operating system after you install, and before you install anything else.have you done that at all before this whole rigmarole started?oh i forgot you haven't got internet access...

in that case (and if there's no way to hook the machine to the net even temporarily) the rigmarole is your only choice.as alad said earlier: "Yep, gdebi. Gdebi solves dependencies, dpkg doesn't ... so work your way down until it installs."

anyhow, i have 100% trust in how debian deducts dependencies on their branches, so if apt says that's the dependency, then that is the dependency and it is also possible to install it. and the packages.debian sites are an exact mirror of how apt works.

debian don't maintain their wiki's very well, but they do maintain packages.

Re: Install packages, manage dependencies without Internet access

ohnonot wrote:

you have to update your linux operating system after you install, and before you install anything else.have you done that at all before this whole rigmarole started?oh i forgot you haven't got internet access...

in that case (and if there's no way to hook the machine to the net even temporarily) the rigmarole is your only choice.

...to repeat, apt-offline is made to do this. I've used it myself to upgrade the system then install more packages on a box that was out in the sticks, totally offline. It needs two or three back-and-forth trips with usb sticks, but it's quite easy - check that tutorial.

Re: Install packages, manage dependencies without Internet access

Thanks for your answers. I took a quick look at apt-offline but I assumed (wrongly) that I needed a second Linux with Internet access to process the signature generated by my disconnected PC. I only found out just now that it also runs on Windows; I'll be sure to try when I run into deeper dependencies-related problems.

For now I've simply downloaded the newer version of the outdated packages and run apt-get upgrade ; turns out those two packages could be updated without running into Dependency Hell.

Re: Install packages, manage dependencies without Internet access

Sorry if I wasn't clear. What I actually did was closer to what damo suggested in this thread's first reply: (the "solution" begins at 6., everything before is a recall of the situation before you guys came to the rescue)

I needed openjdk-6-jre, so I went to packages.debian.org with a second computer running Windows, found the stable (wheezy) version, and I downloaded the .deb;

for all the dependencies displayed on the web page, I ran "apt-get install" on the disconnected computer: if it failed to install/was not already installed, I downloaded the .deb from the website;

(did that recursively for all dependencies)

I transferred everything via USB key to <some folder> on the disconnected computer;

(<some folder> figures in /etc/apt/sources.list)

(also ran "dpkg-scanpackages | gzip" on <some folder>)

I ran "apt-get update ; apt-get install openjdk-6-jre";

Cue the apt error I reported in my first post, and me being stuck;

I looked at apt-offline, focused on how it works, missed that it also worked on Windows;

I returned to packages.debian.org and downloaded the stable version for the two packages apt was complaining about;

(repeat USB transfer/dpkg-scanpackages)

(cue me crossing fingers hoping not to run into Dep Hell)

I ran "apt-get update && apt-get upgrade": apt recognized the downloaded .deb's as being newer and upgraded the packages, no questions asked, no outdated dependencies;