=====Dealing with Yum Issues=====
====Yum Commands Hang====
If yum commands hang this solution worked
1) Check for any processes holding the rpm database open using command
lsof | grep /var/lib/rpm
If this gives any output, kill all processes using kill -9 PID
2) Delete temporary DB files
rm -f /var/lib/rpm/__*
3) Next is to rebuild RPM database
rpm --rebuilddb -v -v
====Cleanup duplicate packages====
Got this little script from oracle
#!/bin/bash
# Check for duplicate RPMs
duplicates=$(package-cleanup --dupes)
# If there are duplicates, list them and ask for confirmation to remove
if [ -n "$duplicates" ]; then
echo "Duplicates found:"
echo "$duplicates"
read -p "Do you want to remove these packages? (y/n): " response
if [[ "$response" =~ ^[Yy]$ ]]; then
echo "Removing duplicate RPMs..."
package-cleanup --cleandupes
echo "Duplicate RPMs removed successfully."
else
echo "Operation aborted."
fi
else
echo "No duplicate RPMs found."
fi
command to remove older kernel
package-cleanup --oldkernels
add the option --count=1
if you want to rmeove ALL older kernels