首页 > 解决方案 > /sbin/init 存在但无法执行(错误 -13)

问题描述

我正在将我的项目 ( https://github.com/warpme/minimyth2 ) 重新编译为 rpi3 (aarch64)。我已经编译了所有组件,现在我正在尝试在 rpi3 上启动它。

我正在使用来自 arm archlinux 的 u-boot 脚本,并从我的编译中替换了内核映像 (Image.gz) 和 rootfs

内核引导。我也在控制台上看到,内核挂载了第二个分区(我的 rootfs 内容在这里)。

但后来内核日志说:

Starting init: /sbin/init exists but couldn’t execute it (error -13)
Starting init: /sbin/sh exists but couldn’t execute it (error -13)

根据https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/include/uapi/asm-generic/errno-base.h?h=v4。 16.14 “错误-13”表示EACCES 13 /* Permission denied */.

我仔细检查了:两个文件都是 root:root 和 755(它们的依赖项也是如此)。还有什么可能导致这里的 EACCES?

u-boot 脚本如下:

# Set root partition to the second partition of boot device
part uuid ${devtype} ${devnum}:2 uuid

setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait debug loglevel=7 smsc95xx.macaddr="${usbethaddr}"

if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /Image; then
  if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /dtbs/${fdtfile}; then
    if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /initramfs-linux.img; then
      booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
    else
      booti ${kernel_addr_r} - ${fdt_addr_r};
    fi;
  fi;
fi

所以我认为 rootfs 安装为 rw

如果有人想查看我的文件,这里是 boot 和 rootfs 分区内容:

hxxp://warped.inet2.org/boot.tar.bz2 hxxp://warped.inet2.org/root.tar.bz2

所以总结一下:

1\at rootfs 安装阶段内核说

EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)

2\ 内核能够像内核所说的那样找到 init(并且由于 init 执行失败而回退到 sh)

Starting init: /sbin/init exists but couldn't execute it (error -13) Starting init: /sbin/sh exists but couldn’t execute it (error -13)

3\添加"rootflags=exec"到内核命令行导致root挂载失败。

对我来说,我的内核配置似乎以某种方式损坏,因为它能够挂载但无法在其上执行。

附加我的内核配置文件http://warped.inet2.org/kernel-config.tar.bz2)(请查看 linux-4.16.13-arm64-armv8.config)

有人可以查看它并验证这样的配置是否足以在没有任何 initrd 的情况下挂载 rootfs?(确认:我想直接从内核映像挂载 SD 卡 ext4 rootfs)。

或者:有人可以为我提供足够的最小 aarch64 内核配置,以在 SD ext4 分区上使用带有 rootfs 且没有任何 initrd 的通用 4.16 内核 U-boot rpi3?

(PS:我的内核配置是基于archlinux aarch64多平台内核,99.9%等于archlinux arm)

(下面是内核日志截图) 开机截图

标签: initu-boot

解决方案


看起来问题出在 glibc 中。我使用 2.17 构建,尽管它被宣传为“第一个支持 aarch64 的 glibc”——它对我不起作用。将 glibc 升级到 2.27 解决了问题:-)

谢谢大家为什么尝试帮助我解决这个问题!


推荐阅读