[CentOS] question on unused directories in /usr/lib and /usr/lib64

Wed Feb 15 21:58:40 UTC 2012
Craig Thompson <cthompson at loganthompsonlaw.com>

Thanks, Lamar.  This is the type of helpful response I was looking for.

If anyone has any other practical "lists of junk" please post them.

My goal is to develop my own list, put it in a basic shell script and remove them wholesale.  I've done this for generally unused services which I run upon installation of a basic system, and it works well.

The more community input, the better, IMO.

Thanks again.

On Feb 15, 2012, at 4:30 PM, Lamar Owen wrote:

> On Wednesday, February 15, 2012 03:30:56 PM Craig Thompson wrote:
>> Does anyone have an available script or list of commands for removing most or all of these "generally unused" directories, packages or whatever they are?
> 
> Ok, here's a two-step process you can try:
> 1.) rpm -qf /usr/lib/name/of/file/in/one/of/those/directories
> 2.) yum remove result-from-step-1-without-version-or-release-but-with-arch.  Be sure to check the dependencies yum will want to remove, and think it through at least twice before confirming by pressing 'y.'
> 
> This is a diesel piledriver of a solution, but..... do be careful you aren't trying to remove something really important.
> 
> As an arbitrary and simple example:
> [root at localhost ~]# cd /usr/lib64
> [root at localhost lib64]# cd firefox-3.6
> [root at localhost firefox-3.6]# ls
> application.ini           chrome      extensions  langpacks  README.txt
> blocklist.xml             components  firefox     LICENSE    run-mozilla.sh
> browserconfig.properties  defaults    icons       modules    searchplugins
> [root at localhost firefox-3.6]# pwd
> /usr/lib64/firefox-3.6
> [root at localhost firefox-3.6]# rpm -qf application.ini
> firefox-3.6.26-1.el6.centos.x86_64
> [root at localhost firefox-3.6]# cd .. 
> [root at localhost lib64]# yum remove firefox.x86_64
> Loaded plugins: fastestmirror, refresh-packagekit, security
> Setting up Remove Process
> Resolving Dependencies
> --> Running transaction check
> ---> Package firefox.x86_64 0:3.6.26-1.el6.centos will be erased
> --> Finished Dependency Resolution
> 
> Dependencies Resolved
> 
> ================================================================================
> Package        Arch          Version                     Repository       Size
> ================================================================================
> Removing:
> firefox        x86_64        3.6.26-1.el6.centos         @updates         17 M
> 
> Transaction Summary
> ================================================================================
> Remove        1 Package(s)
> 
> Installed size: 17 M
> Is this ok [y/N]: n
> Exiting on user Command
> [root at localhost firefox-3.6]#
> 
> 
> Here's a more concrete (if extreme) example, since the python-2.6 directory in a default CentOS system isn't small (do note that I've snipped out several hundred lines of output with points of ellipsis (...) but left in lines that show real dealbreaker issues.....):
> 
> [root at localhost lib64]# du . --max-depth=1|sort -g
> 4       ./audit
> 4       ./games
> 4       ./libxslt-plugins
> ..
> 19112   ./firefox-3.6
> 29568   ./xulrunner-1.9.2
> 39092   ./dri
> 46536   ./perl5
> 77424   ./python2.6
> 141624  ./valgrind
> 691124  .
> [root at localhost lib64]# cd python2.6
> [root at localhost python2.6]# ls
> _abcoll.py           HTMLParser.py          sched.pyc
> ...
> htmlentitydefs.pyo   runpy.py               zipfile.pyc
> htmllib.py           runpy.pyc              zipfile.pyo
> htmllib.pyc          runpy.pyo
> htmllib.pyo          sched.py
> [root at localhost python2.6]# rpm -qf runpy.py
> python-2.6.6-29.el6.x86_64
> [root at localhost python2.6]# yum remove python.x86_64
> Loaded plugins: fastestmirror, refresh-packagekit, security
> Setting up Remove Process
> Resolving Dependencies
> --> Running transaction check
> ---> Package python.x86_64 0:2.6.6-29.el6 will be erased
> --> Processing Dependency: python(abi) = 2.6 for package: python-babel-0.9.4-5.1.el6.noarch
> --> Processing Dependency: python(abi) = 2.6 for package: authconfig-6.1.12-5.el6.x86_64
> ...
> ---> Package yum.noarch 0:3.2.29-22.el6.centos will be erased
> --> Processing Dependency: yum >= 3.2.18 for package: yum-plugin-security-1.1.30-10.el6.noarch
> --> Processing Dependency: yum >= 3.0 for package: yum-plugin-fastestmirror-1.1.30-10.el6.noarch
> ---> Package yum-metadata-parser.x86_64 0:1.1.2-16.el6 will be erased
> ---> Package yum-utils.noarch 0:1.1.30-10.el6 will be erased
> --> Running transaction check
> ...
> ---> Package cman.x86_64 0:3.0.12.1-23.el6 will be erased
> ...
> --> Processing Dependency: gettext = 0.17-16.el6 for package: gettext-devel-0.17-16.el6.x86_64
> --> Processing Dependency: gettext for package: libvirt-client-0.9.4-23.el6_2.4.x86_64
> ---> Package grub.x86_64 1:0.97-75.el6 will be erased
> --> Processing Dependency: grub for package: 1:libguestfs-1.7.17-26.el6.x86_64
> ...
> --> Processing Dependency: /sbin/mount.nfs for package: resource-agents-3.9.2-7.el6.x86_64
> --> Restarting Dependency Resolution with new changes.
> --> Running transaction check
> ---> Package resource-agents.x86_64 0:3.9.2-7.el6 will be erased
> --> Finished Dependency Resolution
> Error: Trying to remove "yum", which is protected
> You could try using --skip-broken to work around the problem
> You could try running: rpm -Va --nofiles --nodigest
> [root at localhost python2.6]# 
> 
> In other words, you can't remove /usr/lib64/python2.6 safely..... unless you want the basic 'yum' command to break....and want to remove the bootloader.... and want the cluster manager (cman) to quit working..... 
> 
> But python2.6 accounts for over 11% of the space in the /usr/lib64 tree.....
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos