linux - Yocto Initramfs 添加 cryptsetup 包时发生事务错误

标签 linux embedded-linux yocto bitbake initramfs

我在 Ubuntu 18.04 LTS 和 meta-tegra 层 ( https://github.com/madisongh/meta-tegra ) 上使用 Yocto Warrior 为我的 NVIDIA Jetson Nano 构建根文件系统。

我想加密 SD 卡上的某个分区,因此我需要 openembedded 层中提供的 cryptsetup 包。我已经将其添加到我的镜像中,并且生成的根文件系统已安装它。

问题是我需要将其添加到我的 initramfs 中,以便在启动时自动解密我的加密卷。

我得到的错误显示为:

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
-------------

我将 cryptsetup 添加到 initramfs 配方的 bbappend 文件中,如下所示(显示的是整个 bbappend 文件):

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

如果我注释掉 cryptsetup 行,initramfs 任务就可以正常完成。

这是来自 meta-tegra 的 initramfs 的未附加的原始配方文件:

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}"


如何成功将 cryptsetup 添加到 initramfs 配方中?

最佳答案

我收到了完全相同的错误消息,只不过它是由不同的配方(不是 cryptsetup,而是一些自定义配方)触发的。

问题是两个食谱( tegra-minimal-init_1.0.bb )和 base-files_3.0.14.bb尝试创建“/sys”和“/proc”目录,但具有不同的权限(一个具有 0755,另一个具有 0555)。

解决这个问题的方法只是删除 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

或者,您可以升级到“dunfell”,因为它是通过更改 tegra-minimal-init_1.0.bb 以创建具有与基本文件相同的权限的“/proc”和“/sys”来修复的,或者只需从 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

关于linux - Yocto Initramfs 添加 cryptsetup 包时发生事务错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58098744/

相关文章:

linux - Python 无法启动新线程,但未达到线程限制

yocto - 用元开放嵌入的 ntp 替换 busybox ntpd

Yocto 尝试安装之间的冲突

Yocto/bitbake/OpenEmbedded : Best place for build/conf/local. conf 的内容?

c - c linux中的管道连接3个进程以执行命令

linux - 从 bash 脚本终止 ssh 或\和远程进程

linux - 将 GAS 与 .intel_syntax 一起使用时出错

linux - `GLIBC_2.16' 找不到应用程序

linux - 向 Yocto 生成的自定义 Linux 镜像添加新内核参数

linux - 是否可以在腻子中使用远程命令选项运行多个命令?