United States (change)
Shortcuts: Downloads Fedora Red Hat Network
Account Links: Cart Your Account Logout
When performing an Anaconda upgrade from Red Hat Enterprise Linux 3 to Red Hat Enterprise Linux 4, several manual steps may be required to complete the upgrade. Because of multi-lib and packaging differences between the two products, the system may contain a mismatch of older packages for a different architecture.
To determine if the upgraded system exhibits this behavior, you can check for multiple versions of RPM packages. The following example on a x86_64 system shows that there are two different versions of the same package installed:
# rpm -q --qf "%{name}-%{version}-%{release}.%{arch}\n" glibc
glibc-2.3.2-95.37.i686
glibc-2.3.2-95.37.x86_64
glibc-2.3.4-2.9.i686
glibc-2.3.4-2.9.x86_64
Once in this situation, the system may not be able to upgrade via Red Hat Network (RHN). The up2date and RPM utilities are unable to obsolete packages of a different architecture. For example:
# rpm -q --qf "%{name}-%{version}-%{release}.%{arch}\n" libtabe
libtabe-0.2.6-6.EL.i386
libtabe-0.2.6-9.x86_64
You will be required to remove any older packages before proceeding with any Red Hat Network upgrades. The script shown below will find older packages that will prevent upgrades and prompt your for their removal.
Note: On x86_64 systems it may be required to manually remove mozilla.i386 as the presence of this package will also prevent Red Hat Network upgrades.
#!/bin/bash
echo "Searching for duplicate packages"
#while read LINE ;
for NAME in $(rpm -qa --qf "%{name}\n" | sort | uniq -d) ;
do
set -- $(rpm -q --qf "%{name}-%{version}-%{release}\n" $NAME | uniq -u)
COUNT=$#
PKGS=$*
if [ $COUNT -eq 1 ]; then
# prompt for removal
echo "Found $PKGS ..."
echo -n "Remove $PKGS? [y|n] "
read RESPONSE
[[ $RESPONSE == [yY] ]] && rpm -ev --nodeps $PKGS
elif [ $COUNT -gt 1 ]; then
# prompt for removal of oldest
echo "Found $PKGS ..."
set -- $(rpm -q --qf "%{installtime} %{name}-%{version}-%{release}.%{arch}\n" $PKGS | sort -n | head -n1)
PKGS=$2
echo -n "Remove $PKGS? [y|n] "
read RESPONSE
[[ $RESPONSE == [yY] ]] && rpm -ev --nodeps $PKGS
fi
done
Name the script remove_old_duplicates.sh and ensure that the file permissions are executable, permissions of 755 should be sufficient. The file location should not matter, /tmp worked for our testing. The file should be owned by the root user (and group) and executed as the root user.
Caution: Running this script will modify your system. Also, you should be forewarned that this could be a time-intensive process.