update a running busybox

Arno Steffen arno.steffen at googlemail.com
Tue Apr 5 12:41:48 UTC 2011


2011/4/5 Ralf Friedl <Ralf.Friedl at online.de>:
> Arno Steffen wrote:
>>
>> 2011/3/29 Harald Becker <ralda at gmx.de>:
>>
>>>>
>>>> You can try
>>>>
>>>> ln /bin/busybox /bin/busybox.old
>>>> mv busybox /bin/busybox
>>>>
>>>> Then remove /bin/busybox.old after the next reboot.
>>>>
>>>
>>> That is the best way to replace any running executable in place, but
>>> doesn't solve the "Device busy" problem in all cases (that even arise
>>> due to other actions, not only Busybox update). As those problems are a
>>> mess on flash file systems, I focused on the reboot question ... but
>>> otherwise you are right. You can even remove busybox.old right after the
>>> move, it than gets deleted on shutdown automatically.
>>>
>>> --
>>> Harald
>>>
>>
>> I cannot confirm that remove of busybox_old is working before reboot.
>> In this case your device will keep busy and it is impossible to
>> remount in read-only.
>> That's pity, as I like this method.
>> Regards
>> Arno
>
> If you remove the old program after the move, you might as well omit the
> link completely.
> The effect of the additional link is that the program will not be removed at
> shutdown, as there exists a link to the file.
> If you remove the link, or don't create the link at all, there is no
> reference left to the file, just the running processes executing the
> program. Therefor the file will be removed when the last process exits,
> which will likely be init.
> Most file systems will deal with this without any problems.
> In this case the problem is either the flash file system itself that doesn't
> handle this case, or it may be the fact that the file system was remounted
> read only, although updates were pending.
> That should be easy to find out, just replace busybox and then do a reboot
> without remounting read only.
>
> Ralf
>

Ok, I leave my busybox_old in system. Nevertheless I have the problem,
that I can't do
mount -r -o remount /    (mount: mounting /dev/root on / failed:
Device or resource busy)

Usually an reboot is next command. If I comment it out I can manually
remount / without any problem.
And it is not a matter of time. I have done long sleeps befor umount
command. So it seems,
that the script itself is the problem.  If I copy this script to /tmp
(ramdisk) and start it from this place
the remount works.

Arno


More information about the busybox mailing list