Oracle Grid Infrastructure patching with OPatchAuto is designed to automate rolling patch application across RAC nodes. However, incorrect file ownership or permissions in the OPatch directory can cause the patching process to fail immediately with error code 42.
In this article, we’ll examine a real-world Oracle 23ai Grid Infrastructure patching issue, explain why it occurs, and show the exact steps to resolve it.

Environment
- Oracle Grid Infrastructure 23ai
- Oracle RAC (2 Nodes)
- OPatchAuto Rolling Patch
- Linux
Problem
While applying a Grid Infrastructure patch using opatchauto, the patch failed almost immediately.
Command Executed
/u01/app/23.26.0.0/grid/OPatch/opatchauto apply /home/oracle/install/39568945 -logLevel FINEST
Error Output
Remote command execution failed due to
Can't open perl script
"/u01/app/23.26.0.0/grid/OPatch/auto/database/bin/RemoteHostExecutor.pl":
Permission denied
OPatchAuto failed.
opatchauto failed with error code 42
What Does This Error Mean?
During a RAC patch, OPatchAuto copies commands to the remote node and executes the Perl script:
RemoteHostExecutor.pl
If Oracle cannot read or execute this script on the remote node, the entire patch process stops before any binaries are updated.
The failure is usually caused by:
- Incorrect ownership
- Incorrect permissions
- OPatch directory copied incorrectly
- Manual replacement of the OPatch directory
- Root ownership on files that should be owned by Oracle/Grid
Investigation
Checking the Grid Home showed an unusual ownership for the OPatch directory.
Example:
drwxr-x---. 14 root root 4096 Jul 29 12:19 OPatch
Instead of being owned by the Oracle software owner, the directory belonged to root.
Because of this, Oracle could not execute:
OPatch/auto/database/bin/RemoteHostExecutor.pl
resulting in:
Permission denied
Root Cause
The OPatch directory ownership had changed to:
root:root
instead of:
oracle:oinstall
(or grid:oinstall, depending on your Grid Infrastructure owner).
Since OPatchAuto runs under the Oracle/Grid software owner, it was unable to access the required Perl scripts on the remote RAC node.
Solution
Correct the ownership of the OPatch directory.
cd $GRID_HOME
chown -R oracle:oinstall OPatch
Then correct the permissions.
chmod -R 775 OPatch
If your Grid Infrastructure is owned by the grid user instead of oracle, use:
chown -R grid:oinstall OPatch
Verify Ownership
Run:
ls -ld $GRID_HOME/OPatch
Expected output:
drwxrwxr-x oracle oinstall OPatch
or
drwxrwxr-x grid oinstall OPatch
depending on your installation.
Retry the Patch
After fixing the ownership and permissions, rerun the patch:
$GRID_HOME/OPatch/opatchauto apply /home/oracle/install/39568945
The remote execution should now proceed successfully.
Why Did This Happen?
This issue is commonly seen after:
- Manually replacing the OPatch directory
- Copying OPatch using the root user
- Extracting a new OPatch ZIP as root
- Restoring a Grid Home from backup
- Incorrect post-installation permission changes
Whenever the OPatch directory ownership changes, OPatchAuto may fail before the actual patching begins.
Best Practices
To avoid this issue in future patching activities:
- Always extract OPatch as the Grid/Oracle software owner.
- Verify ownership before starting patching.
- Never leave the OPatch directory owned by
root. - Validate permissions on all RAC nodes.
- Keep OPatch versions consistent across every node in the cluster.
- Run
opatchautopre-checks before applying production patches.
Quick Checklist
Before running opatchauto, verify:
ls -ld $GRID_HOME/OPatch
ls -l $GRID_HOME/OPatch/auto/database/bin/RemoteHostExecutor.pl
whoami
$GRID_HOME/OPatch/opatch version
Ensure:
- ✔ Correct software owner (
oracleorgrid) - ✔ Read and execute permissions
- ✔ Same OPatch version on all RAC nodes
- ✔ No root ownership inside the OPatch directory
Conclusion
The OPatchAuto error code 42 with the message:
Can't open perl script:
RemoteHostExecutor.pl: Permission denied
is typically caused by incorrect ownership or permissions on the OPatch directory. Correcting the directory ownership and permissions restores access to the required Perl scripts, allowing OPatchAuto to execute remote operations successfully across RAC nodes.
By verifying file ownership before every patch cycle, Oracle administrators can prevent this common issue and ensure smooth, uninterrupted Grid Infrastructure patching.



