I was working on archiving an old virtual server today and was reminded of how much space is wasted by some of the default installations on CentOS. I think this was a 5.x box.
Anyway, in /usr/lib/64 (and probably /usr/lib on non-64 systems), there were a lot of directories which have no bearing on a basic server. I saw firefox, openoffice and many, many other directories -- replete with enough files to seriously affect backup space over time.
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?
I found something a while back for shutting off unused services, but this seems to be a gaping hole in available archives.
Thanks.
CT
Am 15.02.2012 21:30, schrieb Craig Thompson:
I was working on archiving an old virtual server today and was reminded of how much space is wasted by some of the default installations on CentOS. I think this was a 5.x box.
Anyway, in /usr/lib/64 (and probably /usr/lib on non-64 systems), there were a lot of directories which have no bearing on a basic server. I saw firefox, openoffice and many, many other directories -- replete with enough files to seriously affect backup space over time.
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?
I found something a while back for shutting off unused services, but this seems to be a gaping hole in available archives.
Thanks.
CT
You are kidding, are you?
Uninstall unused / unnecessary software cleanly using using yum (or rpm). *Don't* randomly delete filesystem structures you think they are pointless or wasting harddrive space.
Alexander
Hardly kidding. But then again, this is early April isn't it? Oh, wait...
To "cleanly uninstall unused software," one would need a list of what software is ON the system which is unused. Doing a "minimal" install pretty much gives you a system which no one can use. Doing the classic "server" install loads a lot of this junk which no one ever uses. As someone opined on this list, "Why does CentOS install bluetooth packages???" I don't want it on my server. I'm trying to find out what the commonly UNUSED packages are so they can be removed.
I randomly selected one package "pango" and found it had about 200 dependencies and uninstalled it. Lucky? But I'm sure there are more.
And nowhere do I recall proposing a mass hysteria approach of "rm -R -f /" ...
Can you help in this? If so, I would welcome your input.
On Feb 15, 2012, at 3:51 PM, Alexander Dalloz wrote:
Am 15.02.2012 21:30, schrieb Craig Thompson:
I was working on archiving an old virtual server today and was reminded of how much space is wasted by some of the default installations on CentOS. I think this was a 5.x box.
Anyway, in /usr/lib/64 (and probably /usr/lib on non-64 systems), there were a lot of directories which have no bearing on a basic server. I saw firefox, openoffice and many, many other directories -- replete with enough files to seriously affect backup space over time.
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?
I found something a while back for shutting off unused services, but this seems to be a gaping hole in available archives.
Thanks.
CT
You are kidding, are you?
Uninstall unused / unnecessary software cleanly using using yum (or rpm). *Don't* randomly delete filesystem structures you think they are pointless or wasting harddrive space.
Alexander _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On 02/15/12 1:00 PM, Craig Thompson wrote:
Doing a "minimal" install pretty much gives you a system which no one can use.
Nowdays, I nearly always do a minimal install, then add the specific packages I need...
on a recent C6 build for an archival file server, that consisted of...
| yum -y install wget ftp xfsprogs xfsdump man man-pages parted unzip pciutils \ sysstat mailx vim openssh-clients ||vsftpd ||samba samba-client | | and half of that stuff wasn't absolutely required, was just there for my convenience...
|
Craig Thompson wrote:
Hardly kidding. But then again, this is early April isn't it? Oh, wait...
To "cleanly uninstall unused software," one would need a list of what software is ON the system which is unused. Doing a "minimal" install pretty much gives you a system which no one can use. Doing the classic
I agree. I just did a minimal install last week, and had all *kinds* of grief trying to get networking working.
"server" install loads a lot of this junk which no one ever uses. As someone opined on this list, "Why does CentOS install bluetooth packages???" I don't want it on my server. I'm trying to find out what the commonly UNUSED packages are so they can be removed.
Yup. For that matter, why would I want avahi running on a rackmount server that's hardwired for gigabit ethernet? But you get that, too, with "server".
I randomly selected one package "pango" and found it had about 200 dependencies and uninstalled it. Lucky? But I'm sure there are more.
There are indeed some packages that have a ridiculous set of dependencies. I can't remember what it was - it's been months, but I wanted to install some command line tool, and it wanted gnome installed. <snip> mark
On 02/15/12 1:13 PM, m.roth@5-cent.us wrote:
I agree. I just did a minimal install last week, and had all*kinds* of grief trying to get networking working.
huh? I did a minimal install of C6 and it came up on DHCP right off the bat. I don't even think I had to start sshd (at least, if I did, I forgot to record such on my installation notes)
John R Pierce wrote:
On 02/15/12 1:13 PM, m.roth@5-cent.us wrote:
I agree. I just did a minimal install last week, and had all*kinds* of grief trying to get networking working.
huh? I did a minimal install of C6 and it came up on DHCP right off the bat. I don't even think I had to start sshd (at least, if I did, I forgot to record such on my installation notes)
Let me think.... I *think* it might have been on a blade, so there may have been some oddness.
mark
On Wednesday, February 15, 2012 04:13:23 PM m.roth@5-cent.us wrote:
There are indeed some packages that have a ridiculous set of dependencies. I can't remember what it was - it's been months, but I wanted to install some command line tool, and it wanted gnome installed.
This is one area 'build it yourself' distributions have done better than more general-purpose distributions. With gentoo, as an example, you can build the system with options telling it how to build each package.
There are packages that require some things installed in the general case due to build-time options, and in order to eliminate the dependency you have to rebuild from source; to then go and say you want that feature back you have to rebuild from source.
Some seemingly 'ridiculous' dependencies are there for that reason, and the packager is building for the general case, not for the minimalist case.
And, no, I can't think of one right of the top of my head, either.
On Wednesday, February 15, 2012 04:00:45 PM Craig Thompson wrote:
Hardly kidding. But then again, this is early April isn't it? Oh, wait...
To "cleanly uninstall unused software," one would need a list of what software is ON the system which is unused.
And one would need to define 'unused.'
The Windows Add/Remove Control Panel widget has an indicator of 'last usage' and it might be possible to emulate that to a degree by looking at the last accessed time for a library... hmmm, something like:
find /usr/lib64 ! -used +1 -exec rpm -qf {} ; |sort|uniq
might do *part* of what you want, at least for /usr/lib64. I say *part* simply because this finds all files that have not been used more than 1 day after their status last changed and lists the package containing that file, sorts the output, and strips out all nonunique lines, but it is very possible that a package could have many, but not all, of its files 'used' and wind up on this list because of even just one unused file.... and what you want is to find each package where *none* of its files have been used since their status last changed (that is, since that package was last installed/modified).
But you'd want to actually *use* all of the programs you expect to be used before acting on that list.... and you'd want to take the packages on that list and feed them to 'rpm -ql' for each package, and see if *any* file in that package had been 'used' (in the 'find' sense of the word).
Sounds like a 'yum remove-unused' plugin or 'yum-cleanup-unused' utility or an enhancement to 'package-cleanup' from the yum-utils package, really, since the yum API has all the hooks necessary to do this from python. Python is guaranteed to be available on any EL system with a functional yum, and is much more powerful than shell for this sort of thing, so it would be a good fit, IMO.
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@localhost ~]# cd /usr/lib64 [root@localhost lib64]# cd firefox-3.6 [root@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@localhost firefox-3.6]# pwd /usr/lib64/firefox-3.6 [root@localhost firefox-3.6]# rpm -qf application.ini firefox-3.6.26-1.el6.centos.x86_64 [root@localhost firefox-3.6]# cd .. [root@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@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@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@localhost lib64]# cd python2.6 [root@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@localhost python2.6]# rpm -qf runpy.py python-2.6.6-29.el6.x86_64 [root@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@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.....
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@localhost ~]# cd /usr/lib64 [root@localhost lib64]# cd firefox-3.6 [root@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@localhost firefox-3.6]# pwd /usr/lib64/firefox-3.6 [root@localhost firefox-3.6]# rpm -qf application.ini firefox-3.6.26-1.el6.centos.x86_64 [root@localhost firefox-3.6]# cd .. [root@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@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@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@localhost lib64]# cd python2.6 [root@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@localhost python2.6]# rpm -qf runpy.py python-2.6.6-29.el6.x86_64 [root@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@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@centos.org http://lists.centos.org/mailman/listinfo/centos
Dear Craig,
On Wed, 15 Feb 2012 16:58:40 -0500 Craig Thompson cthompson@loganthompsonlaw.com wrote:
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.
Why don't you go the other way around: Create a kickstart file with only the exact packages you need?
E.g. -- snip --
%packages --excludedocs --nobase screen vim-enhanced wget postfix vixie-cron
Above example will give you a minimal system with 5 extra packages. You can do a lot more with kickstart. See http://fedoraproject.org/wiki/Anaconda/Kickstart for full documentation.
Brgds
Craig Thompson wrote:
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.
<snip> Here's a thought: yum grouplist | awk '{if ($3 ~ /Groups/ ) { doit = ($1 ~ /Install/ ) ? 1 : 0;} if ( doit ) { print $0; }}'
This will name all the groups that are installed. if you see, say, "Office Suite and Productivity", you can do a yum remove @"Office Suite and Productivity"
mark