From: Henning Schild <henning.schild@siemens.com>
To: "Moessbauer, Felix (T CED INW-CN)" <felix.moessbauer@siemens.com>
Cc: "ubely@ilbers.de" <ubely@ilbers.de>,
"isar-users@googlegroups.com" <isar-users@googlegroups.com>,
"Kiszka, Jan (T CED)" <jan.kiszka@siemens.com>
Subject: Re: [PATCH v3 0/5] Improving apt cache
Date: Mon, 30 Jan 2023 11:45:04 +0100 [thread overview]
Message-ID: <20230130114504.51e78b03@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <cac52c2157515ae646f5a04a80a3d77beeb11104.camel@siemens.com>
Am Mon, 30 Jan 2023 09:45:45 +0100
schrieb "Moessbauer, Felix (T CED INW-CN)"
<felix.moessbauer@siemens.com>:
> On Fri, 2023-01-20 at 08:31 +0100, Uladzimir Bely wrote:
> > Currently, apt cache (e.g. `var/cache/apt/archives`) import and
> > export
> > functions are not optimal. Multiple files are copied from global
> > DL_DIR to package WORKDIR, increasing disk IO and space needed.
> >
> > Also, various chroots (bootstrap, buildchroot, sbuild chroot)
> > include their apt caches to sstate cache files.
> >
> > This patchset switches to hardlinks instead of copies and removes
> > apt cache from bootstrapped images ans sstate caches.
>
> I just saw that this pattern does NOT work in case the cache is on a
> different filesystem. This unfortunately is the case for all CI
> systems with locally mounted caches, as well as for kas-container
> builds with DL_DIR outside the KAS_WORK_DIR.
I remember discussing that issue with someone because that is always
what happens when you implement hard linking. Not sure it was on the
list because i kept away from this lively discussion.
It is like when someone adds overlayfs and then finds that it can not
be nested a few weeks later ;).
One way to go is to try hardlinking and fall back to copying or
mounting or whatever the slow/expensive case is.
I once wrote patches for wic doing a "if not hardlink, copy" that were
needed for Isar and its chroots.
But if the cases we care most about would always take the "slow path"
we better not have two paths.
Henning
> In short: This breaks a LOT of use-cases.
> I'm really sorry that we only found that by know.
> But we definitely need a different solution.
>
> Example output:
> 2023-01-30 08:38:51 - INFO - | ln: failed to create hard link
> '/builds/iiot-edge-device/foo/meta-iot2050-pg2-
> foo/build/tmp/work/debian-bullseye-amd64/isar-bootstrap-target/1.0-
> r0/rootfs/var/cache/apt/archives/gcc-arm-linux-gnueabihf_4%3a10.2.1-
> 1_arm64.deb' => '/local-cache/meta-iot2050-pg2-
> foo/downloads/deb/debian-bullseye/gcc-arm-linux-gnueabihf_4%3a10.2.1-
> 1_arm64.deb': Invalid cross-device link
>
> Best regards,
> Felix
>
> >
> > Changes since v2:
> > - Don't use CACHEDIR.TAG, simply exclude var/cache/apt directory
> > when creating rootfs tarball for sstate-cache.
> > - Use symlinks when exchanging deb files between WORKDIR/rootfs
> > and /var/cache/apt/archives inside sbuild chroot
> >
> > Changes since v1:
> > - Simplified cleanup of apt cache in debootstrap rootfs.
> > - Now "ln" instead of "cp -l" used.
> > - Removed apt cache contents from sstate cache. The idea is
> > proposed in patch 3, but it was reworked and fixed. Firstly,
> > CACHEDIR.TAG can't
> > be just a file (e.g. created by 'touch'), it should include some
> > specific signature [1]. Secondly, it's easier to just create this
> > tag in bootstrapped rootfs and it will be automatically used in all
> > derivatives (sbuild-chroot/buildchroot/image). So, the original
> > patch from Roberto A. Foglietta was simplified.
> >
> > This patchset includes (or absorbs) the logic from p1..p3 patches of
> > the series Roberto prosposed. What concerns additional patches, they
> > don't let us benefit much, but require quite significant changes
> > in Isar, so we should check twice if they are worth including.
> >
> > Uladzimir Bely (5):
> > Clean apt cache from debootstrapped rootfs dirs
> > Use hardlinks in deb-dl-dir import/export
> > Exclude apt cache from sstate caches
> > Use symlinks when importing debian packages to sbuild chroot
> > Lightweight copy of rootfs directories if possible
> >
> > meta/classes/deb-dl-dir.bbclass | 4 ++--
> > meta/classes/dpkg.bbclass | 4 ++--
> > meta/classes/imagetypes_container.bbclass | 2 +-
> > meta/classes/rootfs.bbclass | 7 ++++---
> > meta/classes/sdk.bbclass | 2 +-
> > meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 6 +++++-
> > 6 files changed, 15 insertions(+), 10 deletions(-)
> >
> > --
> > 2.20.1
> >
>
next prev parent reply other threads:[~2023-01-30 10:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 7:31 Uladzimir Bely
2023-01-20 7:31 ` [PATCH v3 1/5] Clean apt cache from debootstrapped rootfs dirs Uladzimir Bely
2023-01-20 7:31 ` [PATCH v3 2/5] Use hardlinks in deb-dl-dir import/export Uladzimir Bely
2023-01-20 7:31 ` [PATCH v3 3/5] Exclude apt cache from sstate caches Uladzimir Bely
2023-01-20 7:31 ` [PATCH v3 4/5] Use symlinks when importing debian packages to sbuild chroot Uladzimir Bely
2023-01-20 7:31 ` [PATCH v3 5/5] Lightweight copy of rootfs directories if possible Uladzimir Bely
2023-01-20 13:04 ` [PATCH v3 0/5] Improving apt cache Moessbauer, Felix
2023-01-21 4:12 ` Roberto A. Foglietta
2023-01-24 7:38 ` Uladzimir Bely
2023-01-30 8:45 ` Moessbauer, Felix
2023-01-30 9:56 ` Roberto A. Foglietta
2023-01-30 10:04 ` Roberto A. Foglietta
2023-01-30 10:45 ` Henning Schild [this message]
2023-01-30 12:24 ` Roberto A. Foglietta
2023-01-30 14:16 ` Roberto A. Foglietta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230130114504.51e78b03@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=felix.moessbauer@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=ubely@ilbers.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox