From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7182796543154454528 X-Received: by 2002:a05:6820:359:b0:494:ca16:c7ff with SMTP id m25-20020a056820035900b00494ca16c7ffmr446085ooe.75.1674113817441; Wed, 18 Jan 2023 23:36:57 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6870:8c01:b0:13d:173c:e583 with SMTP id ec1-20020a0568708c0100b0013d173ce583ls339503oab.0.-pod-prod-gmail; Wed, 18 Jan 2023 23:36:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXtleEKv2Bx/qkpaOzKrBfBDKBQkrAx4OrSiMX7EPUUs6TXQyOMg2zhZRVSKXxzqiRnZtl1Y X-Received: by 2002:a05:6871:4706:b0:151:70e8:3db2 with SMTP id py6-20020a056871470600b0015170e83db2mr5654745oab.30.1674113816824; Wed, 18 Jan 2023 23:36:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674113816; cv=none; d=google.com; s=arc-20160816; b=zmngH49gOKPZlOVJn/8NdFkVIbj5yh1jhgf8oAmTqE6wCrpEU4LamLDhqQtLIiw85p qFogGaczCp0YfpWruf5Fp99pEh+KAcKvFDtSAJz2gr16/VQ2rm/9raOWPkjN8l4zwCyc 2sG18688SD37k7mGcMbQHt+ui5uqtvl2pkH9V7XFYFuplxX1Bni8kbsdO5eZVkbQWKxF Vmxm8OI5phTC71JhCeYjzEq99lA3RAj/ktKgMNWTySXicxMOYCDciIRaTNkTuvXqqg4k FpRZRCT6G1d5z83RSMqDPKF0RoVhmVaOZzlU7H72HVXTUnLNnqY/FevHZZ/y2xDvCrHJ 11jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=eC7kSwCXVQ/zcE9Gdb5CHeq7FRZRELSI0LXAcR0YW/o=; b=wnv+HULSib/U+q96cmaN6XeBZlma/g4/0OBdzRfHza+QuAyU5UlYwYqDTm8lg3nVL7 Ij6XnYrmg7RE/3r1nVxYc0Mn711B3WbKaicUkiPnem5Ys7t7IZZcI5vtmtu746CcfsxQ xztoVSIoeJuHBof1mZyygjlynvlHb0GdVz/TTpPpzIs7b18mfL1NDPZjeUpzKyyEZOGV IUQTDUNCkW5iIv8gTEKIv/M9mr6CVas1BXbmjugWJcHv8eZ9CrKUdsVvrvgrgcxumgcs DgYfKB2RG/VbMF8u2zgPx5RBhU79jw8yzv1jISPvi1yON0BmOaHn9EAPBs6iWimppuln Z++w== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id f6-20020a4abb06000000b004f52827c8b8si859874oop.2.2023.01.18.23.36.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jan 2023 23:36:56 -0800 (PST) Received-SPF: pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from home.localnet (44-208-124-178-static.mgts.by [178.124.208.44] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 30J7aq2w028995 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Jan 2023 08:36:53 +0100 From: Uladzimir Bely To: "isar-users@googlegroups.com" , "Moessbauer, Felix" Cc: Uladzimir Bely , "Roberto A . Foglietta" Subject: Re: [PATCH v2 0/3] Improving apt cache Date: Thu, 19 Jan 2023 10:36:49 +0300 Message-ID: <6100573.eO5KgaWL5Y@home> In-Reply-To: <6842478.jJDZkT8p0M@home> References: <20230106064809.10412-1-ubely@ilbers.de> <00ca12addc6e3b93aeca6127124cfc2f0a1aabf2.camel@siemens.com> <6842478.jJDZkT8p0M@home> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: dnrAr/rTrQka In the email from Monday, 9 January 2023 10:39:00 +03 user Uladzimir Bely wrote: > In the email from Monday, 9 January 2023 09:32:29 +03 user Moessbauer, Felix > wrote: > > On Fri, 2023-01-06 at 07:48 +0100, Uladzimir Bely wrote: > > > Currently, apt cache (e.g. `var/cache/apt/archives`) import and > > > export > > > functions are not optimal. Multiple files are imported from global > > > DL_DIR to package WORKDIR, increasing disk IO and size 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. > > > > > > Currently (measured on qemuarm64-bullseye cross-compilation with > > > maximum 8 parallel tasks (e.g. 8 CPU cores)): > > > - build directory size reduced from 8906 to 6675 MiB > > > - runtime maximum disk usage reduced from 15965 to 8501 MiB > > > > > > TODO: > > > - cleanup other rootfs's (sbuild-chroot, buildchroot). > > > > > > Actually, this won't bring much benefit, but why not cleanup final > > > rootfs's apt cache when the build finishes? > > > > > > - deal with additional copying in sbuild routines (patch 3). > > > > > > We could use hardlinks instead of copying packages between upper > > > layer (where sbuild temporarly keeps them) and workdir rootfs, > > > but it is not expected to bring much benefit, since upper layer > > > temporary nature. Additinal measurements are required. > > > > Hi, > > > > if the cache is 20GB, we still copy 20GB of data into the upper layer > > (per sbuild task). > > This has a huge impact and I would really appreciate if we could use > > hardlinks for that part. > > > > Felix > > Hi. > > I need to check if it really works. My doubts are related to overlayfs: if > we are really able to create hardlinks between DL_DIR (that is common linux > filesystem) and upper layer of overlayfs (that is technically the same > partition, but it is a "mount option" of the different "overlay" > filesystem). I got time to get back to this patches and checked this moment. And it really does not work as I expected. Original patch includes the following: - --chroot-setup-commands="cp -n --no-preserve=owner ${ext_deb_dir}/ *.deb -t ${deb_dir}/ || :" \ + --chroot-setup-commands="ln -Pf ${ext_deb_dir}/*.deb -t ${deb_dir}/ 2>/dev/null || :" \ This results to to failing "ReproTest" in CI with the following error (for libhello, for example): sbuild-build-depends-dose3-dummy:armhf : Depends: dose-distcheck:amd64 but it is not installable E: Unable to correct problems, you have held broken packages. To debug it, I removed `2>/dev/null` and found, that hardlinks simply don't work and the following errors are now seen earlier: ln: failed to create hard link '/var/cache/apt/archives/adduser_3.118_all.deb' => '/home/builder/libhello/rootfs/var/cache/apt/archives/ adduser_3.118_all.deb': Invalid cross-device link ... #tons of similar errors... ln: failed to create hard link '/var/cache/apt/archives/ zlib1g_1%3a1.2.11.dfsg-2+deb11u2_mipsel.deb' => '/home/builder/libhello/ rootfs/var/cache/apt/archives/zlib1g_1%3a1.2.11.dfsg-2+deb11u2_mipsel.deb': Invalid cross-device link I: Finished running 'ln -Pf /home/builder/libhello/rootfs/var/cache/apt/ archives/*.deb -t /var/cache/apt/archives/ || :'. So, it works for network builds (when missing packages always can be downloaded by apt), but it fails for local builds from apt-cache (when, at first network build, sbuild dependencies are simply not exported to download directory due to non-working hardlinks, plus with hidden stderr) > > > 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. > > > > > > [1] https://bford.info/cachedir/ > > > - > > > > > > Roberto A. Foglietta (1): > > > Changes for a faster build using less disk space > > > > > > Uladzimir Bely (2): > > > Clean apt cache from debootstrapped rootfs dirs > > > Use hardlinks in deb-dl-dir functions > > > > > > meta/classes/deb-dl-dir.bbclass | 6 +++--- > > > meta/classes/rootfs.bbclass | 3 ++- > > > meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 10 +++++++++- > > > 3 files changed, 14 insertions(+), 5 deletions(-)