Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Support > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Display Modes
  #1  
Old 15th January 2006, 08:24 PM
Firewing1's Avatar
Firewing1 Online
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 20
Posts: 9,425
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)
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)

Last edited by Firewing1; 9th June 2007 at 08:48 PM.
Reply With Quote
  #2  
Old 15th January 2006, 08:28 PM
jim's Avatar
jim Offline
Retired Community Manager & Avid Drinker Of Suds
 
Join Date: Feb 2005
Location: Rochester NY
Age: 37
Posts: 4,180
Quote:
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?
Reply With Quote
  #3  
Old 15th January 2006, 08:29 PM
Firewing1's Avatar
Firewing1 Online
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 20
Posts: 9,425
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)
Reply With Quote
  #4  
Old 15th January 2006, 08:38 PM
jim's Avatar
jim Offline
Retired Community Manager & Avid Drinker Of Suds
 
Join Date: Feb 2005
Location: Rochester NY
Age: 37
Posts: 4,180
You need to be carefull on what you get rid of
take a peek on what it considers duplicate not needed rpms

for example

Quote:
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
File Type: txt RPMS_complete.txt (9,1 KB, 232 views)
File Type: txt RPMS_notneeded.txt (3,9 KB, 293 views)
__________________
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?
Reply With Quote
  #5  
Old 15th January 2006, 08:41 PM
Firewing1's Avatar
Firewing1 Online
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 20
Posts: 9,425
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)
Reply With Quote
  #6  
Old 15th January 2006, 08:51 PM
Firewing1's Avatar
Firewing1 Online
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 20
Posts: 9,425
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
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)

Last edited by Firewing1; 15th January 2006 at 09:33 PM.
Reply With Quote
  #7  
Old 15th January 2006, 09:02 PM
jim's Avatar
jim Offline
Retired Community Manager & Avid Drinker Of Suds
 
Join Date: Feb 2005
Location: Rochester NY
Age: 37
Posts: 4,180
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?
Reply With Quote
  #8  
Old 15th January 2006, 09:03 PM
axelseap's Avatar
axelseap Offline
Registered User
 
Join Date: Dec 2005
Posts: 456
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
Reply With Quote
  #9  
Old 15th January 2006, 09:25 PM
Firewing1's Avatar
Firewing1 Online
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 20
Posts: 9,425
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
File Type: txt rpm_cleanup.txt (951 Bytes, 297 views)
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)

Last edited by Firewing1; 15th January 2006 at 09:38 PM.
Reply With Quote
  #10  
Old 17th January 2006, 04:26 AM
axelseap's Avatar
axelseap Offline
Registered User
 
Join Date: Dec 2005
Posts: 456
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.
Reply With Quote
  #11  
Old 17th January 2006, 03:49 PM
tejas's Avatar
tejas Offline
Registered User
 
Join Date: Feb 2005
Location: Bangalore
Age: 24
Posts: 1,574
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.
__________________
I Was Counted! Registered Linux User #384707

BASH && Beer && Bass! Now THAT makes sense!!
Reply With Quote
  #12  
Old 17th January 2006, 10:49 PM
Firewing1's Avatar
Firewing1 Online
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 20
Posts: 9,425
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)
Reply With Quote
  #13  
Old 4th February 2006, 06:02 PM
axelseap's Avatar
axelseap Offline
Registered User
 
Join Date: Dec 2005
Posts: 456
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
Reply With Quote
  #14  
Old 4th February 2006, 06:42 PM
Firewing1's Avatar
Firewing1 Online
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 20
Posts: 9,425
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)
Reply With Quote
  #15  
Old 4th February 2006, 07:09 PM
Brotherred's Avatar
Brotherred Offline
Registered User
 
Join Date: Apr 2005
Location: Michigan
Posts: 99
Any help with tarballs? Same issue.
Reply With Quote
Reply

Tags
clean, disk, remove, rpms, uneeded

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clean up the disk luoleiCN General Support 1 12th May 2009 01:29 AM
remove, clean dependencies lotr Software 2 31st December 2007 05:36 PM
Clean up disk space? nandowong General Support 7 26th December 2004 12:51 AM
Re: I want to clean my hard disk Arnaldo Bento gmane.linux.redhat.fedora.general 5 13th October 2004 08:01 PM
I want to clean my hard disk Arnaldo Bento gmane.linux.redhat.fedora.general 8 13th October 2004 08:01 PM


Current GMT-time: 10:09 (Saturday, 11-02-2012)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat