Sudo Fails with Error Message Ending With "/usr/bin/sudo: No such file or directory"
An Oracle Linux or Red Hat Linux based server tries to run sudo commands, but the commands fail with the following error message: "/opt/rh/devtoolset-11/root/usr/bin/sudo: line 41: /usr/bin/sudo: No such file or directory", such as in the following example:
# sudo -i
/opt/rh/devtoolset-11/root/usr/bin/sudo: line 41: /usr/bin/sudo: No such file or directory
This error is caused by an error in the sudo wrapper script installed by the devtoolset-* package (such as in devtoolset-11 in the prior example). The devtoolset-* package sets the user's PATH so the sudo wrapper script occurs in the path before the operating system's standard sudo package (which is installed in the /usr/bin directory). Older versions of the devtoolset-* package's sudo wrapper script can encounter errors when parsing some sudo options.