In places where a connection is somewhat unreliable, it makes at times sense to download small packages first.

I was wondering if and how I could make dnf download packages from smallest to largest.

Forcing dnf to download one package at a time is easy with --setopt=max_parallel_downloads=1, but I couldn't find any setting to sort the download queue according to package size.

closed as unclear what you're asking by Rui F Ribeiro, msp9011, Jeff Schaller, schily, jimmij Aug 7 '18 at 19:44

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Even though you can find the size of the packages and pass that to dnf, what you are trying to do isn't possible because the packages can and will have dependencies which are larger than some of the packages which you are trying to install. That will throw off what you are trying to do. The only way to even begin to get around it would be to manually download each package and its dependencies one my one and then use dnf to install them. If you use dnf alone, it's going to install dependencies (for obvious reasons) regardless of their size. – Nasir Riley Aug 6 '18 at 12:10
  • 1
    @NasirRiley dnf resolves package dependencies prior to downloading. For instance when running dnf update all package dependencies will be resolved before downloading starts. Normally, dnf asks before downloading, too. After all, you can do --downloadonly, so all of downloading commences and stops after dependencies have been resolved, but before actual package application has started. – polemon Aug 6 '18 at 12:21
  • I understand that but it's not going to take file sizes into consideration when downloading the dependencies. If a dependency is needed then you're going to have to download and install it prior to doing so with the main packagr. It is for that very reason that what you are trying to do isn't possible. It it were then you wouldn't need to ask this question. – Nasir Riley Aug 6 '18 at 15:37
  • At some point, your unreliable connection will encounter the largest download and succeed or fail. I'm not clear on how sorting the download list changes this behavior (improves your odds of a successful download). – Jeff Schaller Aug 6 '18 at 19:20

The added complexity that you bring to the table does not make worth trying to install package by package (or small group of packages)

Depending on the size of the infra-structure, it might be worth:

  • Using a local mirror from your own country, where you have much better connectivity, if it exists;
  • using a generic proxy - Squid;
  • Having a specialized proxy for packages (satellite for RH derivate systems or apt-cacher-ng for Debian-based); in that way, only one machine does actually pull the package from the Internet and the other pull from the cache );
  • For bigger infra-structures, it might be work having a local repository mirror of the distribution.

In some Asian/African countries also connectivity quality to the outside/bad local DNSes can be mitigated using international VPN services. (quite long to explain the whys)

However, being things what they are, there are no miracles solving local bandwidth overprovisioning/exaustion, especially where wireless connections are involved and/or domestic connections.

TLDR You cannot bend the laws of Physics with Unix wizardry alone.

However, if talking about enterprise setups with dedicated/"better" connectivity, going the extra mile to setup a proper intra-structure and fine-tune network and systems configuration does help on getting a slightly better service. However, there are whole books written about the subject, and it is a overly broad subject to be on-topic here.

  • There is no enterprise thing here, it's more down to using rather spotty mobile connections. Especially things like LTE handover and "dark zones" is what I was getting at. I'll clarify in my question in a second. – polemon Aug 6 '18 at 12:55
  • No problem, everything above the last paragraph applies. If the underlying core service/customer infra-structure side delivery is spotty, there are no miracles. A bad limited connection is a bad connection, no matter how hard you try to improve it. There is absolutely no Unix wizardry that will dig you out of that hole. – Rui F Ribeiro Aug 6 '18 at 12:56
  • Nah, I don't plan to bend any rules. The idea is, that I can download some stuff while on a more or less choppy connection, and remain in an area with better connectivity, for the longer downloads, which might fail at some other time, making the rest of the downloads abort. Especially when doing dnf update, etc. – polemon Aug 6 '18 at 13:25
  • "bend rules" is a force of expression. As it is written, it mostly means you cannot push things past their physical limitations. – Rui F Ribeiro Aug 6 '18 at 13:40
  • Right, before we turn this into a deviating discussion pertaining to the usefulness, the basic question still stands: is it possible to change or influence the download queue of dnf? If so - how? – polemon Aug 6 '18 at 13:57

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