From 26d7e10a8ab0a3a64427bc907dc447693468fc29 Mon Sep 17 00:00:00 2001 From: Haiqing Bai Date: Tue, 29 Nov 2022 11:36:56 +0800 Subject: [PATCH] pkgbuilder: Set the build directory to the shared volume The pkgbuilder container sets its build directory '/build' to '/var/lib/sbuild/build', since the root directory '/' of the container is the docker overlay(on host, it is '/ovlerlay'), so the '/build' directory consumes the disk of host overlay and may cause below issue: "E: Disk space is probably not sufficient for building" This fix does not mount '/build' to overlay and sets it to pkgbuilder's private directory on the shared volume. This fix requires to rebuild the build environment: stx-init-env --rebuild Test Plan: Pass: 1. Before rebuilding the container, change the line: "$purge_build_directory = 'always'"; to "$purge_build_directory = 'never'"; in tools/stx/toCOPY/pkgbuilder/debbuilder.conf 2. Rebuild the container and enter into the builder: $build-pkgs -c -p 3. Then enter into the pkgbuilder: $cd '/localdisk/pkgbuilder///chroots/' 4. find . -name "build" There should be 'build/-*' build directory Story: 2008846 Task: 46956 Signed-off-by: Haiqing Bai Change-Id: Iad6c86c0991eecc64e3677b606e607f0b80a5509 --- stx/toCOPY/pkgbuilder/setup.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stx/toCOPY/pkgbuilder/setup.sh b/stx/toCOPY/pkgbuilder/setup.sh index 86a5a805c..686d29500 100755 --- a/stx/toCOPY/pkgbuilder/setup.sh +++ b/stx/toCOPY/pkgbuilder/setup.sh @@ -1,5 +1,7 @@ #!/bin/bash +SCHROOT_FSTAB="/etc/schroot/sbuild/fstab" + if [ -f "/etc/fstab" ]; then speed_up=`cat /etc/fstab | grep 'speeding up sbuild'` [ "x${speed_up}" != "x" ] && exit 0 @@ -11,4 +13,9 @@ tmpfs /var/lib/schroot/session tmpfs uid=root,gid=root,mode=0755 0 0 tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0755 0 0 EOF +# The root '/' of the container is on docker overlay, so the +# original '/build' of chroot is on overlay, here remove the +# setting and make the '/build' to the shared volume of container +sed -i "/\/var\/lib\/sbuild\/build/d" ${SCHROOT_FSTAB} + mount -a