Hi. This isn't a "bug", but a question/feature request. To speed up package installs in schroots (both with sbuild and without) I usually add /var/cache/apt/archives to the set of bind-mounts in the fstab of most profiles. This creates a global package cache, which saves lots of time and bandwidth. Is there a strong reason to not do this by default? If not for sbuild, then maybe we can do this for the other profiles. Or if not even that, we can add a commented-out line to the fstab files to make it easy for users to turn that on. I can give you a patch once we decide what is appropriate. Thanks!
Dima Kogan wrote...
While not completely against it, I'm somewhat reluctant to promote this
trick that I'd rather call a dirty hack.
The issues I see with this poor man's caching boil down to these two
points:
First, this cache never expires hence will fill up disk without limits.
And second, any job in the schroot session that does "apt clean" will
happily wipe the cache for everybody, even for other processes in other
sessions that want to use it that very moment, leading to very strange
errors - there must be a reason why you cannot "apt clean" while an "apt
update" is running.
To overcome these, I could think of another service that watches that
cache directory (inotify-based perhaps), makes files immutable once
completely downloaded (so "apt clean" has no effect), and possibly
expires older files using some scheme - but only if no session is
currently running.
At that point I'd rather suggest to refer to some existing
caching proxy implementation, to name a few without making a particular
recommendation: squid with some extra config snippets, approx,
apt-cacher-ng. And modify the chroot's apt configuration to use that
one. That will not see the same performance, but it's robust and well-
established.
All the best,
Christoph
Hi. Thanks for replying. I don't disagree with anything you said, but I still think this would be good at least as a commented-out-by-default bit of config. In my day-to-day use of the machine I routinely use /var/cache/apt/archives to, for instance, access the previouly-installed packages; older versions perhaps. This cache is always there, and I don't manage it. 99% of the time the packages I want are there. Extending this idea to schroots doesn't seem unreasonable, even if there are corner cases that would make it not perfectly-nice in 100% of cases. If I propose a patch to add this as a commented-out-by-default option in the config, with your concerns placed in a comment, would yall accept it? Thanks
Christoph Biebl wrote: Please don't add this. Sharing the apt cache between builds leads to hard to diagnose build failures and/or even mis-builds. Running a local apt proxy is easy to do, well supported, and generally just works. Chris