Search code examples
linuxembedded-linuxyoctobitbakeinitramfs

Yocto Initramfs Transaction Error adding cryptsetup package


I am using Yocto Warrior on Ubuntu 18.04 LTS and the meta-tegra layer ( https://github.com/madisongh/meta-tegra ) to build a root file system for my NVIDIA Jetson Nano.

I want to encrypt a certain partition on my SD Card and so I need the cryptsetup package which is available in openembedded layer. I have already added it to my image and the resulting root file system has it installed.

The problem is that I need to add it to my initramfs in order to decrypt my encrypted volume automatically on boot.

The error I get is shown as:

Transaction Summary
================================================================================
Install  50 Packages

Total size: 13 M
Installed size: 52 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Error: Transaction check error:
  file /proc conflicts between attempted installs of tegra-minimal-init-1.0-r0.aarch64 and base-files-3.0.14-r89.jetson_nano
  file /sys conflicts between attempted installs of tegra-minimal-init-1.0-r0.aarch64 and base-files-3.0.14-r89.jetson_nano

Error Summary
-------------

I add the cryptsetup to my bbappend file for the initramfs recipe like this ( shown is the entire bbappend file ):

PACKAGE_INSTALL_append = " e2fsprogs-e2fsck e2fsprogs-mke2fs e2fsprogs-tune2fs e2fsprogs-badblocks"
PACKAGE_INSTALL_append = " i2c-tools"
PACKAGE_INSTALL_append = " openssl"
PACKAGE_INSTALL_append = " cryptsetup"

If I comment out the cryptsetup line, the initramfs task completes just fine.

Here is the non-appended, original recipe file for the initramfs from meta-tegra:

DESCRIPTION = "Minimal initramfs image for Tegra platforms"
LICENSE = "MIT"

TEGRA_INITRD_INSTALL ??= ""
INITRD_FSTYPES ??= "${INITRAMFS_FSTYPES}"

PACKAGE_INSTALL = "\
    tegra-firmware-xusb \
    tegra-minimal-init \
    ${TEGRA_INITRD_INSTALL} \
"

IMAGE_FEATURES = ""
IMAGE_LINGUAS = ""

COPY_LIC_MANIFEST = "0"
COPY_LIC_DIRS = "0"

COMPATIBLE_MACHINE = "(tegra)"

KERNELDEPMODDEPEND = ""

IMAGE_ROOTFS_SIZE = "8192"
#IMAGE_ROOTFS_SIZE = "16384"

inherit core-image

IMAGE_FSTYPES = "${INITRD_FSTYPES}"


How can I add cryptsetup to the initramfs recipe successfully?


Solution

  • I've had the same exact error message, except it was triggered by a different recipe (not cryptsetup, but some custom recipe).

    The problem is that both recipes (tegra-minimal-init_1.0.bb) and base-files_3.0.14.bb try to create the '/sys and '/proc' dirs, but with different permissions (one with 0755, the other with 0555).

    What solved it was simply removing the dir creation in tegra-minimal-init_1.0.bb:

    [eliranl@somehost]$ git diff
    diff --git a/meta-tegra/recipes-core/initrdscripts/tegra-minimal-init_1.0.bb b/meta-tegra/recipes-core/initrdscripts/tegra-minimal-init_1.0.bb
    index ac16ff1..e7021bb 100644
    --- a/meta-tegra/recipes-core/initrdscripts/tegra-minimal-init_1.0.bb
    +++ b/meta-tegra/recipes-core/initrdscripts/tegra-minimal-init_1.0.bb
    @@ -12,7 +12,7 @@ S = "${WORKDIR}"
     
     do_install() {
         install -m 0755 ${WORKDIR}/init-boot.sh ${D}/init
    -    install -d ${D}/proc ${D}/sys ${D}/dev ${D}/tmp ${D}/mnt ${D}/run ${D}/usr
    +    install -d ${D}/dev ${D}/tmp ${D}/mnt ${D}/run ${D}/usr
         mknod -m 622 ${D}/dev/console c 5 1
         install -d ${D}${sysconfdir}
         if [ -e ${WORKDIR}/platform-preboot-cboot.sh ]; then
    

    Alternatively, you can upgrade to 'dunfell', as it was fixed there by changing tegra-minimal-init_1.0.bb to create '/proc' and '/sys' with same permissions as in base-files, or just backport this part from the specific commit:

    -    install -d ${D}/proc ${D}/sys ${D}/dev ${D}/tmp ${D}/mnt ${D}/run ${D}/usr
    +    install -m 0555 -d ${D}/proc ${D}/sys
    +    install -m 0755 -d ${D}/dev ${D}/mnt ${D}/run ${D}/usr
    +    install -m 1777 -d ${D}/tmp