I am trying to download the 64-bit Ubuntu 12.10 ISO over an extremely unreliable connection. By unreliable, I mean that every time I finish downloading the ISO and compare the MD5 hashes, I end up with an error about a mismatch.

I am using Ubuntu 12.04 to perform the download. Is there a tool that can somehow work around a very unreliable connection?

2 Answers
2

In my case my connection drops a lot and if trying to download the ISO directly I also end with a MD5 problem. What I recommend is downloading the ISO image through a torrent client.

That way, even while downloading, the torrent client checks to make sure it is OK. There is a good list of torrents to use but if you are in Windows or Mac, I suggest UTorrent. If you are doing this from an Ubuntu installed computer, Ubuntu comes with a default torrent client called Transmission .

You'll probably want to know how zsync works in order to decide whether or not you want to obtain and use it, so I'll explain how it works first, and then how to obtain it.

How to Use zsync to Download an Ubuntu ISO Image

zsync lets you build one file by starting with another. You can start with any file, but to offer any advantage over simply downloading the file you need, the file you start with should be similar to the file you want.

zsync only works for files whose providers have created a .zsync metafile. A .zsync file contains checksums for sections of a file, and enables the zsync utility to figure out what parts of the file you already have match, and what parts do not. Parts that do not match are downloaded again. (Actually, zsync is a bit more sophisticated--it is also able to handle situations where some parts match but are in different places in the file, without having to redownload those matching parts. That particular feature is not frequently helpful in creating a good file from a corrupt download, however.)

Once you have a (corrupted) ISO image downloaded somewhere, open a Terminal or (for Windows) Command Prompt (cmd.exe) and navigate to its location. In most OSes you can type cd with a space at the end and then drag a folder to the command line, and the location of the folder will be pasted. Then you can press enter and it will Change Directory to that location. (cd should be lower case--on some systems, like Windows, upper-case will work, but on other systems, like OS X and Ubuntu, it will not.)

Once you're in the folder that has the file--running ls or dir should show you everything in there, and running ls *.iso or dir *.iso should show you just files that end in .iso, which includes Ubuntu installation images--then run:

zsync URL-to-.zsync-fileUbuntu-iso-image-name.iso

That will patch up the corrupted file you have (named like Ubuntu-iso-image-name.iso--for example, it may be called ubuntu-12.10-desktop-i386.iso) to be correct. If you run it and no changes are made, that means your file is correct. zsync incorporates checksums, so you can be sure you have a complete, correct file if it says you do.

To learn precisely how to obtain .zsync on multiple platforms, and how to run it for each Ubuntu ISO image, read on.

Getting the zsync Utility

I've written about getting and using zsync to fix corrupted ISO images before, in a different context. It was in a longer answer most of which is not related to this question here. So I've excerpted the parts of it that are related.

Getting zsync for Windows

zsync is a command-line program, so in Windows you run it in the
Command Prompt. (One way to open the command-prompt is to type
cmd.exe into the text box in the Start menu and press
Enter. Or, in Windows XP and earlier, Start > Run >
cmd.exe.)

Another Way: Getting zsync for Cygwin

If you have any problems with the Windows port of zsync, you can
always use the Cygwin version. Cygwin provides a Unix-like environment
for Windows. It does not allow compiled executables to be run (for
example, you could not use zsync from the Ubuntu package), but uses
special versions of programs compiled for it from source. (It is far
easier to compile a program written for Unix-like operating systems in
Cygwin, than to compile it so it works natively on Windows.)

Run it, click Next on the first screen, then select Install from Internet and click Next again.

On the next two screens, put Cygwin and the local package directory wherever you like them (defaults are usually good).

Select your Internet connection type (Direct Connection is usually good), and setup.exe will download a list of mirrors.

Pick any mirror, and it will download a list of available packages. You'll probably be warned about how this version is different from the
previous one. That's not a problem, unless you've been using a
previous version of Cygwin on the same machine.

Now you can select what packages to install. There is a text box for searching packages by name. Type zsync there (but do not press
Enter--if you do, it's like clicking Next). An entry for
Net will appear. Expand it by clicking the + to the left of it and you'll see Skip appear under it. That means if you don't
change anything, setup.exe will not install zsync.

So click once, where it says Skip. Now it will install the latest available stable version of zsync for Cygwin.

Click Next again to finish the installation. The Cygwin environment, and zsync, will be downloaded and installed. (If you're
asked to install packages that are required as dependencies, go ahead
and do so.)

Once it's installed, open the Cygwin shell. You can run zsync from
there.

Please note that while you can post on the Cygwin mailing list
for problems with Cygwin (after reading that and the materials it
tells you to read), they understandably do not support unofficial
instructions. cygwin has quite good documentation, so like other
projects with good centralized documentation (like OpenBSD), they
expect that people asking for help will have read the documentation
and are working from (or at least very familiar with) it.

(Therefore, if you have trouble with my instructions, the best place
to ask about them is probably here.)

zsync on Ubuntu

This doesn't apply in your specific case, but for folks who want to
use zsync on Ubuntu, just install zsync .
This can be done in the Software Center or by running this in a
Terminal window (Ctrl+Alt+T):

Writing zsync Commands for Other (and Future) Ubuntu .iso Images

The general syntax is that you run zsync followed by a complete URL
for the .zsync file on the server that has the same name as the file
you have a version of and wish to download (except with .zsync at
the end of course).

In case anyone wants to do this for any other Ubuntu releases (or
other ISO files for the same release, like the version optimized for
booting properly on Macs or the version for ARM-based mobile devices)
here's the rule for where the .zsync files are located:

ISO images containing currently supported installers, including ISO's for the latest point release of LTS releases and all ISO's for
currently supported LTS releases, are located in:

While it is considerably broader than this (and I do not recommend that they be considered duplicates!), if you're interested you might want to take a look at the question that originally led me to write most of the text here (i.e., the text enclosed in blockquotes):