How to support "bash" on system

It seems that “bash” is not supported on the system (not found in /bin/bash)

Because many shell scripts (#!/bin/bash) are currently used, they cannot be executed directly
There will be an error as below:
-sh: ./ not found

How can I make the system support bash?

I think it can run bash script, it just cannot find

Yes, it can work if I change the head of script from “#!/bin/bash” to “#!/bin/sh”
or use command “sh”

But I want to be able to execute the script directly “./”

You can see here

1 Like

I tried to add the compiled bash bin file to /bin/bash
But it appears:
/bin/bash: Read-only file system

How do I put bash into /bin
(Or can it be instll to the /bin folder when compiling Yocto)

You need to recompile the yocto and download the yocto.cwe to module

1 Like

There are some other options too:

  1. If you use a sandboxed Legato app to install your script, you can put bash in the bin directory of your app and it will appear at /bin/bash in your app’s chrooted sandbox.
  2. If you are not using Legato apps, or you are building an unsandboxed app, you can use bind mounts to make your bash executable appear at /bin/bash in the root file system.
  3. You can use union/overlay file system. There’s one already installed on the target that is used for /lib and /etc.



1 Like

Thank you for your suggestions

I have tried to put the file into “build_bin/tmp/work/swi_mdm9x28_wp-poky-linux-gnueabi/mdm9x28-image-minimal/1.0-r0.0/rootfs” and make again
But the file will be removed after make

I am new to Yocto, which bb file do I need to modify before it can be placed in the “/bin” folder?

  1. add the following line in ./meta-swi/meta-swi-mdm9x28/recipes-core/images/

IMAGE_INSTALL_append = " bash"

  1. type “make” to make the yocto image.

  2. after download the yocto image to module, I can see this in FW R16:

root@swi-mdm9x28-wp:~# ls /bin/sh
root@swi-mdm9x28-wp:~# ls /bin/bash
root@swi-mdm9x28-wp:~# cm info
Device:                        WP7609
IMEI:                          359782080100399
IMEISV:                        E
FSN:                           WA803370010610
Firmware Version:              SWI9X07Y_02.37.03.00 73df45 jenkins 2020/04/08 10:59:14
Bootloader Version:            SWI9X07Y_02.37.03.00 73df45 jenkins 2020/04/08 10:59:14
MCU Version:                   002.015
PRI Part Number (PN):          9908102
PRI Revision:                  001.000
Carrier PRI Name:              GENERIC
Carrier PRI Revision:          002.095_000
SKU:                           1103843
Last Reset Cause:              Reset, User Requested
Resets Count:                  Expected: 243    Unexpected: 243
1 Like

It’s work!
Thank you so much for your response!