# Cannot re-register agent: \`Failed to load registration env\`

**URL:** <https://forums.suse.com/t/cannot-re-register-agent-failed-to-load-registration-env/5113>\
**Category:** Rancher 1.x\
**Created:** [January 6, 2017, 1:29am UTC](https://forums.suse.com/t/cannot-re-register-agent-failed-to-load-registration-env/5113 "2017-01-06T01:29:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_Lasiewski](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/stefan_lasiewski/32/1801_2.png) [@Stefan\_Lasiewski](https://forums.suse.com/u/Stefan_Lasiewski)\
**Post date:** [January 6, 2017, 1:29am UTC](https://forums.suse.com/t/cannot-re-register-agent-failed-to-load-registration-env/5113/1 "2017-01-06T01:29:56Z")

</div>

After upgrading from Rancher 1.2.0 to 1.2.2 yesterday.

Today, I discovered that Rancher shows the host as ‘Disconnected’. I couldn’t figure out why this was happening, so I tried to re-register the host with a new Rancher Agent. However, the Rancher Agent is showing some sort of problem when trying to re-register itself. What could cause this problem?

I start the Rancher Agent, and it exits fairly quickly. I see that the rancher-agent bootstrap container doesn’t fire off any new containers from the rancher/agent image:

```
[root@docker01 ~]# docker run -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.1.2 https://rancher01.example.org/v1/scripts/blahblah1:12345blah:blahblah

[root@rancher01 ~]# docker ps -a |grep agent
2a9688d0073a rancher/agent:v1.1.2 "/run.sh https://ranc" 3 seconds ago Up 2 seconds gloomy_swirles

```

The logs make it seem that the container could connect to the Rancher Server at [https://rancher01.example.org](https://rancher01.example.org) , but then fail due to a missing URL?

```
[root@rancher01 ~]# docker logs --tail -f 2a9688d0073a
Updating certificates in /etc/ssl/certs...
WARNING: rancherAddedCA.pem does not contain a certificate or CRL: skipping
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

INFO: Running Agent Registration Process, CATTLE_URL=https://rancher01.example.org/v1
INFO: Attempting to connect to: https://rancher01.example.org/v1
INFO: https://rancher01.example.org/v1 is accessible
Traceback (most recent call last):
  File "./resolve_url.py", line 9, in <module>
    r = requests.get(url)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: unknown error (_ssl.c:2831)
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information

ERROR: returned
ERROR: --- START ---
ERROR: --- END ---
ERROR: Failed to load registration env from CATTLE_URL=https://rancher01.example.org/v1 ENV_URL= ERROR: Please ensure the proper value for the Host Registration URL is set

```

And yes, the host can reach the Rancher Server:

```
[root@docker01 ~]# curl https://rancher01.example.org/v1
{"id":"5519214c-a18b-433d-968f-128015d9bee9","type":"error","links":{},"actions":{},"status":401,"code":"Unauthorized","message":"Unauthorized","detail":null,"baseType":"error"}[root@docker01 ~]#
```

---

<div class="post-metadata">

**Author:** ![swong](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@swong](https://forums.suse.com/u/swong)\
**Post date:** [February 13, 2018, 1:04am UTC](https://forums.suse.com/t/cannot-re-register-agent-failed-to-load-registration-env/5113/2 "2018-02-13T01:04:15Z")

</div>

I have exactly the same problem today with rancher rancher/agent v1.2.9 when trying to register a host:

INFO: Running Agent Registration Process, CATTLE\_URL=https://rancher.wongsrus.net.au/v1  
INFO: Attempting to connect to: [https://rancher.wongsrus.net.au/v1](https://rancher.wongsrus.net.au/v1)  
INFO: [https://rancher.wongsrus.net.au/v1](https://rancher.wongsrus.net.au/v1) is accessible  
Traceback (most recent call last):  
File “./resolve\_url.py”, line 9, in   
r = requests.get(url)  
File “/usr/local/lib/python2.7/dist-packages/requests/api.py”, line 70, in get  
return request(‘get’, url, params=params, \*\*kwargs)  
File “/usr/local/lib/python2.7/dist-packages/requests/api.py”, line 56, in request  
return session.request(method=method, url=url, \*\*kwargs)  
File “/usr/local/lib/python2.7/dist-packages/requests/sessions.py”, line 488, in request  
resp = self.send(prep, \*\*send\_kwargs)  
File “/usr/local/lib/python2.7/dist-packages/requests/sessions.py”, line 609, in send  
r = adapter.send(request, \*\*kwargs)  
File “/usr/local/lib/python2.7/dist-packages/requests/adapters.py”, line 497, in send  
raise SSLError(e, request=request)  
requests.exceptions.SSLError: unknown error (\_ssl.c:2831)  
curl: no URL specified!  
curl: try ‘curl --help’ or ‘curl --manual’ for more information  
ERROR: returned  
ERROR: — START —  
ERROR: — END —

ERROR: Failed to load registration env from CATTLE\_URL=MYRANCHER\_URL/v1 ENV\_URL=  
ERROR: Please ensure the proper value for the Host Registration URL is set

Did you manage to fix your issue?

Steven

---

<div class="post-metadata">

**Author:** ![Stefan\_Lasiewski](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/stefan_lasiewski/32/1801_2.png) [@Stefan\_Lasiewski](https://forums.suse.com/u/Stefan_Lasiewski)\
**Post date:** [February 13, 2018, 1:26am UTC](https://forums.suse.com/t/cannot-re-register-agent-failed-to-load-registration-env/5113/3 "2018-02-13T01:26:16Z")

</div>

Steve,

I did fix my issue. However, this post is from a year ago and I don’t remember how I fixed it. I suspect I deleted the Rancher Agent and all Rancher Infrastructure Containers on the host, using something like this:

`docker container rm $(docker ps -a | grep rancher/ |cut -f1 -d" ")`

That’s a command that I’ve used several times to help clear mysterious issues with Rancher Agent & the Infrastructure Containers. A few times I’ve even tried removing the image for the Rancher Agent.

-= Stefan

---

<div class="post-metadata">

**Author:** ![swong](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@swong](https://forums.suse.com/u/swong)\
**Post date:** [February 13, 2018, 6:33am UTC](https://forums.suse.com/t/cannot-re-register-agent-failed-to-load-registration-env/5113/4 "2018-02-13T06:33:47Z")

</div>

Thanks Stefan, I think the error i am getting is different as I got different error now: from python : requests.exceptions.SSLError: [SSL: CERTIFICATE\_VERIFY\_FAILED] certificate verify failed (\_ssl.c:590)  
after some fiddling around. I am only working on a POC so will not solve this ssl problem for now. I am reverting to using http and all is good… for now.
