Unable to upload TrueNas 12.0-Beta config to fresh 12.0-Beta install

Jayrel

Dabbler
Joined
Aug 5, 2020
Messages
12
I have seen two other threads about the bug with uploading a config on TrueNas 12.0-Beta. Although they are not showing the similar error I am facing. This is making my a little uncertain as to how to move forward. Would anyone be able to provide some step-by-step instruction on how to fix the bug that I have included in the post? Or how to correct the upload issue all together?

Kind Regards
 

Attachments

  • truenas-12-upload error.jpg
    truenas-12-upload error.jpg
    32.9 KB · Views: 254

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Yup that’s the one. The other thread has a link to the patch. Apply it, and it’ll work. Or wait until beta 2 is out, which should be MoreSoonerish.
 

Jayrel

Dabbler
Joined
Aug 5, 2020
Messages
12
Yup that’s the one. The other thread has a link to the patch. Apply it, and it’ll work. Or wait until beta 2 is out, which should be MoreSoonerish.

Okay I see. What are the steps to apply the patch in the link via cli?
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
I just did it manually, by copy/pasting the right bits in and deleting what wasn’t needed, in an editor in an SSH session. I’m sure that’s the worst possible way of doing it - Google will no doubt be able to explain how the “patch” command works and how to do this properly.
 

Cyberpower678

Dabbler
Joined
Jul 27, 2020
Messages
37
I just did it manually, by copy/pasting the right bits in and deleting what wasn’t needed, in an editor in an SSH session. I’m sure that’s the worst possible way of doing it - Google will no doubt be able to explain how the “patch” command works and how to do this properly.
Can you point me to this. I am trying to upload my config as well, and I'm exactly where the OP is on this.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912

Cyberpower678

Dabbler
Joined
Jul 27, 2020
Messages
37
Okay, I found it. For reference for others, it's located at /usr/local/lib/python3.8/site-packages/middlewared/plugins/config.py
 

Cyberpower678

Dabbler
Joined
Jul 27, 2020
Messages
37
Alright, after implementing the new config.py file, I tried uploading the config, and I still get the error.
 

Cyberpower678

Dabbler
Joined
Jul 27, 2020
Messages
37
Alright no getting around it. Any attempt to replace the file with what's in the repo causes middleware to fail badly and TrueNAS to not work properly.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Which is surprising, because that is what I think I did, though I manually applied https://github.com/freenas/freenas/commit/e8ad94b9f80947e9876f4861711d682d5e794b4e and then restarted middlewared.

Edit: Compared my edit to what's in the repo. It's the same. Whatever happened here, you likely got something mangled during the creation of your new config.py. I copy/pasted the code from the repo into fnurble.py and compared to my manually edited config.py. Only difference is a couple extra newlines in my version.

Code:
truenas# md5 fnurble.py
MD5 (fnurble.py) = 975e8777c629f70ba683e446ed863070
truenas# diff fnurble.py /usr/local/lib/python3.8/site-packages/middlewared/plugins/config.py
42a43
>
43a45
>
44a47
>
45a49
>
198a203
>


I then moved the repo code into my environment and restarted middlewared. Works, whatever is going is local to you. Assuming you created the file in TrueNAS, not Windows, correct? CRLF would definitely trip you up.


Code:
truenas# mv /usr/local/lib/python3.8/site-packages/middlewared/plugins/config.py /usr/local/lib/python3.8/site-packages/middlewared/plugins/config.py.bak
truenas# cp fnurble.py /usr/local/lib/python3.8/site-packages/middlewared/plugins/config.py
truenas# service middlewared restart
Stopping middlewared.
Waiting for PIDS: 76.
truenas#
 
Last edited:

Cyberpower678

Dabbler
Joined
Jul 27, 2020
Messages
37
Which is surprising, because that is what I think I did, though I manually applied https://github.com/freenas/freenas/commit/e8ad94b9f80947e9876f4861711d682d5e794b4e and then restarted middlewared.

Edit: Compared my edit to what's in the repo. It's the same. Whatever happened here, you likely got something mangled during the creation of your new config.py. I copy/pasted the code from the repo into fnurble.py and compared to my manually edited config.py. Only difference is a couple extra newlines in my version.

Code:
truenas# md5 fnurble.py
MD5 (fnurble.py) = 975e8777c629f70ba683e446ed863070
truenas# diff fnurble.py /usr/local/lib/python3.8/site-packages/middlewared/plugins/config.py
42a43
>
43a45
>
44a47
>
45a49
>
198a203
>


I then moved the repo code into my environment and restarted middlewared. Works, whatever is going is local to you. Assuming you created the file in TrueNAS, not Windows, correct? CRLF would definitely trip you up.


Code:
truenas# mv /usr/local/lib/python3.8/site-packages/middlewared/plugins/config.py /usr/local/lib/python3.8/site-packages/middlewared/plugins/config.py.bak
truenas# cp fnurble.py /usr/local/lib/python3.8/site-packages/middlewared/plugins/config.py
truenas# service middlewared restart
Stopping middlewared.
Waiting for PIDS: 76.
truenas#
No. I've discovered if you leave the .py extension on the only config.py file, middleware will try to load the old and new file and fail spectacularly. After renaming the file once more, middleware started. But I still couldn't import because apparently the config file is newer than the OS version. :/. I'm experimenting with the config.py file to get around that right now.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
check the other thread, there was a bug referenced. You may want to send your db to the same person that solved that issue in that thread.

and yeah it never occurred to me to have a backup file end in .py, interesting thing to run into.
 

Cyberpower678

Dabbler
Joined
Jul 27, 2020
Messages
37
check the other thread, there was a bug referenced. You may want to send your db to the same person that solved that issue in that thread.

and yeah it never occurred to me to have a backup file end in .py, interesting thing to run into.
I've been searching for the other thread, but I can't find it. Maybe my search skills are just bad. :-(
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912

Cyberpower678

Dabbler
Joined
Jul 27, 2020
Messages
37
Yea, I'm reading it, but I'm not keen on DMing a DB file just to fix the version. I could modify the DB file myself.
 

Jayrel

Dabbler
Joined
Aug 5, 2020
Messages
12
Thank you very much. I didn't realized I was getting responses to my thread.
 
Top