<---- template headericclude ----->
Clean up your disk -- Remove uneeded RPMS
FedoraForum.org - Fedora Support Forums and Community
Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Clean up your disk -- Remove uneeded RPMS

    Hello,
    Recently I decided to do a full cleanup of my system, and found that I could free over 1.2GB in useless packages. That's 1200MB!

    Well, let me rephrase that. No RPM package is ever useless because they all package software of some sort or another - What I should say was it was software that wasn't useful in my situation. Here's how I did it:
    Code:
    rpm -qa --qf '%{NAME}\n' > RPMS_complete.txt
    for i in $(cat RPMS_complete.txt);do if [ "$(rpm -q --whatrequires $i | grep 'no package requires' > /dev/null;echo $?)" == "0" ]; then echo $i >> RPMS_notneeded.txt; fi; done
    That should take a while, depending on how fast your system is and how many RPMs are installed. When you are finished, you will have a RPMS_notneeded.txt file that has a list of many packages. These are the packages which are not required by anything else, which are usually the ones you can drop from your system if you're not using them.
    Remember: not all of these are packages you can clean out as the dependency system in RPM isn't 100% predictable by the commands I use above: eg.
    libmypackage will provide the /usr/lib/libmypackage.so.0 file
    in RPM thispackage. If another package has a requirement of /usr/lib/libmypackage.so.0 rather that libmypackage, it will appear in the file created above.


    Now, you can go through that list and look up what an RPM does with this command:
    Code:
    rpm -qi package_name
    If you decide you don't need what that package offers, then remove it like this:
    Code:
    rpm -e package_name
    If "package x is required by [...]" errors turn up, don't force the remove with --nodeps.

    If you're not sure if you use a package or not, then leave it to be safe. Also, It would be a good idea to keep a record of what you're removing, incase you find out later that you really do need one of the packages you removed. Using this command:
    Code:
    echo package_name >> record.txt
    One can log package_name to the file named "record.txt"

    Example: You want to remove mypackage, and are 75% sure you don't need it, that it won't affect your system's function.
    Code:
    rpm -qi mypackage
    Code:
    echo "mypackage" >> record
    Code:
    rpm -e mypackage
    EDIT:
    Quote Originally Posted by axelseap
    along this same topic u can also save space by removing the rpms that yum downloaded. yum doens't remove them and just let's them gather dust and take space. running the command
    Code:
    yum clean packages
    removes all the .rpm files that yum has downloaded. i usually add the command to the /etc/rc.local file so the packages are cleaned at boot.
    Excellent idea. To clean packages downloaded by Yum, (Once RPMS are installed the RPM file is no longer needed; the files are on your system.) execute this command as root:
    Code:
    echo 'yum clean packages' >> /etc/rc.d/rc.local
    Another thing you can do is
    Code:
    yum clean headers
    to clear completely useless RPM headers archived by yum. They eventually build up and take a lot of space (A header is no longer needed once it's corresponding package has been updated. A header just contains the info about an RPM.)

    Recently I found that I had duplicate RPMs on my system (from yum segfaults, etc). You can find duplicate rpms like this:
    Code:
    rpm -qa --qf '%{NAME}\n' | sort | uniq -d > rpm_duplicates.txt
    Now the file rpm_duplicates.txt contains a list of names that have two or more packages with different versions (but same name) installed. For kernel*, kmod* and gpg-pubkey* packages this is OK, but in general everything you want to keep only one version installed. To remove the second version, take a name from the list in the file we just created and do:
    Code:
    rpm -q name
    Look at the two outputs, and find the older one. Remove it with:
    Code:
    rpm -e fullname-with-version
    Be sure to include the version in there otherwise it will remove both copies!

    Finally, RPMs aren't always the problem. Other things can take up lots of space on your / drive, too. This command will output the total size of installed RPMs:
    Code:
    test=0;rpm -qa --qf '%{SIZE} - %{NAME}\n' | awk -v t=test '{printf $1"\n"}' | while read line;do let test="$test + $line";echo $test | awk '{printf "\rTotal: "int($1/1048576)"MB"}';done;echo "";
    Compare that to disk usage:
    Code:
    df -u /
    If the difference is very large you may want to check out /tmp and /var.

    Hope it helps out,
    Firewing1

    (some minor changes for readability - foolish)
    Last edited by Firewing1; 9th June 2007 at 08:48 PM.
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  2. #2
    jim's Avatar
    jim is offline Retired Community Manager & Avid Drinker Of Suds
    Join Date
    Feb 2005
    Location
    Rochester NY
    Age
    49
    Posts
    4,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for i in $(cat RPMS_clone.txt);do if [ "$(rpm -q --whatrequires $i | grep 'no package requires' > /dev/null;echo $?)" == "0" ]; then echo $i >> RPMS_notneeded.txt; fi; done
    Shouldn't the RPMS_clone be RPMS_complete ?
    Registered Linux User: #376813
    Western NY
    My linux site
    Smolt Profile

    please remember to say if you problem was solved

    Did you get your id10t award today?

  3. #3
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll add to my example, when run on my system, this was part of my list:
    Code:
    ...
    openoffice.org-math
    libavc1394
    hplip
    ...
    I don't use FireWire (aka 1394), so I want to remove it:
    Code:
    [admin@Host ~]$ sudo rpm -e libavc1394
    Password:
    error: Failed dependencies:
            libavc1394.so.0 is needed by (installed) gstreamer-plugins-0.8.11-0.gst.1.4.i386
            libavc1394.so.0 is needed by (installed) libquicktime-0.9.7-2.2.fc4.i586
            librom1394.so.0 is needed by (installed) gstreamer-plugins-0.8.11-0.gst.1.4.i386
            librom1394.so.0 is needed by (installed) libquicktime-0.9.7-2.2.fc4.i586
    [admin@Host ~]$
    EDIT: Thanks fedorajim! I copyed it off a script I have to do this for me automatically, and in the script I use clone, not complete but for clairity here I though I should use complete.... Thanks for the tip! I edited it out...
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  4. #4
    jim's Avatar
    jim is offline Retired Community Manager & Avid Drinker Of Suds
    Join Date
    Feb 2005
    Location
    Rochester NY
    Age
    49
    Posts
    4,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to be carefull on what you get rid of
    take a peek on what it considers duplicate not needed rpms

    for example

    gnome-session
    ipw2200-kmdl-2.6.14-1.1653_FC4 <-- my wireless d
    mplayerplug-in < --- everyone needs this
    system-config-services
    nautilus <--- the file browser ?
    Attached Files Attached Files
    Registered Linux User: #376813
    Western NY
    My linux site
    Smolt Profile

    please remember to say if you problem was solved

    Did you get your id10t award today?

  5. #5
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's why I say -- rpm -qi first to make sure you don't need it...
    But, for example, most, if not all the -devel files are 100% safe to remove and take a lot of space.
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  6. #6
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's a list of packages you SHOULD NOT remove:
    Code:
    acpid
    adns
    anacron
    apmd
    autofs
    compat-gcc-32-c++
    comps
    crack
    cvs
    desktop-printing
    dhcpv6_client
    diskdumputils
    eog
    fedora-logos
    file-roller
    firefox
    fonts-xorg-100dpi
    fonts-xorg-75dpi
    fonts-xorg-base
    ftp
    gconf-editor
    gdm
    gedit
    gimp-data-extras
    gimp-help
    gimp-print-plugin
    gimp-print-utils
    glibmm24
    gnome-applets
    gnome-audio
    gnome-games
    gnome-kerberos
    gnome-keyring-manager
    gnome-nettool
    gnome-print
    gnome-session
    gnome-spell
    gnome-terminal
    gnome-themes
    gnome-user-docs
    gok
    grub
    gtk-doc
    gtk-engines
    gtkglext
    gtkmm24
    hal-gnomev
    hardlink
    hdparm
    hesiod
    hpoj
    hwbrowser
    iptstate
    iputils
    kdeadmin
    kdeartwork
    kdegraphics
    kdenetwork
    libtheora
    logwatch
    man
    mkbootdisk
    nautilus
    openssh-askpass-gnome
    pam_ccreds
    pam_passwdqc
    pcre
    physfs
    rdate
    redhat-lsb
    rootfiles
    rpm-libs
    selinux-policy-targeted
    setools
    slocate
    sudo
    symlinks
    sysreport
    system-config-mouse
    time
    traceroute
    ttmkfdir
    xorg-x11-font-utils
    xorg-x11-twm
    xorg-x11-xauth
    yelp
    yum-utils
    Last edited by Firewing1; 15th January 2006 at 09:33 PM.
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  7. #7
    jim's Avatar
    jim is offline Retired Community Manager & Avid Drinker Of Suds
    Join Date
    Feb 2005
    Location
    Rochester NY
    Age
    49
    Posts
    4,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what about a for i in $(RPMS_notneeded.txt) rpm -qi $i

    something along those lines
    Registered Linux User: #376813
    Western NY
    My linux site
    Smolt Profile

    please remember to say if you problem was solved

    Did you get your id10t award today?

  8. #8
    axelseap Guest
    actually some ofthose can be removed if you're using kde like me. i have had gdm and gedit and several other programs removed for a long time now with no problem

  9. #9
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    True, true, but basically if you're using Gnome, Don't remove and gnome-* RPMS, and for kde users dont remove and kde* RPMS, and compare to the list I posted above, too. All of them technically can be removed, but some will downgrade functionality like hdparm.
    I made a script for automated removal, asking the user questions, with automatic logging. It's in the attachment.
    Just download and run ./rpm_cleanup.txt in the same directory as the RPMS_complete.txt file.

    Firewing1
    Attached Files Attached Files
    Last edited by Firewing1; 15th January 2006 at 09:38 PM.
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  10. #10
    axelseap Guest
    along this same topic u can also save space by removing the rpms that yum downloaded. yum doens't remove them and just let's them gather dust and take space. running the command
    Code:
    yum clean packages
    removes all the .rpm files that yum has downloaded. i usually add the command to the /etc/rc.local file so the packages are cleaned at boot.

  11. #11
    tejas Guest
    After the First Pass, you should run the script again.

    Let me demonstrate

    a depends on b depends on c.

    Assume all 3 a,b,c are useless

    now this scipt will NOT detect that b is useless, as a depends on it.

    It will only tell you that a is useless.

    However, once you uninstall a, then b will be discovered by the script.

  12. #12
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WOW! nice one axelseap! I had 825 packages, and my disk usage on / (a 20 GB drive) dropped from 29% ro 22%! That's a good one -- I'll have to remember that...
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  13. #13
    axelseap Guest
    Quote Originally Posted by Firewing1
    echo 'yum clean packages' > /etc/rc.d/rc.local
    it's a very very bad idea to ever 0execute a command like that. that will overwrite your rc.local file and erase anything already in it instead execute this
    Code:
    echo 'yum clean packages' >> /etc/rc.d/rc.local
    the >> says to add and not overwrite like the > does

  14. #14
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by axelseap
    it's a very very bad idea to ever 0execute a command like that. that will overwrite your rc.local file and erase anything already in it instead execute this
    Code:
    echo 'yum clean packages' >> /etc/rc.d/rc.local
    the >> says to add and not overwrite like the > does
    Fixed...
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  15. #15
    Brotherred Guest
    Any help with tarballs? Same issue.

Page 1 of 2 12 LastLast

Similar Threads

  1. Clean up disk space?
    By nandowong in forum Using Fedora
    Replies: 8
    Last Post: 26th August 2016, 05:56 AM
  2. Clean up the disk
    By luoleiCN in forum Using Fedora
    Replies: 1
    Last Post: 12th May 2009, 01:29 AM
  3. remove, clean dependencies
    By lotr in forum Using Fedora
    Replies: 2
    Last Post: 31st December 2007, 05:36 PM

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
  •  
[[template footer(Guest)]]