# PMM agent failing to connect

**URL:** <https://forums.percona.com/t/pmm-agent-failing-to-connect/13191>\
**Category:** PMM 2.x\
**Tags:** closed-no-reply\
**Created:** [November 24, 2021, 7:47am UTC](https://forums.percona.com/t/pmm-agent-failing-to-connect/13191 "2021-11-24T07:47:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashishps1](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@ashishps1](https://forums.percona.com/u/ashishps1)\
**Post date:** [November 24, 2021, 7:47am UTC](https://forums.percona.com/t/pmm-agent-failing-to-connect/13191/1 "2021-11-24T07:47:37Z")

</div>

I have installed PMM client using apt-get on Ubuntu 18.

I was able to connect the client with server. Later I needed to change the PMM server, so I uninstalled the client and reinstalled but the agent config file is still the old one located at `/usr/local/percona/pmm2/config/pmm-agent.yaml`.  
Now, I am trying to connect the client to server using `pmm-admin config --server-insecure-tls --server-url=https://admin:password@server-url` but it is not starting.

I see below errors in `/var/log/syslog`:

```auto
Nov 24 07:43:59 eta-c pmm-agent[119616]: #033[36mINFO#033[0m[2021-11-24T07:43:59.948+00:00] Connecting to https://admin:***@server-url:443/ ... #033[36mcomponent#033[0m=client
Nov 24 07:43:59 eta-c pmm-agent[119616]: #033[36mINFO#033[0m[2021-11-24T07:43:59.952+00:00] Connected to server-url:443. #033[36mcomponent#033[0m=client
Nov 24 07:43:59 eta-c pmm-agent[119616]: #033[36mINFO#033[0m[2021-11-24T07:43:59.952+00:00] Establishing two-way communication channel ... #033[36mcomponent#033[0m=client
Nov 24 07:43:59 eta-c pmm-agent[119616]: #033[31mERRO#033[0m[2021-11-24T07:43:59.956+00:00] Failed to establish two-way communication channel: No Agent with ID "/agent_id/b9ec0ef1-9685-4c89-a5d6-358f80a8ef67". #033[31mcomponent#033[0m=client

```

I tried running `pmm-agent setup` command with various options but it doesn’t work.  
Since the agent config file is not deleted upon uninstall how do I get the correct agent ID?
