From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94301C00140 for ; Thu, 18 Aug 2022 05:38:40 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.95) (envelope-from ) id 1oOY5a-00019u-83; Thu, 18 Aug 2022 01:29:06 -0400 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (Exim 4.95) (envelope-from ) id 1oOXw9-0006Xd-HB for kernelnewbies@kernelnewbies.org; Thu, 18 Aug 2022 01:19:22 -0400 Received: from unknown (HELO send001-relay.gov-dooray.com) (211.180.235.152) by 129.254.9.16 with ESMTP; 18 Aug 2022 14:19:16 +0900 X-Original-SENDERIP: 211.180.235.152 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.112] (HELO smtp002-imp.gov-dooray.com) ([10.162.225.112]) by send001-relay.gov-dooray.com with SMTP id fbe62fa262fdcbd4; Thu, 18 Aug 2022 14:19:16 +0900 DKIM-Signature: a=rsa-sha256; b=iBYnV7adNLcdc+lxEi1JAwSz7oCZ/kCDjzdFtWCCC/FO/xkBzTOeO/AxLm9Bu91wk5/Jr1FWNw K05BhLU1rtIVYBYWy/nwo9gLgwQg2xZBWu6la4uaYvtzlOCDEBO2ZexbQExO8UwKw6kw08G8l8+f BXSkEE8Yau5d5ZXRfusIQJHt0O1I5r2ekSI2D+wgt3U/PD9NX/1FQmGOonc7NkB38aMP70LKezUV Su5W6ugOcnSQuHU9jSqgzyFiEy+2UMgcS4QGYA3yhp7efkJ9oNO0sPYI3FvznRw6pvD0f/vlpIC1 msM+cYIdK8dYjh3pfA6JYiF3PR/2uPYv1BkCYm0g==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=Vzie6pDXBAYnhUavHFzgCIppHHw7ifr6WyBXVLlEzo0=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp002-imp.gov-dooray.com with SMTP id 65b924d762fdcbd4; Thu, 18 Aug 2022 14:19:16 +0900 From: "Chan Kim" To: References: <03db01d8ae26$07e35980$17aa0c80$@etri.re.kr> In-Reply-To: <03db01d8ae26$07e35980$17aa0c80$@etri.re.kr> Subject: RE: busybox shell doesn't come up or get stuck.. where should I look or how should I debug it? Date: Thu, 18 Aug 2022 14:19:13 +0900 Message-ID: <060e01d8b2c2$0e319680$2a94c380$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Content-Language: ko Thread-Index: AQH56dwG32iNkvdzSZPNV4qwNP9iIK1xrS/g X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0943082088371894253==" Errors-To: kernelnewbies-bounces@kernelnewbies.org This is a multipart message in MIME format. --===============0943082088371894253== Content-Type: multipart/alternative; boundary="----=_NextPart_000_060F_01D8B30D.7E1BFDA0" Content-Language: ko This is a multipart message in MIME format. ------=_NextPart_000_060F_01D8B30D.7E1BFDA0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello, all, In the initramfs.cpio.gz file from the busybox, when I replace the /init script to an executable binary called 'init', (which prints Hello! Repeatedly), The output from the board looks like this. (...) ### point 106 ### point 106-1 Run /init as init process ### point 106-2, ret = -2 Failed to execute /init (error -2) ### point 107 ### point 107-1 Run /init as init process ### point 107-2, ret = -2 Kernel panic - not syncing: Requested init /init failed (error -2). CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-rc5 #197 Hardware name: ETRI ab21m (DT) Call trace: dump_backtrace+0x0/0x190 show_stack+0x14/0x30 dump_stack+0xcc/0x104 panic+0x16c/0x328 kernel_init+0x178/0x264 ret_from_fork+0x10/0x18 Kernel Offset: disabled CPU features: 0x0000007,78002c18 Memory Limit: none ---[ end Kernel panic - not syncing: Requested init /init failed (error -2). ]--- The related source code (init/main.c) looks like this (trying it first from the ramdisk. 'init=/init' was given from the bootargs in device tree) printk("### point 106\n"); if (ramdisk_execute_command) { printk("### point 106-1\n"); ret = run_init_process(ramdisk_execute_command); printk("### point 106-2, ret = %d\n", ret); if (!ret) return 0; pr_err("Failed to execute %s (error %d)\n", ramdisk_execute_command, ret); } /* * We try each of these until one succeeds. * * The Bourne shell can be used instead of init if we are * trying to recover a really broken machine. */ printk("### point 107\n"); if (execute_command) { printk("### point 107-1\n"); ret = run_init_process(execute_command); printk("### point 107-2, ret = %d\n", ret); if (!ret) return 0; panic("Requested init %s failed (error %d).", execute_command, ret); } I compiled the init program by the command "aarch64-none-linux-gcc -static -o init test.c". When 'init' was a script, some lines of it was processed ok, but when I replace 'init' to a binary program, it just failed with -2. I find error code 2 is 'No such file or directory' which is strange because my 'init' program was under / when I made the initramfs.cpio.gz. Can anyone give me any advice? Thank you! Chan Kim From: Chan Kim Sent: Friday, August 12, 2022 5:32 PM To: kernelnewbies@kernelnewbies.org Subject: busybox shell doesn't come up or get stuck.. where should I look or how should I debug it? Hi all, I'm trying to boot linux with minimal config on our FPGA board which is under development. After months of trying (but I tried this intermittently) I think I'm about to see the shell prompt. (there was a bug in interconnect driver that I found yesterday, this caused a long delay) Anyway, when I run linux kernel on a qemu machine, the boot process ends like this at the shell prompt. (The echo '### INIT SCRIPT ###' was put in /init script which is in the initramfs) Run /init as init process ### INIT SCRIPT ### mount: mounting none on /tmp failed: Invalid argument This boot took 2.12 seconds /bin/sh: can't access tty; job control turned off / # / # Now, when I run it on our FPGA board using u-boot, it ends like this. Run /init as init process ### INIT SCRIPT ### mount: mounting none on /tmp failed: Invalid argument This boot took 0.00 seconds /bin/sh: can't acce So it seems this init_kernel thread executes /init and /init excutes /bin/sh at the end. this is the /init script. #!/bin/sh echo "### INIT SCRIPT ###" mkdir /proc /sys /tmp mount -t proc none /proc mount -t sysfs none /sys mount -t tmpfs none /tmp echo -e "\nThis boot took $(cut -d' ' -f1 /proc/uptime) seconds\n" #ifconfig eth0 10.0.2.15 netmask 255.255.255.0 up #route add default gw 10.0.2.2 exec /bin/sh Somehow the busybox applet /bin/sh is stuck somewhere. Can anybody tell me where I should look? Or how to debug this? Thanks in advance! Chan Kim ------=_NextPart_000_060F_01D8B30D.7E1BFDA0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable busybox shell doesn't come up or get stuck.. = where should I look or how should I debug it?

Hello, = all,

 

In the = initramfs.cpio.gz file from the busybox, when I replace the /init script = to an executable binary called ‘init’, (which prints Hello! = Repeatedly),

The output from = the board looks like this. 

(...)

### point 106

### point 106-1

Run /init as init process

### point 106-2, ret =3D -2

Failed to execute /init (error -2)

### point 107

### point 107-1

Run /init as init process

### point 107-2, ret =3D -2

Kernel panic - not syncing: Requested init /init failed (error = -2).

CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-rc5 = #197

Hardware name: ETRI ab21m (DT)

Call trace:

dump_backtrace+0x0/0x190

show_stack+0x14/0x30

dump_stack+0xcc/0x104

panic+0x16c/0x328

kernel_init+0x178/0x264

ret_from_fork+0x10/0x18

Kernel Offset: disabled

CPU features: 0x0000007,78002c18

Memory Limit: none

---[ end Kernel panic - not syncing: Requested init /init = failed (error -2). ]---

 

The related = source code (init/main.c) looks like this (trying it first from the = ramdisk.  ‘init=3D/init’ was given from the bootargs in = device tree)

 

printk("### point 106\n");

    if (ramdisk_execute_command) = {

        printk("### = point 106-1\n");

        ret =3D = run_init_process(ramdisk_execute_command);

        printk("### = point 106-2, ret =3D %d\n", ret);

        if = (!ret)

          &nbs= p; return 0;

        pr_err("Failed = to execute %s (error %d)\n",

          &nbs= p;    ramdisk_execute_command, = ret);

    }

 

    /*

     * We try each of these until one = succeeds.

     *

     * The Bourne shell can be used instead = of init if we are

     * trying to recover a really broken = machine.

     */

    printk("### point = 107\n");

    if (execute_command) = {

        printk("### = point 107-1\n");

        ret =3D = run_init_process(execute_command);

        printk("### = point 107-2, ret =3D %d\n", ret);

        if = (!ret)

          &nbs= p; return 0;

        = panic("Requested init %s failed (error = %d).",

          &nbs= p;   execute_command, ret);

    }

 

I compiled the = init program by the command “aarch64-none-linux-gcc -static -o = init test.c”.

When = ‘init’ was a script, some lines of it was processed ok, but = when I replace ‘init’ to a binary program, it just failed = with -2.

I find error code = 2 is ‘No such file or directory’ which is strange because my = ‘init’ program was under / when I made the = initramfs.cpio.gz.

Can anyone give = me any advice?

 

Thank = you!

Chan = Kim

 

From: Chan Kim = <ckim@etri.re.kr>
Sent: Friday, August 12, 2022 5:32 = PM
To: kernelnewbies@kernelnewbies.org
Subject: = busybox shell doesn't come up or get stuck.. where should I look or how = should I debug it?

 

Hi all,

I'm trying to boot = linux with minimal = config on our FPGA board = which is under development.

After months of = trying (but I tried this = intermittently) I think I'm about = to see the shell prompt.

(there was a bug in = interconnect driver that I found yesterday, = this caused a long delay)

Anyway, when I run = linux kernel on a qemu machine, the boot process ends like this at the = shell prompt.

(The echo '### INIT SCRIPT = ###' was put in = /init script which is = in the initramfs)

    =

    Run = /init as init process

    ### = INIT SCRIPT ###

    mount: = mounting none on /tmp failed: Invalid argument

    =

    This = boot took 2.12 seconds

    =

    /bin/sh: can't access tty; job control turned off

    / # =

    / = #

Now, when I run it = on our FPGA board using u-boot, it ends like this.

    =

    Run = /init as init process

    = ### INIT SCRIPT ###

    = mount: mounting none on /tmp failed: Invalid argument

    =

    = This boot took 0.00 = seconds

    =

    = /bin/sh: can't acce

    =

So it seems this = init_kernel thread executes = /init and /init excutes /bin/sh at the end.

this is the /init = script.

#!/bin/sh

echo "### INIT = SCRIPT ###"

mkdir /proc /sys = /tmp

mount -t proc none = /proc

mount = -t sysfs none = /sys

mount -t tmpfs none = /tmp

echo -e = "\nThis boot took $(cut -d' ' -f1 /proc/uptime) = seconds\n"

#ifconfig eth0 = 10.0.2.15 netmask 255.255.255.0 up

#route = add default gw 10.0.2.2

exec = /bin/sh

Somehow the busybox applet = /bin/sh is stuck somewhere.

Can anybody tell me = where I should look? Or how to debug = this?

Thanks = in advance!

Chan = Kim

------=_NextPart_000_060F_01D8B30D.7E1BFDA0-- --===============0943082088371894253== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============0943082088371894253==--