Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: header "TCF1" does not match expected NVRAM cfg format -- aborting #7

Open
alexstaj opened this issue Mar 21, 2019 · 5 comments

Comments

@alexstaj
Copy link

alexstaj commented Mar 21, 2019

Hi

Got this error when run. Any help would be much appreciated.

MBP13:Downloads tha$ nvramcfg decode tomato_v128_mE8D0A2.cfg 
error: header "TCF1" does not match expected NVRAM cfg format -- aborting
/usr/local/lib/node_modules/nvram-cfg-parser/nvram-parser.js:135
      body = buf.slice(NvramParser.headerbuf.length, +(-NvramParser.footerbuf.length) + 1 || 9e9);
                 ^

TypeError: Cannot read property 'slice' of undefined
    at Function.NvramParser.parse (/usr/local/lib/node_modules/nvram-cfg-parser/nvram-parser.js:135:18)
    at /usr/local/lib/node_modules/nvram-cfg-parser/nvram-parser.js:175:32
    at Deferrals.exports.Deferrals.Deferrals._call (/usr/local/lib/node_modules/nvram-cfg-parser/node_modules/iced-runtime/lib/runtime.js:86:16)
    at /usr/local/lib/node_modules/nvram-cfg-parser/node_modules/iced-runtime/lib/runtime.js:98:26
    at trampoline (/usr/local/lib/node_modules/nvram-cfg-parser/node_modules/iced-runtime/lib/runtime.js:64:14)
    at Deferrals.exports.Deferrals.Deferrals._fulfill (/usr/local/lib/node_modules/nvram-cfg-parser/node_modules/iced-runtime/lib/runtime.js:96:16)
    at ret (/usr/local/lib/node_modules/nvram-cfg-parser/node_modules/iced-runtime/lib/runtime.js:29:18)
    at /usr/local/lib/node_modules/nvram-cfg-parser/nvram-parser.js:124:13
    at /usr/local/lib/node_modules/nvram-cfg-parser/nvram-parser.js:94:22
    at Deferrals.exports.Deferrals.Deferrals._call (/usr/local/lib/node_modules/nvram-cfg-parser/node_modules/iced-runtime/lib/runtime.js:86:16)
@jay
Copy link
Contributor

jay commented Mar 22, 2019

I have a branch where I made some changes to ignore the specific TCF1 hardware ID. Try master...jay:enhancement_hwid see if helps. I never submitted it as a PR. The last PR I submitted didn't have any response and the project seems dead.

Not for production since it doesn't have any review and this isn't my wheelhouse, but I'm curious to know if it works for you.

@alexstaj
Copy link
Author

alexstaj commented Mar 27, 2019

thanks. did you also implement this change too?

ilium007@cdf6e55

And how can I install your version?

and how does the router know when I'm restoring a config to a different router?

@jay
Copy link
Contributor

jay commented Mar 29, 2019

thanks. did you also implement this change too?

ilium007@cdf6e55

I use a branch master...jay:working which contains that fix as well as master...jay:enhancement_hwid and master...jay:fix_parsing_skipping_some_pairs and master...jay:enhancement_sort_json but I'm not sure if the sorting one was a good idea or even correct I seem to remember it's unpolished or I had some issue with it.

Capture

And how can I install your version?

sudo apt install nodejs-legacy npm
sudo npm install -g git+https://[email protected]/jay/nvram-cfg-parser.git#working
...
sudo npm uninstall nvram-cfg-parser -g git+https://[email protected]/jay/nvram-cfg-parser.git#working

and how does the router know when I'm restoring a config to a different router?

I don't know if restoring a cfg to a different hwid will result in corruption.

I think it bears repeating that I abandoned this work due to lack of feedback and it's not production ready.

@m-z-b
Copy link

m-z-b commented Nov 12, 2021

The .cfg file from the current MIPS version of FreshTomato can be turned into something readable as follow:

gzip -d < tomato-settings.cfg > settings-with-nulls.cfg
sed 's/\x0/\n/g' settings-with-nulls.cfg > readable.txt

(I just had my router die, and I needed to get a readable version of the settings from a backup to set up the new router...)

I suspect this might work for ARM too.

@alerque
Copy link

alerque commented Nov 25, 2021

@jay I for one would find your branches useful. I'm trying to wade through how to get them up and running now, but I wonder if the original author is around now and might accept PRs if we can get it all working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants