Skip to content

qcom: Enabling Encryption leads to build failure

From build.sh:

case "${device}" in
  "pinephone"|"pinetab"|"sunxi" )
    family="sunxi"
    ARGS="${ARGS} -t nonfree:true"
    ;;
  "pinephonepro"|"pinetab2"|"rockchip" )
    family="rockchip"
    ARGS="${ARGS} -t nonfree:true"
    ;;
  "librem5" )
    family="librem5"
    ARGS="${ARGS} -t nonfree:true"
    ;;
  "sdm845"|"sdm670"|"sm6350"|"sc7280"|"sm7150"|"qcom-wip" )
    if [ "${device}" = "qcom-wip" ]; then
      device="wip"
    fi
    family="qcom"
    SECTSIZE="$(tomlq -r '.bootimg.pagesize' devices/qcom/configs/${device}.toml)"
    ARGS="${ARGS} -e MKE2FS_DEVICE_SECTSIZE:${SECTSIZE} -t nonfree:true -t bootonroot:true"
    ;;
  "amd64"|"amd64-free" )
    arch="amd64"
    family="amd64"
    ARGS="${ARGS} -t imagesize:15GB -t installersize:10GB"
    if [ "${device}" = "amd64" ]; then
      ARGS="${ARGS} -t nonfree:true"
    fi
    ;;
  * )
    echo "Unsupported device '${device}'"
    exit 1
    ;;
esac

Had to change bootonroot to false, otherwise task Encrypt root filesystem will fail:

2025/12/11 15:19:06 ==== Encrypt root filesystem ====
2025/12/11 15:19:06 setup-luks | + PASSWORD=myverysecretlukspassphrase
2025/12/11 15:19:06 setup-luks | + BOOTONROOT=true
2025/12/11 15:19:06 setup-luks | + PART=
2025/12/11 15:19:06 setup-luks | + PARTNR=2
2025/12/11 15:19:06 setup-luks | + lsblk -n -o kname,pkname,mountpoint
2025/12/11 15:19:06 setup-luks | loop0               
2025/12/11 15:19:06 setup-luks | dm-0      nvme0n1p3 
2025/12/11 15:19:06 setup-luks | dm-1      dm-0      /
2025/12/11 15:19:06 setup-luks | dm-2      dm-0      /var
2025/12/11 15:19:06 setup-luks | dm-3      dm-0      [SWAP]
2025/12/11 15:19:06 setup-luks | dm-4      dm-0      /tmp
2025/12/11 15:19:06 setup-luks | dm-5      dm-0      /home
2025/12/11 15:19:06 setup-luks | nvme0n1             
2025/12/11 15:19:06 setup-luks | nvme0n1p1 nvme0n1   /boot/efi
2025/12/11 15:19:06 setup-luks | nvme0n1p2 nvme0n1   /boot
2025/12/11 15:19:06 setup-luks | nvme0n1p3 nvme0n1   
2025/12/11 15:19:06 setup-luks | loop0p1   loop0     /home/erebion/Downloads/fairphone/mobian-recipes/.debos-804816792/mnt
2025/12/11 15:19:06 setup-luks | + '[' -e /dev/vda1 ']'
2025/12/11 15:19:06 setup-luks | ++ lsblk -n -o kname,pkname,mountpoint
2025/12/11 15:19:06 setup-luks | ++ grep '/boot$'
2025/12/11 15:19:06 setup-luks | ++ awk '{ print $1 }'
2025/12/11 15:19:06 setup-luks | ++ grep loop
2025/12/11 15:19:06 setup-luks | + TARGET_DISK=
2025/12/11 15:19:06 setup-luks | + '[' true '!=' true ']'
2025/12/11 15:19:06 setup-luks | + umount -lf /home/erebion/Downloads/fairphone/mobian-recipes/.debos-804816792/mnt
2025/12/11 15:19:20 setup-luks | + PARTNR=1
2025/12/11 15:19:20 setup-luks | + echo
2025/12/11 15:19:20 setup-luks | + grep -q p1
2025/12/11 15:19:20 setup-luks | ++ blkid -s TYPE -o value 1
2025/12/11 15:19:20 setup-luks | + FILESYSTEM=
2025/12/11 15:19:20 Action `Encrypt root filesystem` failed at stage Run, error: exit status 2
2025/12/11 15:19:20 Warning: Failed to get unmount /: invalid argument
2025/12/11 15:19:20 Unmount failure can cause images being incomplete!

(I added set -x to the beginning of scripts/setup-luks.sh)

Sorry for the chaotic bug report, got fever right now, but still wanted this to be documented before I forget it again, in case anyone else is wondering why they can't build an encrypted image.

I believe the solution would simply be to set bootonroot to false for encrypted images, but I could be wrong having fever right now...