Skip to content

creating third LUKS partition for overlayfs upper and work #243

@snedosiekov

Description

@snedosiekov

Hello @timg236
I have successfully do fde provision process with overlayfs with partition for upper/work in ramfs
Now I trying to add third crypted LUKS partition to store this data in, for this I have make some modifications in rpi-fde-provisioner.sh in code after "Erase / Partition Device Storage" phase

# Arbitrary sleeps to handle lack of correct synchronisation in fastbootd.
fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" erase "${RPI_DEVICE_STORAGE_TYPE}"
sleep 2
fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem partinit "${RPI_DEVICE_STORAGE_TYPE}" DOS
sleep 2
fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem partapp "${RPI_DEVICE_STORAGE_TYPE}" 0c "$(simg_expanded_size "${RPI_SB_WORKDIR}"/bootfs-temporary.simg)"
sleep 2
if [ "${RPI_USE_OVERLAY_FS}" = "false" ]; then
    fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem partapp "${RPI_DEVICE_STORAGE_TYPE}" 82 # Allocate remaining space to rootfs
    sleep 2
else
    echo "Calculating root partition size for overlayfs usage"
    if [ -f "${RPI_SB_WORKDIR}"/rootfs-temporary.simg ]; then
        OVERLAYFS_SIZE_BYTES=$(simg_expanded_size "${RPI_SB_WORKDIR}"/rootfs-temporary.simg)
    else
        ROOT_IMAGE_SIZE_BYTES=$(stat -c%s ${TMP_DIR}"/rootfs-original.img")    
    fi
    
    echo "Root image size in bytes: ${ROOT_IMAGE_SIZE_BYTES}"
    ROOT_PARTITION_SIZE=$(( ROOT_IMAGE_SIZE_BYTES + (1024 * 1024 * 100) )) # Add 100MB 
    echo "Allocating root partition size in bytes: ${ROOT_PARTITION_SIZE}"
    fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem partapp "${RPI_DEVICE_STORAGE_TYPE}" 82 "${ROOT_PARTITION_SIZE}" # Allocate space to rootfs + 100MB 
    sleep 2
fi
fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem cryptinit "${RPI_DEVICE_STORAGE_TYPE}"p2 root "${RPI_DEVICE_STORAGE_CIPHER}"
sleep 2
fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem cryptopen "${RPI_DEVICE_STORAGE_TYPE}"p2 cryptroot
sleep 2
if [ "${RPI_USE_OVERLAY_FS}" = "true" ]; then
    fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem partapp "${RPI_DEVICE_STORAGE_TYPE}" 82 # Create a 3rd partition for overlayfs upper and allocate remaining space
    sleep 2
    fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem cryptinit "${RPI_DEVICE_STORAGE_TYPE}"p3 overlay_upper "${RPI_DEVICE_STORAGE_CIPHER}"
    sleep 2
    fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem cryptopen "${RPI_DEVICE_STORAGE_TYPE}"p3 crypt_overlay_upper
    sleep 2
fi
fi

but, unfortunality, command init crypt partioton fort overlayfs upper/work is failed
fastboot -s "${FASTBOOT_DEVICE_SPECIFIER}" oem cryptinit "${RPI_DEVICE_STORAGE_TYPE}"p3 overlay_upper "${RPI_DEVICE_STORAGE_CIPHER}"

fastboot -s be102a0e74384533 oem cryptinit mmcblk0p3 overlay_upper aes-xts-plain64
FAILED (remote: 'Cannot create context for device /dev/mmcblk0p3 as failed to open')
fastboot: error: Command failed

looks like there are predefined names for LUKS partitions or this should be done in another way..
could you direct me how to add third LUKS partition in this stage?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions