On Thu, 29 Jan 2026, [email protected] wrote:

(I am completely new to Linux besides basic stuff with proot-distro on Termux 
on Android): I simply want to take a text file I have made of specified Debian 
packages I want for my local repository (one for AMD64, the other for ARM64), 
and download those packages as well as their depends, predepends recursively, 
and whatever other packages that would have been installed with “apt install”. 
“apt install --download only” will miss packages that are already installed 
right? So that leaves me with making a list using “apt-cache depends” or the 
apt-rdepends package , but the apt-rdepends package doesn't show virtual 
packages, apt-cache depends does but does not resolved the virtual package with 
what apt install would've defaulted to resolving to. Then, if I try to target a 
different architecture, first adding with dpkg --add-architecture command then 
apt update, I can list other packages, but apt-rdepends only lists the 
specified architecture for first set of depende!
ncies and after tries to recurse with current native architecture packages; apt-cache depends will work 
if typing “package:<arch>” but for some reason will include duplicates of certain packages where 
one will have the ending :<arch> and the other will not, and for the native architecture 
packages, now apt-cache depends will show both the unmarked native packages and some :<arch> 
marked packages of the foreign architecture along with it. Modifying sources.list for [ 
arch=<arch> ] fixes only when looking up native packages, but the foreign architecture packages 
still do that weird duplicate thing.

How on earth can I just simply download a list of packages and all their base 
needed packages like how apt install would have while ALSO including already 
installed packages in the downloading process.

I thank whoever can help me. I just want this ONE thing before I truly start my 
Linux adventure.

I do this this way:

  APT_CONFIG=${APT_CONFIG} \
  DEBIAN_FRONTEND=noninteractive \
    apt-get -q -y --allow-unauthenticated install -d \
        -o APT::Install-Recommends=false \
      "$@"

Where apt-config is setup like this:
  cat <<CATEOF >"${APT_CONFIG}"
APT::Architecture "${ARCH}";
APT::Install-Recommends "false";
APT::Get::AllowUnauthenticated "${expired_key}";
Acquire::AllowInsecureRepositories "${expired_key}";
Acquire::Check-Valid-Until "true";
Acquire::http::Proxy "http://localhost:3128/";;

Dir::Etc::PreferencesParts "${APT_WORK}/preferences.d";
Dir::Etc::SourceParts "${APT_WORK}/sources.list.d";
Dir::Etc::TrustedParts "${aptdir}/trusted.d";
Dir::Etc::Parts "${aptdir}/conf.d";

Dir::State::Lists "${APT_WORK}/lists";
Dir::State::Status "${APT_WORK}/status";
Dir::Cache::Archives "${APT_WORK}/archives";
Dir::Cache::srcpkgcache "${APT_WORK}/srcpkgcache";
Dir::Cache::pkgcache "${APT_WORK}/pkgcache";
CATEOF

You'll need to create the directories, and populate a sources.list or two, but then apt will see a completely empty directory and download everything (except essential packages which aren't depended on).

For the essential package I have a separate package that depends on them for exactly this purpose.

This, along with a lot of extra stuff, can be found here:
https://sourceforge.net/projects/dbootstrap/

have a look at build-tarfiles.sh

Reply via email to