Busybox in Debian

Denys Vlasenko vda.linux at googlemail.com
Mon Aug 14 13:30:19 UTC 2017


On Mon, Aug 14, 2017 at 3:05 PM, Ben Hutchings <ben at decadent.org.uk> wrote:
> On Mon, 2017-08-14 at 14:55 +0200, Denys Vlasenko wrote:
>> On Sat, Aug 12, 2017 at 4:15 PM, Ben Hutchings <ben at decadent.org.uk>
>> wrote:
>> > On Fri, 2017-08-11 at 14:54 -0400, Chris Boot wrote:
>> > [...]
>> > > - The default initramfs assembly system, initramfs-tools, incorporates
>> > > busybox into the initramfs and it's used until the root filesystem (and
>> > > /usr if separate) is mounted and can be pivot_rooted into. We also use
>> > > parts of klibc in the initramfs, and I'm not yet entirely clear what
>> > > tools in the initramfs are klibc tools, busybox applets or executables
>> > > copied from the running system.
>> >
>> > [...]
>> >
>> > If initramfs-tools is configured to use busybox, busybox installs all
>> > its commands and then klibc-utils installs any commands that are not
>> > already there.  So for any command that they both implement, the
>> > busybox implementation is used.
>>
>> Do you have a list of tools klibc-utils installs?
>
> If busybox is used, then klibc-utils provides these:
>
> chroot
> losetup
> pivot_root

There are such applets in busybox too.
If they are buggy or incompatible (e.g. a missing option),
please let me know.

> halt
> poweroff
> reboot

These applets are in busybox too, but they may do
bbox-specific actions depending on configuration.

If FEATURE_CALL_TELINIT=y, they run "telinit N",
expecting it to know how to signal init.

Otherwise they assume the bbox init is on the system,
and they simply signal it:
SIGUSR1 = halt, SIGUSR2 = poweroff, SIGTERM = reboot.

        /* talk to init */
        if (!ENABLE_FEATURE_CALL_TELINIT) {
                /* bbox init assumed */
                rc = kill(1, signals[which]);
        } else {
                /* SysV style init assumed */
                /* runlevels:
                 * 0 == shutdown
                 * 6 == reboot */
                execlp(CONFIG_TELINIT_PATH,
                                CONFIG_TELINIT_PATH,
                                which == 2 ? "6" : "0",
                                (char *)NULL
                );
                bb_perror_msg_and_die("can't execute '%s'",
                                CONFIG_TELINIT_PATH);
        }


> fstype

What does this do?


> nfsmount

And this one? If ordinary mount can't mount NFS for some reason,
it's interesting to look into that reason. Sometime ago,
kernel grew the ability to mount NFS without funky binary API
in mount syscall, so it's even easier now - mount tool only has to
resolve DNS name to an IP address.

If you are going to play with it, not that you probaly do _not_
need FEATURE_MOUNT_NFS=y: it is
"Support mounting NFS file systems on Linux < 2.6.23" option,
not "You need this, or else NFS mounts will not work".


> ipconfig
> minips
> nuke
> resume
> run-init

These look like klibc-utils inventions?


More information about the busybox mailing list