Safe to delete old files in /usr/lib?

Shane Ambler FreeBSD at ShaneWare.Biz
Tue Jan 5 03:52:42 UTC 2016

On 05/01/2016 06:04, Polytropon wrote:
> On Mon, 4 Jan 2016 19:18:02 +0100, Markus Edemalm wrote:
>>> 4 jan. 2016 kl. 18:52 skrev Polytropon <freebsd at>:
>>> On Mon, 4 Jan 2016 18:28:14 +0100, Markus Edemalm wrote:
>>>>> 4 jan. 2016 kl. 18:12 skrev Polytropon <freebsd at>:
>>>>> On Mon, 4 Jan 2016 18:06:00 +0100, Markus Edemalm wrote:
>>>>>> Hello,
>>>>>> My system was first installed as 10.0-RELEASE. I have
>>>>>> sinceupgraded to 10.1, 10.1-STABLE, 10.2-RELEASE and is now
 >>>>>> at 10.2-RELEASE-p8.
>>>>>> I’ve rebuild from source and followed the steps in the
 >>>>>> handbook. Everything is fine… but:
>>>>>> I see many files in /usr/lib with old dates, apparently
>>>>>> they are
no longer installed during upgrades.

Did you clear out /usr/obj
With the right modifications dates, a binary doesn't need to be rebuilt

While I think make buildworld should clean it out, some files may get 

>>>>>> My /etc/make.conf looks like this:
>>>>>> NO_PROFILE=true
>>>>>> WITHOUT_X11=yes
>>>>>> Today, January the 4th, I upgraded to -p8. The newly
>>>>>> installedfiles has todays date, i.e ”Jan 4”.
>>>>>> If I do:
>>>>>> ls -lF /usr/lib | grep -v 'Jan  4' | awk {'print $9'}
>>>>>> …I get the following list of (obsolete?) files and folders with older dates.

>>>> And, they are all .a files, except for and
>>>> I added NO_PROFILE=true to /etc/make.conf a while back. Is that relevant?
>>> Hmmm... I always thought that would be the default (no profiling libs
>>> being built and installed). But according to "man src.conf", the
>>> setting's name is WITHOUT_PROFILE, not NO_PROFILE.
>> Hmm. I forgot about src.conf, I got:
>> cat /etc/src.conf
>> That may explain why _some_ libs are not being built and installed.
>> But still, more than 100 .a files with old dates. Doesn’t make sense to me at all.
> In this case, a good idea would be to move the old libraries out
> of /usr/lib (for example into a newly created /usr/lib.old directory)
> and checking if any application in use produces an error. In that
> case, the required library could be restored. If no further error
> appears - forget about those libraries. :-)

.a files should be copied into the final binary, so removing .a files
won't break anything that is already built, but the next make could
fail with a missing library at link time.

I am running 10-stable and run make delete-old after upgrades -

ls /usr/lib/*.a | wc -l
ls /usr/lib/*.so | wc -l

find /usr/lib -type l -name "*.a" | wc -l

I do seem to have a few old libs

find /usr/lib -not -newermt "2 weeks ago" | wc -l

Downloading base.txz for 10.2-RELEASE -

ls usr/lib/*.a | wc -l
ls usr/lib/*.so | wc -l

FreeBSD - the place to B...Software Developing

Shane Ambler

More information about the freebsd-questions mailing list