On 1/24/25 6:55 PM, Mark Hatle wrote:


On 1/24/25 10:39 AM, Alexander Kanavin via lists.openembedded.org wrote:
I wonder if we can just drop /etc/shells altogether from base-files?

/etc/shells is used by pam as one of it's multiple validation steps.  If the shell is not listed there then remote login can be denied.  So the existence of /etc/shells is definitely required.  The file doesn't need to come from base-files (but usually should).

With that said, "something" needs to provide /bin/sh.  Just dropping / bin/sh from a shell, by itself, it's the right answer as there are ABSOLUTELY systems out there where '/bin/bash' _is_ the only shell installed on the system.

Just like we have busybox only systems providing /bin/sh...

or dash based systems where it is the only thing providing /bin/sh...


I'm more inclined to say that base-files depending on /bin/sh is the error. AFAIK nothing in base-files should require /bin/sh (or are there post-install scripts?).

There is a pre-install script:

$ git grep bin.sh meta/recipes-core/base-files/base-files_3.0.14.bb
meta/recipes-core/base-files/base-files_3.0.14.bb:    #!/bin/sh -e
..
    #!/bin/sh -e
    if [ x"$D" = "x" ]; then
        if [ -h "/var/lock" ]; then
            # Remove the symbolic link
            rm -f /var/lock
        fi

        if [ -h "/run" ]; then
            # Remove the symbolic link
            rm -f /run
        fi
    fi
..

Once that is resolved, then various POSIX / bin/sh providers can each provide it -- using update-alternatives to have the 'best' matching providing the right /bin/sh link.  (This is why update-alternatives [in the past at least] run directly and didn't require a shell to execute.  I don't know that we have the ability to do this with our multi-package support approach though.)

So essential install order may be something like:

base-files
libc (libraries only)
update-alternatives
<a shell>
 - shell calls update-alternatives to register it as /bin/sh, as well as add this as a valid shell to /etc/shells.

End result (for bash)

/bin/sh -> /bin/bash

/etc/shell contains:
   /bin/sh
   /bin/bash

(Note, circular dependencies for some base components have been considered normal in the workstation world.  They work around this by use the 'install' to temporarily provide the /bin/sh and some other resources until they can be installed into the chroot.   This really isn't anything different from what we're doing, we expect some host- system (native) items to be available in order to populate the image.)
[...]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#210255): 
https://lists.openembedded.org/g/openembedded-core/message/210255
Mute This Topic: https://lists.openembedded.org/mt/110778651/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to