# Pbm restore get the error : executable file not found in $PATH

**URL:** <https://forums.percona.com/t/pbm-restore-get-the-error-executable-file-not-found-in-path/16586>\
**Category:** Percona Backup for MongoDB\
**Created:** [July 15, 2022, 8:16am UTC](https://forums.percona.com/t/pbm-restore-get-the-error-executable-file-not-found-in-path/16586 "2022-07-15T08:16:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jinle](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@Jinle](https://forums.percona.com/u/Jinle)\
**Post date:** [July 15, 2022, 8:16am UTC](https://forums.percona.com/t/pbm-restore-get-the-error-executable-file-not-found-in-path/16586/1 "2022-07-15T08:16:03Z")

</div>

hello!

I’m runing pbm restore ,but get this error:

```auto
Jun 17 13:55:18 VMS173202 pbm-agent[9053]: 2022-06-17T13:55:18.000+0800 I [restore/2022-06-17T05:53:07Z] preparing data
Jun 17 13:55:51 VMS173202 pbm-agent[9053]: 2022-06-17T13:55:51.000+0800 E [restore/2022-06-17T05:53:07Z] mark restore as failed `prepare data: start mongo: exec: "mongod": executable file not found in $PATH`: set backup state: write exception: write concern error: (InterruptedDueToReplStateChange) operation was interrupted
Jun 17 13:55:51 VMS173202 pbm-agent[9053]: 2022-06-17T13:55:51.000+0800 I [restore/2022-06-17T05:53:07Z] restore finished prepare data: start mongo: exec: "mongod": executable file not found in $PATH
Jun 17 13:55:51 VMS173202 pbm-agent[9053]: 2022-06-17T13:55:51.000+0800 E [restore/2022-06-17T05:53:07Z] prepare data: start mongo: exec: "mongod": executable file not found in $PATH
Jun 17 13:55:51 VMS173202 pbm-agent[9053]: 2022-06-17T13:55:51.000+0800 I change stream was closed
Jun 17 13:55:51 VMS173202 pbm-agent[9053]: 2022/06/17 13:55:51 Exit: <nil>

```

check mongod is in the $PATH, i’m so confused, please help me, tks!!!

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [July 15, 2022, 11:25am UTC](https://forums.percona.com/t/pbm-restore-get-the-error-executable-file-not-found-in-path/16586/2 "2022-07-15T11:25:42Z")

</div>

Hello, there are conflicting messages in the output above. Does pbm user have permissions for mongodb dir? e.g.

usermod -a -G mongod pbm

Did the primary change while you were trying the restore?

---

<div class="post-metadata">

**Author:** ![Jinle](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@Jinle](https://forums.percona.com/u/Jinle)\
**Post date:** [July 21, 2022, 1:53am UTC](https://forums.percona.com/t/pbm-restore-get-the-error-executable-file-not-found-in-path/16586/4 "2022-07-21T01:53:25Z")

</div>

Hello igroene!  
Thanks for your reply！

I run mongod and pbm-agent with root user

```auto
[root@hostname ~]# ps aux|grep pbm
root 7361 0.1 0.0 1034972 14752 ? Ssl 09:41 0:00 /usr/bin/pbm-agent
root 9310 0.0 0.0 112708 972 pts/0 S+ 09:47 0:00 grep --color=auto pbm

```

And no changes on primary during recovery.

mongod in the $PATH:

```auto
[user@hostname ~]$ which mongod
/percona-backup-mongodb/bin/mongod

```

there are the logs:

```auto
Jul 18 09:52:09 hostname pbm-agent[7361]: 2022-07-18T09:52:09.000+0800 I [restore/2022-07-18T01:31:52Z] copy <2022-07-18T01:31:52Z/opsperconamongotest/admin/index/36--6492379618678455382.wt.gz> to </data/mongodb/admin/index/36--6492379618678455382.wt>
Jul 18 09:52:09 hostname pbm-agent[7361]: 2022-07-18T09:52:09.000+0800 I [restore/2022-07-18T01:31:52Z] copy <2022-07-18T01:31:52Z/opsperconamongotest/admin/index/23--6492379618678455382.wt.gz> to </data/mongodb/admin/index/23--6492379618678455382.wt>
Jul 18 09:52:09 hostname pbm-agent[7361]: 2022-07-18T09:52:09.000+0800 I [restore/2022-07-18T01:31:52Z] copy <2022-07-18T01:31:52Z/opsperconamongotest/journal/WiredTigerLog.0000000063.gz> to </data/mongodb/journal/WiredTigerLog.0000000063>
Jul 18 09:52:09 hostname pbm-agent[7361]: 2022-07-18T09:52:09.000+0800 I [restore/2022-07-18T01:31:52Z] copy <2022-07-18T01:31:52Z/opsperconamongotest/journal/WiredTigerLog.0000000064.gz> to </data/mongodb/journal/WiredTigerLog.0000000064>
Jul 18 09:52:11 hostname pbm-agent[7361]: 2022-07-18T09:52:11.000+0800 I [restore/2022-07-18T01:31:52Z] preparing data
Jul 18 09:52:41 hostname pbm-agent[7361]: 2022-07-18T09:52:41.000+0800 E [restore/2022-07-18T01:31:52Z] mark restore as failed `prepare data: start mongo: exec: "mongod": executable file not found in $PATH`: set backup state: server selection error: server selection timeout, current topology: { Type: ReplicaSetNoPrimary, Servers: [{ Addr: 10.0.0.1:27178, Type: Unknown, Last error: connection() error occured during connection handshake: dial tcp 10.0.0.1:27178: connect: connection refused }, { Addr: 10.0.0.2:27178, Type: Unknown, Last error: connection() error occured during connection handshake: dial tcp 10.0.0.2:27178: connect: connection refused }, { Addr: 10.0.0.3:27178, Type: Unknown, Last error: connection() error occured during connection handshake: dial tcp 10.0.0.3:27178: connect: connection refused },] }
Jul 18 09:52:41 hostname pbm-agent[7361]: 2022-07-18T09:52:41.000+0800 I [restore/2022-07-18T01:31:52Z] restore finished prepare data: start mongo: exec: "mongod": executable file not found in $PATH
Jul 18 09:52:41 hostname pbm-agent[7361]: 2022-07-18T09:52:41.000+0800 E [restore/2022-07-18T01:31:52Z] prepare data: start mongo: exec: "mongod": executable file not found in $PATH
Jul 18 09:52:41 hostname pbm-agent[7361]: 2022-07-18T09:52:41.000+0800 I change stream was closed
Jul 18 09:52:41 hostname pbm-agent[7361]: 2022/07/18 09:52:41 Exit: <nil>

```

It seems that all the data has been copied to the data directory, but the mongod cannot be found when starting the mongo service.

---

<div class="post-metadata">

**Author:** ![Jinle](https://avatars.discourse-cdn.com/v4/letter/j/74df32/32.png) [@Jinle](https://forums.percona.com/u/Jinle)\
**Post date:** [August 17, 2022, 7:12am UTC](https://forums.percona.com/t/pbm-restore-get-the-error-executable-file-not-found-in-path/16586/5 "2022-08-17T07:12:25Z")

</div>

sudo ln -s /usr/local/mongodb/bin/mongod /bin/mongod  
problem solved！tks all~~~
