Local package cache? #42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi!
debootstraphas an option to cache downloaded packages:--cache-dir=/var/cache/apt/archivesThis caches downloaded packages on the host (not in the "guest"), which speeds up consecutive bootstrap runs.
Does
mmdebstraphas some way to achieve a similar effect?What the debootstrap
--cache-diroption does is a layer violation. You have at least two options to do something similar in mmdebstrap:If you go the first route, feel free to share your scripts. If they are general-purpose enough I can include them in the
hooksdirectory so that others can make use of them as well.Hm, instead of copy-in and copy-out, I would just bind-mount the directory. But then it has to be unmounted if the process is interrupted due to an error or a SIGINT. Oh, I see the docs; if at some point it installs everything in that directory, then this wouldn't work...
OK, that's fine, I was just wondering if there is already a solution I couldn't find. (Maybe the
--cache-diroption should be added to the list of "debootstrap options that don't exist" in the readme file?)No, mmdebstrap creates its own mount namespace, so everything gets unmounted automatically even if you should forget to unmount or if the process dies early. Have a look in
/usr/share/mmdebstrap/hooks/file-mirror-automountfor inspiration how an externalfile://repository can be auto-mounted.Also, you really should not mess with
/var/lib/apt/archives. That directory is an implementation detail of apt and only apt should operate on it.The best solution is really to set up a local apt proxy. There are various solutions to that problem so mmdebstrap does not have to add its own thing.
I'm fighting with the same problem... oh wait, it was me who opened this in the first place. 😄
I gave up before, but now I want ti try again. The goal is to cache packages so that they are not downloaded on consequent invocations.
--setup-hookto bind-mount a directory into/var/lib/apt/archives.--skip=cleanup/aptto its arguments.--aptopt='APT::Keep-Downloaded-Packages true'and--aptopt='Binary::apt::APT::Keep-Downloaded-Packages true'for good measure, so that apt definitely, absolutely, never removes packages.What behaviour do I observe:
I: downloading packages with apt...- downloads ~25M worth of packages into/var/lib/apt/archivesI: extracting archives...I: installing essential packages...I: installing remaining packages inside the chroot...- no, it's not "installing", it's "downloading" ~25M more of different packages. And these are not deleted! And the next time, they are not re-downloading - they are correctly picked up.So, the question is: how can I prevent deleting and re-downloading those first files every time? I guess they are downloaded "differently" in some way?
UPDATE: I've read the docs before, but only now that I'm reading them again in more detail, I see the
--skip=essential/unlinkflag. 🥲