DebTorrent/ FAQ
  1. Installing
    1. What packages do I need?
    2. Does DebTorrent require testing/unstable to work?
    3. Does it matter which Debian mirror I use?
    4. Will DebTorrent work with other distributions/Ubuntu?
    5. What about apt-torrent, how do the 2 compare?
  2. Downloading
    1. Will DebTorrent download all the packages in the archive?
    2. What happens if there's no peer that has the package I want?
  3. Port Forwarding
    1. Do I need to forward ports?
    2. What ports should I forward?
    3. How many ports should I forward? Do I need to forward more than 1?
    4. How do I forward ports?
  4. Hosting a Repository
    1. Do I need to do anything special?
    2. Can I only offer packages via DebTorrent?
  5. Troubleshooting
    1. Installing a package fails? No torrents are running?
    2. Installing a large package fails with the error "Connection Failed" or "Connection timed out"?
    3. An apt-get update is stuck saying "Waiting for headers"?
    4. I got errors trying to download from experimental?

Installing

What packages do I need?

All you need to get started is the [[debtorrent package|Install]]. To improve the communication with APT, you may also want to install the apt-transport-debtorrent package (and maybe even a patched version of APT, find out why).

Does DebTorrent require testing/unstable to work?

No. You can download the debtorrent package and install it in any Debian version that has Python 2.3 or newer. The dependencies of apt-transport-debtorrent would make it hard to install in etch (but it's not required anyway).

Does it matter which Debian mirror I use?

No, you should be able to use any official mirror listed for Debian. The torrents created by DebTorrent depend only on the content that is on the mirror. If your mirror is reasonably up to date, it will have the same content as all the other mirrors, and so your torrent will be the same as all the other peers' torrents.

Will DebTorrent work with other distributions/Ubuntu?

Yes, (I think) but not very well (yet). The current DebTorrent uses some additional information that is not yet stored in the Debian archive Packages files. This information allows DebTorrent to break up large files into multiple pieces, as otherwise every file will be a single (possibly very large) piece. Not having this information will reduce the effectiveness of the downloading of DebTorrent. Eventually, this information will be added to the Packages files, so that anyone hosting a Debian-type archive will be able to efficiently use DebTorrent.

What about apt-torrent, how do the 2 compare?

DebTorrent is quite different from apt-torrent, and (I think) better. The problem with apt-torrent's implementation is that it requires a torrent file for every package downloaded. This is inefficient, as most packages files are quite small (a single piece torrent makes little sense), there are a large number of packages (each torrent adds overhead), and communication between torrents is not possible (one client will have multiple connections to another). Because of these limitations, apt-torrent currently only supports downloading the 100 largest packages in the archive, while DebTorrent supports the entire archive.

DebTorrent creates a torrent per "Packages" file, so most of the packages you download will come from the same torrent (e.g. the unstablemainbinary-i386 torrent). This reduces the overhead and allows for clients to make good use of the tit-for-tat incentive mechanism built into bittorrent (i.e. I gave you your package now you give me mine).

I'm not bashing apt-torrent, it's just based on an unmodified BitTorrent client, and BitTorrent was not created for this type of sharing. That is why DebTorrent is based on a modified BitTorrent client to make it more suitable for this type of application.


Downloading

Will DebTorrent download all the packages in the archive?

From version 0.1.2 on, DebTorrent listens for requests from APT for packages to download. When you do an apt-get install foo, APT will send a request for foo to DebTorrent, which will download that package only. Once that package is complete, DebTorrent will stop downloading (but will continue to upload foo and any others to peers).

What happens if there's no peer that has the package I want?

DebTorrent has a backup download method built into it that will use an HTTP mirror to download the file. This method will only be used if no peers can be found that have the file.


Port Forwarding

Do I need to forward ports?

As with any peer-to-peer software, port forwarding is not required, but will considerably improve your download and upload abilities. Therefore, port forwarding is recommended.

What ports should I forward?

The ports the DebTorrent client listens on are configurable in the config file: /etc/debtorrent/debtorrent-client.conf. You can specify a range using the minport and maxport options, and how that range is used using the random_port option.

How many ports should I forward? Do I need to forward more than 1?

The Debtorrent client uses a single port to handle connections for multiple torrent downloads. However, if you specify only a single port (by making minport and maxport the same), and that port isn't available at startup time, then the client will fail to start. The port could be unavailable due to a previous instance of the program not shutting down cleanly, or another program randomly using the port you picked. It is recommended that you forward a small number of ports (2 to 5) to avoid this situation.

How do I forward ports?

It depends on your router. The Wikipedia page recommends this site for HowTos, and this one for testing.


Hosting a Repository

Do I need to do anything special?

Not really. DebTorrent builds on the HTTP repository idea that is used extensively in Debian. There are many packages available that make setting up a repository quite easy. For example: reprepro and debmirror.

Once you have an HTTP repository, you can ask that your users install DebTorrent and change their sources.list files as described in Install.

Can I only offer packages via DebTorrent?

At this point, DebTorrent usually requires an HTTP mirror to be available, which prevents the need for having seeds (packages which can't be found in peers are downloaded using HTTP from the mirror).

If you want to only allow DebTorrent users to download from your HTTP mirror, you could deny access to all but the DebTorrent user-agent. Here are some instructions to do this in apache. It's not completely reliable, but should prevent most people from accessing your mirror directly. The user-agent DebTorrent uses is something like: DebTorrent/T-0.1.4.1.

If you're not willing to setup an HTTP mirror, you need to make sure there's always a peer connected that has all the packages (a seed), and is accessible to all downloading peers. That could be quite difficult, as if there are more than about 50 peers, there's no guarantee that your seed will be connected to all of them.


Troubleshooting

Installing a package fails? No torrents are running?

First, make sure there are torrents running. To start them you should have done an apt-get update at some point since installing DebTorrent. Go to http://localhost:9988/ (replacing localhost with the host that is running the DebTorrent client, and 9988 with the port that you use) to see which torrents are running. If none are, you need to do an apt-get update after updating your sources.list file to use DebTorrent. If the proper torrent's are running, then file a bug (see BugReporting)

Installing a large package fails with the error "Connection Failed" or "Connection timed out"?

This is a known problem, which results from the random order of BitTorrent downloads. Therefore, the file can't be started to be passed to aptitude/apt until the download is complete. In the case of large files or slow connections this delay may cause aptitude/apt to time out and think that the download is broken.

Possible Workarounds:

  1. After apt times out, wait for the download to complete (monitor it at http://localhost:9988), then tell apt to try again since the file is now available locally.

  2. Install the apt-transport-debtorrent package and use debtorrent:// type URLs in your sources.list file instead of http://. The debtorrent transport has longer timeouts (defaults to 300) and will pass files out of order in the case of multiple file downloads rather than waiting for that one large file to download.

  3. Increase the timeout by putting Acquire::http::Timeout "600"; (or Acquire::debtorrent::Timeout "600"; in the case of the debtorrent:// transport) in your apt.conf file. Increase 600 (its in seconds) appropriately.

Probably the best is to use (2) first, then (3) if you still have problems, all the while using (1) to get around the individual failures that occur. Long-term solutions are being worked on.

An apt-get update is stuck saying "Waiting for headers"?

Wait a bit to make sure it's actually stuck. The DebTorrent downloads occur sequentially and can be quite slow. They also give no indication of the status of their download, so be patient.

If, after waiting a while nothing happens, or APT times out and says an error occurred, you may want to try enabling debugging in APT to determine which download is timing out (it may not be a DebTorrent download, but just a stalled download from a slow mirror). See BugReporting for how to enable debugging in APT.

I got errors trying to download from experimental?

The experimental suite is not currently supported by DebTorrent, and it is not recommended that you use DebTorrent to download packages from it. It may work fine for you, but it is untested. Future versions may have support for it, but it is not a high priority feature.