HOWTO: Remove older duplicated RPMs automatically
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 13 of 13
  1. #1
    AndyGreen Guest

    Smile HOWTO: Remove older duplicated RPMs automatically

    Over time RPM seems to collect duplicate packages for one reason or another (interrupted installs, hoarding, who knows), causing unpleasantness at update time. Attached is a short script that issues a list of packages which are not only duplicated, but are older (by install date) than the newest duped package (which is not printed). The script itself just prints package versions and does not remove anything.

    The issued list is suitable for feeding into rpm -e to give your constipated package database a colonic irrigation, without actually removing any packages. I suggest you review the output against rpm -q packagename and satisfy yourself that the list is looking good before hitting it with rpm -e, but it has worked great on a couple of machines here and I hope it is useful to others bedevilled by the package duplication problem. Please note that although it works fine for me, it might eat your install and burn down your house, try at your own risk.
    Attached Files Attached Files
    Last edited by AndyGreen; 15th May 2005 at 03:00 PM.

  2. #2
    Join Date
    Feb 2005
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here it all is..........
    aspell
    at-spi
    binutils
    bluez-libs
    bzip2-libs
    db4-devel
    db4-utils
    gdk-pixbuf
    ghostscript
    gnome-desktop
    gtksourceview
    howl-libs
    kbd
    kdeartwork
    kdelibs
    krb5-libs
    krbafs
    libcap
    libdbi
    libgcj
    libIDL
    libidn
    libpcap
    libtermcap
    libwvstreams
    libxklavier
    lm_sensors
    lockdev
    ncurses
    newt-devel
    nss_db
    openldap
    openssl
    pcre
    readline
    rpm-devel
    SDL_mixer
    startup-notification
    swig
    tcp_wrappers
    wireless-tools
    Xaw3d
    xdelta
    aspell-0.50.5-3.fc3 at-spi-1.6.0-3 binutils-2.15.92.0.2-5 bluez-libs-2.10-2 bzip2-libs-1.0.2-13 db4-devel-4.2.52-6 db4-utils-4.2.52-6 gdk-pixbuf-0.22.0-16.fc3 ghostscript-7.07-33 gnome-desktop-2.8.0-3 gtksourceview-1.1.0-4.fc3 howl-libs-0.9.6-6 kbd-1.12-2 kdeartwork-3.3.1-1 kdelibs-3.3.1-2.9.FC3 krb5-libs-1.3.6-5 krbafs-1.2.2-6 libcap-1.10-20 libdbi-0.6.5-9 libgcj-3.4.3-22.fc3 libIDL-0.8.4-1 libidn-0.5.6-1 libpcap-0.8.3-7 libtermcap-2.0.8-39 libwvstreams-3.75.0-2 libxklavier-1.02-3 lm_sensors-2.8.7-2 lockdev-1.0.1-4.1 ncurses-5.4-13 newt-devel-0.51.6-5 nss_db-2.2-29 openldap-2.2.13-2 openssl-0.9.7a-40 pcre-4.5-3 readline-4.3-13 rpm-devel-4.3.2-21 SDL_mixer-1.2.5-4 startup-notification-0.7-1 swig-1.3.21-6 tcp_wrappers-7.6-37.2 wireless-tools-27-1.2.0.fc3 Xaw3d-1.5-23 xdelta-1.1.3-15

  3. #3
    Join Date
    Feb 2005
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A big thanks
    Chris

  4. #4
    AndyGreen Guest
    Well, copy the latter part of the script like this

    rpm -e aspell-0.50........blah blah xdelta-1.1.3-15

    and hit enter.

  5. #5
    mkleehammer Guest

    Using output without cut and paste.

    Once you are sure you like the results, you can erase the packages without cutting and pasting by using the following (assuming you're using the bash shell):

    Code:
    rpm -e $(listrmpdupes)
    The construct $(xxx) runs "xxx" and replaces $(xxx) with whatever xxx prints out. In this case, whatever listrmpdups prints (the list of packages) will replace the $(xxx).

    This is very nice script. You might consider using "uniq -d" to generate the list of duplicates.

    mk.

  6. #6
    jvernon Guest
    after I run it the latter pary of my script says:
    alsa-lib-1.0.6-3 atk-1.8.0-2 audiofile-0.2.6-1 bzip2-libs-1.0.2-13 cracklib-2.7-28 cyrus-sasl-2.1.19-3 db4-4.2.52-6 dbus-0.22-10 dbus-glib-0.22-10 device-mapper-1.00.19-2 e2fsprogs-1.35-11.2 esound-0.2.35-2 evolution-data-server-1.0.2-3 expat-1.95.7-4 fontconfig-2.2.3-5 freetype-2.1.9-1 GConf2-2.8.1-1 gdbm-1.8.0-24 glib2-2.4.7-1 glibc-2.3.3-74 gnome-vfs2-2.8.2-8 gnutls-1.0.20-3 gtk2-2.4.13-9 hal-0.4.0-10 howl-libs-0.9.6-6 krb5-libs-1.3.4-7 libart_lgpl-2.3.16-3 libbonobo-2.8.0-2 libcap-1.10-20 libgcc-3.4.2-6.fc3 libgcrypt-1.2.0-3 libgnome-2.8.0-2 libgpg-error-1.0-1 libIDL-0.8.4-1 libjpeg-6b-33 libpng-1.2.7-1 libselinux-1.17.14-1 libsoup-2.2.1-1 libstdc++-3.4.2-6.fc3 libtiff-3.6.1-7 libxml2-2.6.14-2 openldap-2.2.13-2 openssl-0.9.7a-40 ORBit2-2.12.0-3 pam-0.77-65 pango-1.6.0-7 perl-5.8.5-9 popt-1.9.1-21 redhat-artwork-0.117-1 startup-notification-0.7-1 xorg-x11-libs-6.8.1-12 xorg-x11-Mesa-libGL-6.8.1-12 zlib-1.2.1.2-1

    but when i try
    rpm -e alsa-lib.......zlib1.2.1.2-1
    I get this error message:
    error: "alsa-lib-1.0.6-3" specifies multiple packages
    error: "atk-1.8.0-2" specifies multiple packages
    error: "audiofile-0.2.6-1" specifies multiple packages
    error: "bzip2-libs-1.0.2-13" specifies multiple packages
    error: "cracklib-2.7-28" specifies multiple packages
    error: "cyrus-sasl-2.1.19-3" specifies multiple packages
    error: "db4-4.2.52-6" specifies multiple packages
    error: "dbus-0.22-10" specifies multiple packages
    error: "dbus-glib-0.22-10" specifies multiple packages
    error: "device-mapper-1.00.19-2" specifies multiple packages
    error: "e2fsprogs-1.35-11.2" specifies multiple packages
    error: "esound-0.2.35-2" specifies multiple packages
    error: "evolution-data-server-1.0.2-3" specifies multiple packages
    error: "expat-1.95.7-4" specifies multiple packages
    error: "fontconfig-2.2.3-5" specifies multiple packages
    error: "freetype-2.1.9-1" specifies multiple packages
    error: "GConf2-2.8.1-1" specifies multiple packages
    error: "gdbm-1.8.0-24" specifies multiple packages
    error: "glib2-2.4.7-1" specifies multiple packages
    error: "glibc-2.3.3-74" specifies multiple packages
    error: "gnome-vfs2-2.8.2-8" specifies multiple packages
    error: "gnutls-1.0.20-3" specifies multiple packages
    error: "gtk2-2.4.13-9" specifies multiple packages
    error: "hal-0.4.0-10" specifies multiple packages
    error: "howl-libs-0.9.6-6" specifies multiple packages
    error: "krb5-libs-1.3.4-7" specifies multiple packages
    error: "libart_lgpl-2.3.16-3" specifies multiple packages
    error: "libbonobo-2.8.0-2" specifies multiple packages
    error: "libcap-1.10-20" specifies multiple packages
    error: "libgcc-3.4.2-6.fc3" specifies multiple packages
    error: "libgcrypt-1.2.0-3" specifies multiple packages
    error: "libgnome-2.8.0-2" specifies multiple packages
    error: "libgpg-error-1.0-1" specifies multiple packages
    error: "libIDL-0.8.4-1" specifies multiple packages
    error: "libjpeg-6b-33" specifies multiple packages
    error: "libpng-1.2.7-1" specifies multiple packages
    error: "libselinux-1.17.14-1" specifies multiple packages
    error: "libsoup-2.2.1-1" specifies multiple packages
    error: "libstdc++-3.4.2-6.fc3" specifies multiple packages
    error: "libtiff-3.6.1-7" specifies multiple packages
    error: "libxml2-2.6.14-2" specifies multiple packages
    error: "openldap-2.2.13-2" specifies multiple packages
    error: "openssl-0.9.7a-40" specifies multiple packages
    error: "ORBit2-2.12.0-3" specifies multiple packages
    error: "pam-0.77-65" specifies multiple packages
    error: "pango-1.6.0-7" specifies multiple packages
    error: "perl-5.8.5-9" specifies multiple packages
    error: "popt-1.9.1-21" specifies multiple packages
    error: "redhat-artwork-0.117-1" specifies multiple packages
    error: "startup-notification-0.7-1" specifies multiple packages
    error: "xorg-x11-libs-6.8.1-12" specifies multiple packages
    error: "xorg-x11-Mesa-libGL-6.8.1-12" specifies multiple packages
    error: "zlib-1.2.1.2-1" specifies multiple packages

    any suggestions?

  7. #7
    Join Date
    Sep 2004
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I noticed that the script mix different architectures together, so if you have a package both in 32 and 64bit the script will show this as a duplicate package.
    So beware of this or you may remove packages you still want to use.

    Your rpm-message shows this - you installed these packages in 2 different architectures - and rpm doesn't know which one to remove.
    Last edited by Oetzi; 7th May 2005 at 04:04 AM.

  8. #8
    AndyGreen Guest
    Wow, nice debug Oetzi. I only have 32-bit machines here.

    I can see how to separate by Arches and I'll look at making a new version suitable for 64-bit. But for now the script is only correct for 32-bit installs.

  9. #9
    jlblom Guest
    Hi Andy,
    Actually you hit a big problem in 64-bit systems. The 32-bit and 64-bit main programs and part of the libraries are equal for both architectures, which in my opinion is a serious error as you get a lot of duplicate packages in name but not in function. Therefore programs like synaptic find many packages "broken" and want to remove them but also yum complains about "duplicate packages" and won't install in nightly updates. I thought your solution was my upgrade saver but I doesn't dare to use it as the risk of my installation being eaten or my house burned down is too large .
    But seriously, it is a big problem for which I see no solution short of allowing duplicate packages in yum.
    As an example for libapr you find 2 occurrences ith the same name albeit in different directories:
    /usr/lib/libapr-0.so.0
    /usr/lib/libapr-0.so.0.9.6
    /usr/lib64/libapr-0.so.0
    /usr/lib64/libapr-0.so.0.9.6
    Of course with file command you can see the architecture but rpm is not intelligent enough for this difference.
    However in your last post you mentioned to look into this problem and I wonder if you had come up with a solution.
    I think it is a problem that affects he whole 64-bit community. The solution may be the use of 2 separated directory systems one for 32-bit and one for 64-bit applications eliminating (even forbidding) the use of shared libraries between 32-bit and 64-bit applications. But I can't oversee the consequences so maybe my idea for a solution is too simple.
    I hope you have some answers.
    Joep

  10. #10
    Join Date
    Sep 2004
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can always remove packages via yum:

    yum remove <package>.i386
    yum remove <package>.x86_64

    Afaik by using rpm it is not possible to distinguish between different architectures. But yum can do this.
    So a solution can be using yum instead of plain rpm.

  11. #11
    Join Date
    Sep 2006
    Location
    Dundee, Michigan
    Age
    41
    Posts
    1,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how can you be 100% sure you are not deleting valid packages that are not duplicate
    Andrew Jamison
    IRC:ajamison5579
    Linux Counter # 435228
    -----------------
    Wiki page helping to show appropriate Fedora versions of Ubuntu commands [url=https://fedoraproject.org/wiki/FedorianDictionary]Fedora Dictionary[/url <--- Outdated been very busy looking to update it soon

  12. #12
    Join Date
    Jan 2007
    Location
    Boston, MA USA
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  13. #13
    Join Date
    Sep 2006
    Location
    Connellsville, PA, USA
    Posts
    11,308
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This kind of hacking is no longer required now with 'package-cleanup --cleandupes':
    su
    yum install yum-utils

    [...]
    package-cleanup --cleandupes

    Closed as obsolete.

    V

Similar Threads

  1. Remove automatically boot to WinXP
    By thnguyen in forum Using Fedora
    Replies: 4
    Last Post: 26th January 2010, 12:15 AM
  2. How to remove a older kernel
    By NiceGuy in forum Using Fedora
    Replies: 2
    Last Post: 3rd March 2007, 09:11 PM
  3. Pirut does not remove older versions of packages?
    By colink in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 28th December 2006, 12:25 PM
  4. Replies: 6
    Last Post: 13th December 2005, 06:16 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •