Question about the installation directory of programs

Tito farmatito at tiscali.it
Sat Nov 9 07:04:38 UTC 2013


On Saturday 09 November 2013 03:57:00 ChenQi wrote:
> On 11/08/2013 04:13 AM, Joshua Judson Rosen wrote:
> > On 2013-11-07 01:56, ChenQi wrote:
> >> Hi all,
> >>
> >> Forgive me if this is a dummy question.
> >> I see the installation directories of programs are controlled by the
> >> applets.src.h file.
> >> Some of them are installed into /usr while some of them are not.
> >> Is there a criteria to determine whether a program goes into /usr or 
> >> not.
> >> For example, why is `rpm' installed into /bin while `tail' is 
> >> installed into
> >> /usr/bin?
> >
> > I believe rpm is installed into /bin because RedHat and related 
> > systems like SuSE,
> > whose practices are being emulated by Busybox, install rpm into /bin.
> >
> > In other words, Busybox is following existing conventions.
> >
> > Are you asking because you have an implementation of a new applet
> > that you'd like to integrate into busybox?
> >
> 
> I'm asking this because our project may also need a separation of / and 
> /usr. In other words, we need to make sure the system can still boot up 
> for recovery and repair even if /usr is missing.
> 
> As busybox is an important part of our system, I want to know your 
> opinions on this issue.
> 
> Best Regards,
> Chen Qi
Hi,
you can separate /bin and /usr but you need to put the busybox binary in /bin
so you have de facto  all applets  usable even if /usr is not mounted.
The applets  missing a link in /bin are still execable with:

./busybox applet args

or eventually you can create links on the fly at boot if needed so that they are in PATH:

busybox --install -s /bin

There are also this options in the config system that could be of interest for you:

General configuration-> Don't use /usr
General configuration->CONFIG_FEATURE_PREFER_APPLETS  (rather problematic)

"This is an experimental option which directs applets about to                                 
 call 'exec' to try and find an applicable busybox applet before                                
 searching the PATH. This is typically done by exec'ing                                         
 /proc/self/exe.                                                                                
 This may affect shell, find -exec, xargs and similar applets.                                  
 They will use applets even if /bin/<applet> -> busybox link                                    
 is missing (or is not a link to busybox). However, this causes                                 
 problems in chroot jails without mounted /proc and with ps/top                          
 (command name can be shown as 'exe' for applets started this way)."

The easiest solution IMHO is:

1) put busybox in /bin
2) change your startup scripts to call all progs needed as
      /bin/busybox applet args

so as long as there is /bin your system will boot.

Ciao,
Tito
 





More information about the busybox mailing list