Question
What to do if the "/scripts/find_and_fix_rpm_issues" command timeouts or doesn't respond?
Example: (Command + output)
# /scripts/find_and_fix_rpm_issues
Checking that the RPM DB is OK...
(No more output)
Is there anything you can do to get the script to function again?
Answer
There are a couple of issues that can cause it.
YUM tasks:
There could be an ongoing YUM transaction happening. This can cause YUM to lock until the transaction is complete. You may see output from the command like this to indicate a lock is present.
Example:
# /usr/local/cpanel/scripts/find_and_fix_rpm_issues
Waiting for 1 related locks to clear for /usr/bin/rpm
You could wait for the lock to clear.
Or you may want to search for 'yum' processes that are currently running.
# ps awux | grep -i yum
You may need to kill any 'yum' process if it is running for too long. That would remove the yum lock.
RPMs, too many processes:
This issue may also be caused by multiple copies of 'rpm' running simultaneously. If you view the process list through the command line, you will see something similar in response to the next command.
Example from test server:
# ps awux | grep rpm
root 7890 0.0 0.0 70848 3904 ? S 10:15 0:00 /usr/bin/rpm -q --nodigest --nosignature --queryformat %{NAME} %{VERSION}-%{RELEASE}\n -a kernelcare
root 12529 0.0 0.0 70848 1824 ? S Nov28 0:00 /usr/bin/rpm -q --nodigest --nosignature --queryformat %{NAME} %{VERSION}-%{RELEASE}\n -a kernelcare
root 13645 0.0 0.0 70848 652 ? S Oct19 0:00 /usr/bin/rpm -q --nodigest --nosignature --queryformat %{NAME} %{VERSION}-%{RELEASE}\n -a kernelcare
root 13926 0.0 0.0 70852 3920 pts/0 S 11:33 0:00 /bin/rpm -q --nosignature --nodigest glibc
root 14314 0.0 0.0 70848 944 ? S Nov14 0:00 /usr/bin/rpm -q --nodigest --nosignature --queryformat %{NAME} %{VERSION}-%{RELEASE}\n -a kernelcare
root 14434 0.0 0.0 70852 3928 pts/0 S 11:36 0:00 /bin/rpm -q --nosignature --nodigest glibc
root 14560 0.0 0.0 70852 3916 ? SN 11:38 0:00 /bin/rpm -qa --nodigest --nosignature --queryformat %{NAME}\t%{VERSION}\t%{RELEASE}\t%{VENDOR}\t%{INSTALLTIME}\t%{RSAHEADER:pgpsig}\n
root 14561 0.0 0.0 70852 3912 ? SN 11:38 0:00 /bin/rpm -qa --nodigest --nosignature --queryformat %{NAME}\t%{VERSION}\t%{RELEASE}\t%{VENDOR}\t%{INSTALLTIME}\t%{RSAHEADER:pgpsig}\n
root 14562 0.0 0.0 70852 3920 ? SN 11:38 0:00 /bin/rpm -qa --nodigest --nosignature --queryformat %{NAME}\t%{VERSION}\t%{RELEASE}\t%{VENDOR}\t%{INSTALLTIME}\t%{RSAHEADER:pgpsig}\n
root 15732 0.0 0.0 70852 3920 pts/0 S 11:48 0:00 /bin/rpm -q --nosignature --nodigest glibc
root 16080 0.0 0.0 70852 3924 pts/0 S 11:51 0:00 /bin/rpm -q --nosignature --nodigest glibc
root 16102 0.0 0.0 174572 4024 pts/0 S+ 11:51 0:00 rpm -qa
The process 'rpm' depends on locking the RPM database. Multiple copies running will not complete, as they cannot all control the lock file.
If you find multiple copies of 'rpm' running at the same time, we recommend finding and killing those 'rpm' processes until they are all gone.
*** If you use the following command to 'kill' the process, please use caution. ***
Command:
kill -9 `ps awux | grep -v grep rpm | awk ' { print $2 } ' | xargs`
Once those 'rpm' are dead, you should be able to run the '/scripts/find_and_fix_rpm_issues' script successfully.
The command should provide output like so:
# /scripts/find_and_fix_rpm_issues
Checking that the RPM DB is OK...
glibc-2.17-317.el7.x86_64
OK: RPM DB is responding to queries
Testing if rpm_is_working RPM is installed
package rpm_is_working is not installed
Testing if it's possible to install a simple RPM
Preparing... ########################################
Updating / installing...
rpm_is_working-1.0-0 ########################################