PeterPawn / modfs

modify firmware for NAND-flash based FRITZ!Box routers and install it on such a device
GNU General Public License v2.0
63 stars 15 forks source link

firmware 113.07.19-75160 crashes modfs #32

Closed TheChatty closed 4 years ago

TheChatty commented 4 years ago

Previous versions did not crash modfs. I did sed -i "s/134M/144M/" modfs and it worked (booted it already). Attached you can find my debug log. ringbuf.zip

PeterPawn commented 4 years ago

Are you sure, you've edited the modfs file and used the edited one to create the attached log file?

I'm asking, 'cause the log file shows no 144M reference, neither for "144M" nor for "150994944" (144M in byte). Instead there are references of "134M" (line 134) and "140509184" (lines 74,75. 128, 135 and 136) and so it seems to me, your changes were not really applied and nevertheless the script was run successfully.

The only flaw I can see in your log file, are the lines 301 and 302, where an existing bootmanager cache has to be flushed and it seems, that the running system doesn't support the date command, used at line 1318 of an earlier version of gui_bootmanager: https://github.com/PeterPawn/YourFritz/blob/4cf1a1c00a71a4c5390a7816390e5560fbb1b0f6/bootmanager/gui_bootmanager

I've no idea, what's the reason for a missing date command may be. Usually the whole modfs call is wrapped with the provided (statically linked) BusyBox (line 7 of the log file) and any called command is firstly looked up to be an applet of the current BusyBox instance. The provided BusyBox binary contains this applet for sure:

root@fb7490:/var/media/ftp/YourFritz/modfs/bin/VR9_3.10.107 $ ./busybox date --help
BusyBox v1.27.2 multi-call binary.

Usage: date [OPTIONS] [+FMT] [TIME]

Display time (using +FMT), or set time

        [-s,--set] TIME Set time to TIME
        -u,--utc        Work in UTC (don't convert to local time)
        -R,--rfc-2822   Output RFC-2822 compliant date string
        -I[SPEC]        Output ISO-8601 compliant date string
                        SPEC='date' (default) for date only,
                        'hours', 'minutes', or 'seconds' for date and
                        time to the indicated precision
        -r,--reference FILE     Display last modification time of FILE
        -d,--date TIME  Display TIME, not 'now'
        -D FMT          Use FMT for -d TIME conversion

Recognized TIME formats:
        hh:mm[:ss]
        [YYYY.]MM.DD-hh:mm[:ss]
        YYYY-MM-DD hh:mm[:ss]
        [[[[[YY]YY]MM]DD]hh]mm[.ss]
        'date TIME' form accepts MMDDhhmm[[YY]YY][.ss] instead

and even if it could not be found as applet from the current BusyBox instance, it should be still available as symlink from /bin/date to busybox, as long as a valid PATH value is provided.

My own latest log file shows no problems, too:

2019-12-05 20:12:36.170 - modfs: gui_bootmanager found, cached data cleared, trying to refresh cache:
2019-12-05 20:12:37.143 - <br><h3>Folgende Systeme stehen auf dieser FRITZ!Box zur Auswahl bei einem Neustart:</h3><br>
2019-12-05 20:12:37.143 - <input type="radio" id="radioRunning" name="linux_fs_start" value="running">
2019-12-05 20:12:37.143 - <label for="radioRunning">
2019-12-05 20:12:37.143 - <b>das aktuell laufende System</b> (linux_fs_start=1)
2019-12-05 20:12:37.143 - <br><br>Version 113.07.11 vom 22.05.2019, 10:47:40 Uhr<br>
2019-12-05 20:12:37.143 - zuletzt modifiziert am 05.06.2019, 21:34:42 Uhr durch "modfs"
2019-12-05 20:12:37.143 - </label>
2019-12-05 20:12:37.144 - <br><br>
2019-12-05 20:12:37.144 - <input type="radio" id="radioAlternative" name="linux_fs_start" value="alternative" checked="checked">
2019-12-05 20:12:37.144 - <label for="radioAlternative">
2019-12-05 20:12:37.144 - <b>das derzeit inaktive System</b> (linux_fs_start=0)
2019-12-05 20:12:37.144 - <br><br>Version 113.07.19-73513 vom 19.11.2019, 17:24:14 Uhr<br>
2019-12-05 20:12:37.144 - zuletzt modifiziert am 05.12.2019, 20:05:14 Uhr durch "modfs"
2019-12-05 20:12:37.144 - </label>
2019-12-05 20:12:37.144 - <br><br>
2019-12-05 20:12:37.144 - <h4>Branding &auml;ndern</h4>
2019-12-05 20:12:37.144 - <span id="running_branding">
2019-12-05 20:12:37.144 - Das oben ausgew&auml;hlte System unterst&uuml;tzt mehrere Firmware-Versionen, im Moment ist "<b>avm</b>" eingestellt.
2019-12-05 20:12:37.144 - <br>
2019-12-05 20:12:37.144 - <label for="idRunningBranding">
2019-12-05 20:12:37.144 - Beim n&auml;chsten Start wird folgender Wert gesetzt und bis zur n&auml;chsten &Auml;nderung verwendet:&nbsp;
2019-12-05 20:12:37.144 - </label>
2019-12-05 20:12:37.144 - <select id="idRunningBranding" name="running_branding">
2019-12-05 20:12:37.144 - <option value="1und1">1und1</option>
2019-12-05 20:12:37.144 - <option value="avm" selected="selected">avm</option>
2019-12-05 20:12:37.144 - </select>
2019-12-05 20:12:37.144 - </span>
2019-12-05 20:12:37.144 - <span id="alternative_branding">
2019-12-05 20:12:37.144 - Das oben ausgew&auml;hlte System unterst&uuml;tzt mehrere Firmware-Versionen, im Moment ist "<b>avm</b>" eingestellt.
2019-12-05 20:12:37.144 - <br>
2019-12-05 20:12:37.144 - <label for="idAlternativeBranding">Beim n&auml;chsten Start wird folgender Wert gesetzt und bis zur n&auml;chsten &Auml;nderung verwendet:&nbsp;</label>
2019-12-05 20:12:37.144 - <select id="idAlternativeBranding" name="alternative_branding">
2019-12-05 20:12:37.144 - <option value="1und1">1und1</option>
2019-12-05 20:12:37.144 - <option value="avm" selected="selected">avm</option>
2019-12-05 20:12:37.144 - </select>
2019-12-05 20:12:37.144 - </span>
2019-12-05 20:12:37.144 - <script type="text/javascript">
2019-12-05 20:12:37.144 - function onBootManagerClick(evt) {
2019-12-05 20:12:37.144 - var radioButton = jxl.evtTarget(evt);
2019-12-05 20:12:37.144 - if ( radioButton.id == "radioRunning" ) {
2019-12-05 20:12:37.144 - jxl.show("running_branding");
2019-12-05 20:12:37.144 - jxl.hide("alternative_branding");
2019-12-05 20:12:37.144 - } else {
2019-12-05 20:12:37.144 - jxl.hide("running_branding");
2019-12-05 20:12:37.144 - jxl.show("alternative_branding");
2019-12-05 20:12:37.144 - }
2019-12-05 20:12:37.144 - }
2019-12-05 20:12:37.144 - function initBootManager() {
2019-12-05 20:12:37.145 - jxl.addEventHandler("radioRunning","click",onBootManagerClick);
2019-12-05 20:12:37.145 - jxl.addEventHandler("radioAlternative","click",onBootManagerClick);
2019-12-05 20:12:37.145 - jxl.display("running_branding", false);
2019-12-05 20:12:37.145 - jxl.display("alternative_branding", true);
2019-12-05 20:12:37.145 - }
2019-12-05 20:12:37.145 - ready.onReady(initBootManager);
2019-12-05 20:12:37.145 - </script>
2019-12-05 20:12:37.298 - active_version="113.07.11"
2019-12-05 20:12:37.298 - active_date="22.05.2019, 10:47:40 Uhr"
2019-12-05 20:12:37.298 - active_modified_by="modfs"
2019-12-05 20:12:37.298 - active_modified_at="05.06.2019, 21:34:42 Uhr"
2019-12-05 20:12:37.298 - active_brandings="1und1 avm"
2019-12-05 20:12:37.298 - inactive_version="113.07.19-73513"
2019-12-05 20:12:37.298 - inactive_date="19.11.2019, 17:24:14 Uhr"
2019-12-05 20:12:37.298 - inactive_modified_by="modfs"
2019-12-05 20:12:37.298 - inactive_modified_at="05.12.2019, 20:05:14 Uhr"
2019-12-05 20:12:37.298 - inactive_brandings="1und1 avm"
2019-12-05 20:12:37.298 - current_branding="avm"
2019-12-05 20:12:37.298 - switch_branding_support=true
2019-12-05 20:12:37.298 - current_switch_value=1
2019-12-05 20:12:37.299 - system_is_switched=true
2019-12-05 20:12:37.345 - modfs: switching system done, rc=0

... it only shows, that I should suppress the output of gui_bootmanager html_display call (https://github.com/PeterPawn/modfs/blob/master/modfs#L3547) to the modfs log, because the 2nd call to display values should do the job alone (or a 3rd call with debug is the best option).

At the end I'm a little bit puzzled, where the two flaws (your earlier reported problems to unpack the latest inhouse/labor version and the logged error finding the date command) have their roots - they were never reported in the past by any user and the "main" problem from https://www.ip-phone-forum.de/threads/modfs-squashfs-image-avm-firmware-%C3%A4ndern-f%C3%BCr-nand-basierte-fritz-boxen.273304/post-2354951 seems to be unreproducable.

TheChatty commented 4 years ago

You're right... I ran modfs unchanged. But unlike several runs before it succeeded this time. I just updated from 75160 to 75213 and it worked as well. Even no date not found error. There was no change from my side in the modfs folder. ringbuf-75213.zip