From 9231f857c18c1250f7d0408b91c8dd0adb773842 Mon Sep 17 00:00:00 2001 From: Bart van Oort Date: Sat, 4 May 2024 00:56:13 +0200 Subject: [PATCH] ci: debug why final image does not contain root partition --- .github/workflows/main.yml | 45 +++++++++++++++++++++++++++++++++++++- dietpi/build.sh | 4 ++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b39a2a5..0eef8b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,12 +14,23 @@ jobs: with: submodules: recursive + # TODO: configure a cache for the apt packages that are downloaded during the build. + # Copilot generated the following code, but I'm not sure yet if it'll work. + # - name: Cache apt packages + # uses: actions/cache@v2 + # with: + # path: /var/cache/apt + # key: ${{ runner.os }}-apt-${{ hashFiles('**/apt.txt') }} + # restore-keys: | + # ${{ runner.os }}-apt- + - uses: pguyot/arm-runner-action@v2 id: build_image with: base_image: dietpi:rpi_armv8_bullseye cpu: cortex-a53 - image_additional_mb: 500 + image_additional_mb: 338 # produces a total disk image size of about 1024 MiB + optimize_image: false commands: | set +x echo @@ -30,6 +41,38 @@ jobs: ./dietpi/build.sh + # TODO: for some reason, the resulting image only has one partition, namely the boot partition. + # TODO: There's no secondary ext4 partition... + # Seems to be because of an error during resizing the rootfs partition: https://github.com/pguyot/arm-runner-action/issues/87 + + loopdev="/dev/loop3" + rootdev=$(ls "${loopdev}"*${rootfs_partnum}) + rootfs_partnum=2 + + rootfs_blocksize=$(tune2fs -l ${rootdev} | grep "^Block size" | awk '{print $NF}') + rootfs_blockcount=$(tune2fs -l ${rootdev} | grep "^Block count" | awk '{print $NF}') + + rootfs_partstart=$(parted -m --script "${loopdev}" unit B print | grep "^${rootfs_partnum}:" | awk -F ":" '{print $2}' | tr -d 'B') + rootfs_partsize=$((${rootfs_blockcount} * ${rootfs_blocksize})) + rootfs_partend=$((${rootfs_partstart} + ${rootfs_partsize})) + + echo "----------------------------" + echo "Full tune2fs output" + echo "----------------------------" + tune2fs -l + echo "----------------------------" + + echo "----------------------------" + echo "Rootfs: + echo " block size: ${rootfs_blocksize}" + echo " block count: ${rootfs_blockcount}" + echo " part start: ${rootfs_partstart}" + echo " part size: ${rootfs_partsize}" + echo " part end: ${rootfs_partend}" + echo "----------------------------" + + df -h + echo echo ">--------------------------------------------------------------------------------------------------<" echo "> Done! " diff --git a/dietpi/build.sh b/dietpi/build.sh index 10e9867..ddbb180 100755 --- a/dietpi/build.sh +++ b/dietpi/build.sh @@ -45,7 +45,7 @@ set_dietpi_config AUTO_SETUP_GLOBAL_PASSWORD pidj set_dietpi_config CONFIG_CHECK_DIETPI_UPDATES 1 # Enable daily check for DietPi updates. 0=disable | 1=enable set_dietpi_config CONFIG_CHECK_APT_UPDATES 1 # Enable daily check for APT package updates: 0=disable | 1=check only | 2=check and upgrade automatically set_dietpi_config CONFIG_CHECK_CONNECTION_IP "127.0.0.1" # Workaround for installing DietPi software on GitHub Actions runners because Ping doesn't work there. Will be reset after build. https://github.com/pguyot/arm-runner-action/issues/91#issuecomment-2088435969 -set_dietpi_config CONFIG_NTP_MODE 2 # Network time sync: 0=disabled | 1=boot only | 2=boot + daily | 3=boot + hourly | 4=Daemon + Drift +set_dietpi_config CONFIG_NTP_MODE 0 # Network time sync, disabled during build. Values: 0=disabled | 1=boot only | 2=boot + daily | 3=boot + hourly | 4=Daemon + Drift set_dietpi_config SOFTWARE_DISABLE_SSH_PASSWORD_LOGINS root # Disable SSH password logins, e.g. when using pubkey authentication # 0=Allow password logins for all users, including root # root=Disable password login for root user only @@ -103,5 +103,5 @@ log "Configuring desktop environment ..." log "Finishing up ..." set_dietpi_config CONFIG_CHECK_CONNECTION_IP "9.9.9.9" # Reset the workaround for installing DietPi software on GitHub Actions runners. - +set_dietpi_config CONFIG_NTP_MODE 3 # Network time sync: 0=disabled | 1=boot only | 2=boot + daily | 3=boot + hourly | 4=Daemon + Drift log "Done!"