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

hello!

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

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!!!

1 Like

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?

1 Like

Hello igroene!
Thanks for your reply!

I run mongod and pbm-agent with root user

[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:

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

there are the logs:

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.

1 Like

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

1 Like