user81604
user81604

Reputation: 21

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

I'm recompiling my project (https://github.com/warpme/minimyth2) to rpi3 (aarch64). I have all components compiled and now I'm trying to boot it on rpi3.

I'm using u-boot script from arm archlinux with replaced kernel image (Image.gz) and rootfs from my compilation

kernel boots. Also I see also on console, kernel mounts OK 2nd partition (my rootfs content is here).

but later kernel log says:

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

Accordingly to 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 "error -13" means EACCES 13 /* Permission denied */.

I double checked: both files are root:root and 755 (their dependencies as well). What else can cause EACCES here?

u-boot script is following:

# 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

so I think rootfs is mounted as rw

If anybody wants to look on my files, here are boot and rootfs partitions content:

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

So summarising:

1\at rootfs mounting phase kernel says

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

2\ kernel is able to find init (and fallback to sh due failed init execution) as kernel says

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\adding "rootflags=exec" to kernel command line cause mount of root fails.

For me it seems my kernel config is somehow broken as it is able to mount but can't execute on it.

Attaching my kernel cfg http://warped.inet2.org/kernel-config.tar.bz2) (pls look at linux-4.16.13-arm64-armv8.config)

Can somebody can look on it and verify is such config enough to mount rootfs without any initrd? (to confirm: I want mount SD card ext4 rootfs straight from kernel image).

Alternatively: can somebody provide me minimal aarch64 kernel config enough to U-boot rpi3 with generic 4.16 kernel with rootfs on SD ext4 partition and without any initrd?

(PS: My kernel config is based on archlinux aarch64 multiplatform kernel and is 99.9% equal to archlinux arm)

(below is screenshot form kernel log) boot screenshot

Upvotes: 0

Views: 5084

Answers (1)

user81604
user81604

Reputation: 21

It looks like issue was in glibc. I build with 2.17 and despite it is marketed as "first glibc supporting aarch64" - it not works for me. Upgrading glibc to 2.27 solves issue :-)

Thx everybody why tried help me with this!

Upvotes: 0

Related Questions