Import a Jail

Status
Not open for further replies.

mewhalen

Cadet
Joined
Oct 4, 2013
Messages
3
I used "warden export <jail> to export a jail from a FreeNAS box, which was successful. I then ran "warden import <jail> to import the jail to a new FreeNAS box. When I attempt to set the IP on the imported jail, I receive the following;

Request Method:POST
Request URL:http://10.0.0.17/jails/edit/1
Software Version:FreeNAS-9.2.1.9-RELEASE-x64 (2bbba09)
Exception Type:warden_exception
Exception Value:
ERROR: No such jail!
Exception Location:/usr/local/www/freenasUI/../freenasUI/common/warden.py in run, line 447
Server time:Sun, 7 Dec 2014 17:34:17 -0800
Traceback
Environment: Software Version: FreeNAS-9.2.1.9-RELEASE-x64 (2bbba09) Request Method: POST Request URL: http://10.0.0.17/jails/edit/1 Traceback: File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 107. response = middleware_method(request, callback, callback_args, callback_kwargs) File "/usr/local/www/freenasUI/../freenasUI/freeadmin/middleware.py" in process_view 158. return login_required(view_func)(request, *view_args, **view_kwargs) File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view 22. return view_func(request, *args, **kwargs) File "/usr/local/www/freenasUI/../freenasUI/jails/views.py" in jail_edit 93. form.save() File "/usr/local/www/freenasUI/../freenasUI/jails/forms.py" in save 732. Warden().set(**args) File "/usr/local/www/freenasUI/../freenasUI/common/warden.py" in set 1069. return self.__call(warden_set(flags, **kwargs)) File "/usr/local/www/freenasUI/../freenasUI/common/warden.py" in __call 1021. tmp = obj.run() File "/usr/local/www/freenasUI/../freenasUI/common/warden.py" in run 447. raise warden_exception(msg) Exception Type: warden_exception at /jails/edit/1 Exception Value: ERROR: No such jail!
Request information
GET
No GET data
POST
VariableValue
jail_flagsu'allow.raw_sockets=true'
jail_ipv6_prefixu''
jail_ipv6u''
jail_ipv4u'10.0.0.18'
jail_hostu'Syncrify'
jail_alias_bridge_ipv4u''
jail_alias_bridge_ipv6u''
__form_idu'form_JailsEditForm'
__all__u''
jail_alias_ipv6u''
jail_alias_ipv4u''
jail_ipv4_netmasku'24'
FILES
No FILES data
COOKIES
VariableValue
csrftoken'JwUwxwW5LgW2zxPTxQU5I0kIUWAnDYpr'
fntreeSaveStateCookie'root%2Croot%2F142%2Croot%2F142%2F148%2Croot%2F142%2F148%2F150%2Croot%2F147%2Croot%2F147%2F153%2Croot%2F147%2F153%2F155%2Croot%2F110%2Croot%2F155%2Croot%2F155%2F166%2Croot%2F155%2F161%2Croot%2F155%2F161%2F163%2Croot%2F155%2F165%2Croot%2F150%2Croot%2F150%2F156%2Croot%2F150%2F156%2F158'
sessionid'xjvv22adyox328wqnchw7wla8lxjfhr5'
META
VariableValue
CSRF_COOKIEu'JwUwxwW5LgW2zxPTxQU5I0kIUWAnDYpr'
wsgi.errors<flup.server.fcgi_base.TeeOutputStream object at 0x810880110>
HTTP_HOST'10.0.0.17'
HTTP_X_REQUESTED_WITH'XMLHttpRequest'
SERVER_ADDR'10.0.0.17'
HTTP_REFERER'http://10.0.0.17/'
SERVER_PORT'80'
HTTP_ACCEPT_LANGUAGE'en-US'
HTTP_ACCEPT'*/*'
HTTP_COOKIE'csrftoken=JwUwxwW5LgW2zxPTxQU5I0kIUWAnDYpr; sessionid=xjvv22adyox328wqnchw7wla8lxjfhr5; fntreeSaveStateCookie=root%2Croot%2F142%2Croot%2F142%2F148%2Croot%2F142%2F148%2F150%2Croot%2F147%2Croot%2F147%2F153%2Croot%2F147%2F153%2F155%2Croot%2F110%2Croot%2F155%2Croot%2F155%2F166%2Croot%2F155%2F161%2Croot%2F155%2F161%2F163%2Croot%2F155%2F165%2Croot%2F150%2Croot%2F150%2F156%2Croot%2F150%2F156%2F158'
wsgi.version(1, 0)
SERVER_SOFTWARE'nginx/1.4.4'
HTTP_X_CSRFTOKEN'JwUwxwW5LgW2zxPTxQU5I0kIUWAnDYpr'
HTTP_DNT'1'
QUERY_STRING''
REMOTE_ADDR'10.0.0.202'
wsgi.multithreadTrue
SCRIPT_NAMEu''
wsgi.input<flup.server.fcgi_base.InputStream object at 0x80c298050>
HTTP_ACCEPT_ENCODING'gzip, deflate'
HTTP_CONTENT_LENGTH'244'
GATEWAY_INTERFACE'CGI/1.1'
HTTP_USER_AGENT'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko'
PATH_INFOu'/jails/edit/1'
REDIRECT_STATUS'200'
REMOTE_PORT'50807'
wsgi.url_scheme'http'
SERVER_NAME'localhost'
SERVER_PROTOCOL'HTTP/1.1'
wsgi.run_onceFalse
DOCUMENT_ROOT'/usr/local/etc/nginx/html'
CONTENT_TYPE'application/x-www-form-urlencoded'
CONTENT_LENGTH'244'
HTTP_CONNECTION'Keep-Alive'
REQUEST_URI'/jails/edit/1'
DOCUMENT_URI'/jails/edit/1'
HTTP_CACHE_CONTROL'no-cache'
HTTP_CONTENT_TYPE'application/x-www-form-urlencoded'
REQUEST_METHOD'POST'
wsgi.multiprocessFalse
 

sysfu

Explorer
Joined
Jun 16, 2011
Messages
73
I'm unable to export/import jails via warden as well.

Jails appear to successfully export via the warden export jailname command, however subsequent import attempts fail like so:

# warden import freshjail.wdn
/usr/local/share/warden/scripts/backend/importjail.sh: cannot open freshjail.header : No such file or directory
ERROR: Specified file is a incompatiable .wdn file!

Related bug report
 

Nick Longo

Dabbler
Joined
Jan 30, 2015
Messages
17
I had this same problem and the issues are actually with the script. Not the file itself. The do-while loop that goes through the header file has an extra space.
Code:
done < "$HEADER "  
 
     vs.

done < "$HEADER"

So it says no such file when it really is trying to read a file with an extra space character at the end.

The other thing since my JAILS are using DHCP with static maps based on mac address, it yelled at my second import for using the same "DHCP/" ip address. So I just cut that code block out of the script since I knew mine were ok. I did have to open each via the web interface uncheck/recheck DHCP again though to get the settings to something other than OFF.

Finally, once loaded it got the "multiple ID's found" type of query error. For some reason the script to assign a unique id wasn't working either. I didn't debug that...i just went into the .JAIL_NAME.meta directory and updated the 'id' file to make them all unique.
 

aidman

Cadet
Joined
Jan 26, 2015
Messages
2
I had this same problem and the issues are actually with the script. Not the file itself. The do-while loop that goes through the header file has an extra space.
Code:
done < "$HEADER "

     vs.

done < "$HEADER"

So it says no such file when it really is trying to read a file with an extra space character at the end.

The other thing since my JAILS are using DHCP with static maps based on mac address, it yelled at my second import for using the same "DHCP/" ip address. So I just cut that code block out of the script since I knew mine were ok. I did have to open each via the web interface uncheck/recheck DHCP again though to get the settings to something other than OFF.

Finally, once loaded it got the "multiple ID's found" type of query error. For some reason the script to assign a unique id wasn't working either. I didn't debug that...i just went into the .JAIL_NAME.meta directory and updated the 'id' file to make them all unique.

This was extremely helpful for me. Specifically I fixed line 141, and commented out lines 43-64, and 159-198 of /usr/local/share/warden/scripts/backend/importjail.sh. For ease of finding an empty id, I just catted all the ids with cat /mnt/MEDIA/jails/.*.meta/id

Edit: after further playing, I would not recommend commenting out a bunch of the code like I did. There seems to be some erratic behavior. The line 141 fix is straightforward and makes sense, but I've had hit and misses for imports.
 
Last edited:
Status
Not open for further replies.
Top