4

I am working on a system that I did not create the BusyBox build for. I do not want to recompile BusyBox for fear that my configuration will not completely match the original and besides this the system is functioning well enough on this build. I could be swayed to do this if I knew of a way to pull the configuration of a running BusyBox install much like a running kernel.

I am trying to figure out how to disable the switches used to call udhcpc from the ifup command. I can see the defaults compiled into the build that I am using. They are -R -n -p. I want for this process to fork into the background and I thought using udhcpc_opts -b in /etc/networking/interfaces would solve this issue. I get the fork to the background and then the process kills. If i just call udhcpc -b it forks to the background indefinitely.

Is there a way to override the -n switch through something I can put into udhcpc_opts? Thank you.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Matt Minga
  • 73
  • 1
  • 8

3 Answers3

7

Having the same problem, did not want to recompile busybox and wanted to use those flags: "-t 0 -b" to let udhcpc try forever in background, but could not avoid flag "-n" that is passed by default by ifup.

As a super-hack (but it worked for me) I used the following options for udhcpc_opts in /etc/network/interfaces:

udhcpc_opts -t 0 -T 10 -A 20 -S &

The final "&" did the trick, as it launchs udhcpc as a background task and is almost the same of the "-b" flag, but works also if the "-n" is specified in the command line.

Note, that it has to be added to iface option to work, eg:

iface eth0 inet dhcp
    udhcpc_opts -t 0 -T 10 -A 20 -S &
Staszek
  • 165
  • 9
thepyper
  • 86
  • 1
  • 2
2

Behavior of udhcpc -n -b has been corrected to behave like udhcpc -b in a fix for busybox bug #11691.

Thus, starting with busybox-1.31 (yet to be released as of now), udhcpc_opts -b should just work as expected.

Andrey
  • 68
  • 5
1

I found that I was unable to override the default switches. I was able to append switches to the default call of udhcpc, but the switch forking to the background, -b, and exiting on failure, -n, are not mutually exclusive. Thus forking to the background would not stop the exiting behavior.

To append the switches to the command, I had to add udhcpc_opts to the in the ethX stanze of the /etc/network/interfaces file.

Ultimately I wound up having to recompile busybox so that the udhcpc process could fork to the background and remain running.

Matt Minga
  • 73
  • 1
  • 8