LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Do I need /usr/lib/debug? (https://www.linuxquestions.org/questions/linux-software-2/do-i-need-usr-lib-debug-783100/)

brianpbarnes 01-18-2010 08:49 PM

Do I need /usr/lib/debug?
 
Hi,
I am doing system backups and was shocked to see that my Ubu, 2.6.31-18-generic kernel's slash partition had grown to 12 GB. It's 2 to 3 GB when freshly installed. This type of OS bloat would embarrass Steve Balmer.

I just took my oldest XP partition, defragged it, emptied the trash, deleted the old ms update debris, zeroed all free disk space and did a dd | gz and it all fits on a 4.7 GB DVD.

Playing with Disk Usage Analyzer, I see that the largest chunk is 5 GB in /usr with almost a full gig in /usr/lib/debug. OpenOrifice comes in second with 311 MB for a spreadsheet and a word processor (didn't these use to load from floppies?). Jiva is only 81 MB. QT SDK is another monster measuring 971 MB. I wonder if I can find my old Borland Turbo C 1.0 disks.

/home is on a separate partition and /srv with my Apache server takes up 2GB with mostly my junk. Before I do the final dd, I do another dd to copy from /dev/zero to 95% of the free disk space and then delete the file to zero free space to increase compressibility.

Is ~8 GB a reasonable OS size? I have a nearly fully populated Suse 11.2 dd | gz image weighing in at only 4.2 GB. Will I have to do emergency brain surgery if I nuke /usr/lib/debug?

Thank you,

BrianP

evo2 01-18-2010 09:03 PM

Find out which packages have files there

Code:

dlocate /usr/lib/debug
(You may have to install dlocate and run update-dlocatedb first)

Then you can work out if you actually use these packages, and remove them if you don't.

Evo2.

cantab 01-18-2010 09:11 PM

6.9GiB on my Arch Linux system's root partition. 3.4 in /usr and 1.9 in /var. And Arch's a relatively 'light' system.

So 8 GiB doesn't seem unreasonable.

/usr will always dominate, since it's where the heavyweight GUI programs live.

I'm not sure what's in /usr/lib/debug though. My guess might be libraries with debugging symbols, which aid programmers and software testers but significantly increase file size.

A big space hog on Ubuntu can be the package cache, which is somewhere in /var/apt. That can easily grow to a huge amount, as packages are downloaded, installed, and not deleted.

(I have basically the same thing on Arch - 1.8 GiB of packages sitting there. I'll only clear them if I want the disk space)

It's not really fair to compare Ubuntu to a fresh Windows installation. Put all the same or similar software that you have on Ubuntu onto Windows and chances are they'll come out pretty similar.

evo2 01-18-2010 09:18 PM

Stepping away from just /usr/lib/debug and just looking for large packages installed on your system in general: I've been using the following script for many years:

Code:

#!/bin/sh
# lists installed Debian packages, sorting by package size

# This could just be a perl script extracting the install package info.
# but I made it a sh script to allow for sort manipulation afterwards.

# Installed packages read from /var/lib/dpkg/status

echo '
open(FILE,"/var/lib/dpkg/status");
$_=<FILE>;
while ($_)
{
        if ( /Package:/ )
        {
                @package = split(" ",$_);
                $_=<FILE>;
                if ( /install ok installed/ )
                {             
                        do
                        {
                                $_=<FILE>;
                        }
                        until ( /Size:/ );
                        @size = split(" ",$_);
       
                        print( "$package[1] $size[1]\n");
                }
        }
        $_=<FILE>;
}
' | perl  | sort -nr -k2

I didn't write it myself, and I can't for the life of me remember where I got it from: I owe a few beers to whoever wrote it.

Just pipe it into head or less to see what is eating all your space.

Cheers,

Evo2.

brianpbarnes 01-19-2010 12:55 PM

First, here's the dlocate trick with line counts and package names:

root@trex:/usr/lib# dlocate /usr/lib/debug | psr.pl 's/:.*$//' | freq.pl -c
4 apache2-mpm-prefork
120 kdebase-runtime-dbg
117 kdelibs5-dbg
44 kdepimlibs-dbg
20 kdewebdev-dbg
566 libc6-dbg
4 libgl1-mesa-glx-dbg
60 libqt4-dbg


Doing the Debian package size trick (with sizes presumably in kilos):
root@trex:/usr/lib# dpkgs.sh | head -n 30
libqt4-dbg 299660
kdelibs5-dbg 250136
ia32-libs 128720
openoffice.org-core 124908
linux-image-2.6.31-18-generic 110812
linux-image-2.6.31-17-generic 110776
linux-image-2.6.31-15-generic 110772
linux-image-2.6.31-14-generic 110768
linux-image-2.6.28-16-generic 109948
picasa 106480
virtualbox-3.1 98992
qt4-doc-html 87556
webmin 86008
wine 76084
openjdk-6-jre-headless 73084
linux-headers-2.6.31-18 71560
linux-headers-2.6.31-17 71556
linux-headers-2.6.31-15 71552
linux-headers-2.6.31-14 71548
qt4-doc 67224
kdepimlibs-dbg 60572
kdebase-runtime-dbg 55512
openoffice.org-common 44848
kde-icons-oxygen 42952
openprinting-gutenprint 41648
evolution-common 39960
libgl1-mesa-dri 38716
thunderbird 38540
libc6-dbg 37348
kdewebdev-dbg 37128


Getting a total size for all packages in GB:
root@trex:/usr/lib# dpkgs.sh | psr.pl 's/^.*\s(\d+)/$1/' | add.pl | mult.pl 1024 -u g
5.998

So, it looks like I can nuke a few old kernels and everything else is mine.

>> It's not really fair to compare Ubuntu to a fresh Windows installation. Put all the same or similar software that you have on Ubuntu onto Windows and chances are they'll come out pretty similar.
It's my oldest and last windoz xp (uncle bill tells me I have reloaded it too many times). It's got Photoshop, OpenOrifice, Firefox, Tbird, Perl, Apache, MySQL, Borland Builder, TCC, Intel C compiler and a bunch of Google apps. Fairly similar applications to Ubuntu. But, I cheat with google and move all of Picassa's data, Google Earth, Google* to my data drive and use Junction to put a symbolic link from the system to the data drive. It all fits on a dvd.

I will nuke some old kernels and put it on a dual layer dvd!

Thank you.

BrianP

CoderMan 01-19-2010 01:46 PM

Quote:

Originally Posted by brianpbarnes (Post 3831586)
Hi,
I am doing system backups and was shocked to see that my Ubu, 2.6.31-18-generic kernel's slash partition had grown to 12 GB. It's 2 to 3 GB when freshly installed. This type of OS bloat would embarrass Steve Balmer.

I just took my oldest XP partition, defragged it, emptied the trash, deleted the old ms update debris, zeroed all free disk space and did a dd | gz and it all fits on a 4.7 GB DVD.

Playing with Disk Usage Analyzer, I see that the largest chunk is 5 GB in /usr with almost a full gig in /usr/lib/debug. OpenOrifice comes in second with 311 MB for a spreadsheet and a word processor (didn't these use to load from floppies?). Jiva is only 81 MB. QT SDK is another monster measuring 971 MB. I wonder if I can find my old Borland Turbo C 1.0 disks.

/home is on a separate partition and /srv with my Apache server takes up 2GB with mostly my junk. Before I do the final dd, I do another dd to copy from /dev/zero to 95% of the free disk space and then delete the file to zero free space to increase compressibility.

Is ~8 GB a reasonable OS size? I have a nearly fully populated Suse 11.2 dd | gz image weighing in at only 4.2 GB. Will I have to do emergency brain surgery if I nuke /usr/lib/debug?

Thank you,

BrianP

Don't know about about Ubuntu, but under Gentoo /usr/lib/debug is used to hold symbol tables stripped off the software binaries during compiling. These files are needed later if a program crashes and you want to get a back trace to send in with a bug report.

http://indicium.us/cgi-bin/pages/get?view=gentoo_bt

So deleting them under Gentoo would be fine, but I don't know if that is the proper thing to do under a binary based distro like Ubuntu. Can you use aptitude and search for *-dbg packages, and see if you can remove them properly through the package manager?

Oh, and I would never recommend deleting the directory itself (as opposed to the files in it) because you packaging system or other software might expect it to be there.

evo2 01-19-2010 05:29 PM

Quote:

Originally Posted by CoderMan (Post 3832498)
So deleting them under Gentoo would be fine, but I don't know if that is the proper thing to do under a binary based distro like Ubuntu. Can you use aptitude and search for *-dbg packages, and see if you can remove them properly through the package manager?

That was the point of the "dlocate /usr/lib/debug": it showed which packages had files there. You would simply uninstall those packages.

Evo2.


All times are GMT -5. The time now is 10:43 PM.