From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6554347564595937280 X-Received: by 2002:a1c:115:: with SMTP id 21-v6mr305745wmb.7.1526052962470; Fri, 11 May 2018 08:36:02 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:ea87:: with SMTP id s7-v6ls2889215wrm.14.gmail; Fri, 11 May 2018 08:36:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpaxRh5lrjrYIGObh8mETAAvA35ggUI26itcHfe4JQPRjjnC/8/bDcwx1F1fgFQpEeL8VCC X-Received: by 2002:adf:c34d:: with SMTP id e13-v6mr597247wrg.14.1526052962052; Fri, 11 May 2018 08:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526052962; cv=none; d=google.com; s=arc-20160816; b=Y9jTnl/uAR9HKW4no/I7D+ynaPCy2zcmlZQxs4X6uBgatrP4rQ7fjoELj6KVeO2tDc mQD2yhlrbZYEOoX5HU1Y0n1r3kLDLYiPA37d/lBT96n+HcJ1dQRGEAXzOiGzwWzOee/p JKP1cJz8TPI+5ouoglnnU7NNfDeUaoc2smfp387lbA+plYbbcW34UQ6b2jRHE7mH4uzF rBuFR5nOzTqMkpl3qmY0x+qc/OFdLBzgu4SAWvvg+ltdFnGNrEAM97xRiHyZUPzkF5Uw TtRY7XJIb9xmRvhApmOD9Rh+OMLNxrXhwy4dYRToLzsbApkHe8F2mtYEj4Wh3miKs8zt GoAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=6cbp0wqH3JHpWAg8gzD7b8v0vUyzWpB49zXybo+wedg=; b=sMu9w4iF+K1PWL90LiGuuoy/VPwpUAdh+wZEEpohKVkItcsgGIyPGFNs4xE8wceXVP UwqE0mqzZ06/6MERTDh/eZElkcsYGPzOqugBZM8za5umWytzeZLj1Vdzs9RH8U/xbJZ+ T9vBSrRtt+EC3YS9op6v/4EUEeFIlFE6C8/BGkQ0KkxJz6OzZ0cGbdx69J7d9/lFu12U zU4zHVTCemXbixzs95PRiyiBGTjiUrCmBxTSO1cldk9ja0YRWAbODhIZ/f6gIc06d7Oz idgtQtzWRNWoeBC88P3FkdzEq/M2FWoz75kkm418n48gwh7Vzj5B9PFjeenQy0/S2QoU tQBQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id e17-v6si120235wri.1.2018.05.11.08.36.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 May 2018 08:36:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Received: from localhost.localdomain ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id w4BFZkpL002213 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 May 2018 17:35:52 +0200 From: Alexander Smirnov To: isar-users@googlegroups.com Cc: Alexander Smirnov Subject: [PATCH] debootstrap: Add fallback apt cache support Date: Fri, 11 May 2018 18:35:38 +0300 Message-Id: <20180511153538.13665-1-asmirnov@ilbers.de> X-Mailer: git-send-email 2.9.5 X-TUID: l258LzhTD4d0 Add apt config file to switch caching mechanism from MMap to array-based. This needed to provide possibility to build fresh Isar suites on old hosts. For example, building Isar stretch on jessie host fails with the following error: Hit:1 http://security.debian.org stretch/updates InRelease Ign:2 http://ftp.de.debian.org/debian stretch InRelease Hit:3 http://ftp.de.debian.org/debian stretch-updates InRelease Hit:4 http://ftp.de.debian.org/debian stretch Release E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. Current value: 25165824. (man 5 apt.conf) qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault Now Isar performs the following: 1. Checking if user attempts to build stretch on old kernels 2. Temporarly installing this apt config file. 3. Removing this file after image rootfs creation So this file will not go to target rootfs. Signed-off-by: Alexander Smirnov --- meta-isar/recipes-core/images/isar-image-base.bb | 2 ++ .../isar-bootstrap/files/isar-apt-fallback.conf | 4 ++++ meta/recipes-core/isar-bootstrap/isar-bootstrap.bb | 17 ++++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-core/isar-bootstrap/files/isar-apt-fallback.conf diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb index 00e926a..d65b1f1 100644 --- a/meta-isar/recipes-core/images/isar-image-base.bb +++ b/meta-isar/recipes-core/images/isar-image-base.bb @@ -53,4 +53,6 @@ do_rootfs() { sudo rmdir ${IMAGE_ROOTFS}/isar-apt sudo umount -l ${IMAGE_ROOTFS}/dev sudo umount -l ${IMAGE_ROOTFS}/proc + [ -e "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf" ] && \ + sudo rm "${IMAGE_ROOTFS}/etc/apt/apt.conf.d/55isar-fallback.conf" || true } diff --git a/meta/recipes-core/isar-bootstrap/files/isar-apt-fallback.conf b/meta/recipes-core/isar-bootstrap/files/isar-apt-fallback.conf new file mode 100644 index 0000000..12ddbea --- /dev/null +++ b/meta/recipes-core/isar-bootstrap/files/isar-apt-fallback.conf @@ -0,0 +1,4 @@ +# Switch apt caching mechanism from mmap to array-based. +# This helps to build fresh Isar suites on old hosts. + +APT::Cache-Fallback "1"; diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb index a38dd88..a3a3a2b 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb @@ -10,7 +10,9 @@ Description = "Minimal debian root file system" LICENSE = "gpl-2.0" LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe" FILESPATH_prepend := "${THISDIR}/files:" -SRC_URI = "file://isar-apt.conf" +SRC_URI = " \ + file://isar-apt.conf \ + file://isar-apt-fallback.conf" PV = "1.0" WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}" @@ -165,6 +167,13 @@ do_bootstrap() { } addtask bootstrap before do_build after do_apt_config_prepare +def get_host_release(): + import platform + rel = platform.release() + return rel + +HOST_KERN_VER = "${@get_host_release().split('.')[0]}" + do_apt_config_install[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" do_apt_config_install() { sudo mkdir -p "${ROOTFSDIR}/etc/apt/preferences.d" @@ -177,6 +186,12 @@ do_apt_config_install() { sudo mkdir -p "${ROOTFSDIR}/etc/apt/apt.conf.d" sudo install -v -m644 "${WORKDIR}/isar-apt.conf" \ "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" + + if [ "${@get_distro_suite(d)}" = "stretch" ] && [ "${HOST_KERN_VER}" -lt "4" ]; then + sudo install -v -m644 "${WORKDIR}/isar-apt-fallback.conf" \ + "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" + fi + } addtask apt_config_install before do_build after do_bootstrap -- 2.1.4