cartesi / machine-emulator-tools

Set of tools to help the development
Apache License 2.0
13 stars 20 forks source link

Kernel panic when installing tools and nothing more #43

Closed edubart closed 7 months ago

edubart commented 7 months ago

Context

If you install tools and only it, you will have the following error when booting the machine:

[    0.113088] Kernel panic - not syncing: Requested init /usr/sbin/cartesi-init failed (error -2).
[    0.113408] CPU: 0 PID: 1 Comm: swapper Not tainted 6.5.9-ctsi-1 #1
[    0.113664] Hardware name: ucbbar,riscvemu-bare (DT)
[    0.113856] Call Trace:
[    0.113984] [<ffffffff80003b9a>] dump_backtrace+0x1c/0x24
[    0.114240] [<ffffffff803ef374>] show_stack+0x2c/0x38
[    0.114496] [<ffffffff803f50ac>] dump_stack_lvl+0x20/0x32
[    0.114752] [<ffffffff803f50d2>] dump_stack+0x14/0x1c
[    0.115008] [<ffffffff803ef51a>] panic+0xf8/0x286
[    0.115200] [<ffffffff803f5fec>] kernel_init+0xc6/0x10a
[    0.115456] [<ffffffff80001e3a>] ret_from_fork+0xa/0x1c

This happens because busybox was not installed. Multiple users already consulted me how to debug and fix this, the problem is that the error messages does not give a clue that busybox was missing.

Possible solutions

I see two solutions:

mpolitzer commented 7 months ago

The initial implementation followed your first proposal. However the binary ended up being removed over license concerns. Your second suggestion circumvents this problem by moving busybox installation further ahead. I also assume it will install any required licenses into the final image, so I would go with that.

edubart commented 7 months ago

The initial implementation followed your first proposal. However the binary ended up being removed over license concerns.

What about bundling toybox? I think its license is more permissive, it would be used by our init and nothing more. Toybox has the following license:

Toybox is released under the Zero Clause BSD license (SPDX: 0BSD): Zero clause BSD is a public domain equivalent license.

mpolitzer commented 7 months ago

The initial implementation followed your first proposal. However the binary ended up being removed over license concerns.

What about bundling toybox? I think its license is more permissive, it would be used by our init and nothing more. Toybox has the following license:

Toybox is released under the Zero Clause BSD license (SPDX: 0BSD): Zero clause BSD is a public domain equivalent license.

It was a bit incomplete from what I remember such as not having a shell. May be worth a revisit.

edubart commented 6 months ago

It was a bit incomplete from what I remember such as not having a shell. May be worth a revisit.

Last toybox release started providing static binaries for riscv64: https://landley.net/bin/toybox/0.8.11/toybox-riscv64 Downloaded and tested here, it contains sh where I can use it as a shell, although I don't think it is feature complete yet, it could be enough to run just init.