NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: library cleanup after a system upgrade



Martin Husemann <martin%duskware.de@localhost> writes:

> On Thu, May 07, 2020 at 12:39:53AM +0200, Timo Buhrmester wrote:
>> > What happens to the "old libraries" ? I think they are left in so
>> > binaries continue to run.
>> > Just the new ones are symlinked to current.
>> 
>> Some get removed with postinstall obsolete, some don't.
>
> There are multiple cases and they are treated differently:
>
>  1) there were neither major nor minor version changes between the releases
> 	-> the library is overwritten with the new version during the update
>  2) the major version was bumped
> 	-> new version is installed, old version stays around as 3rd party
> 	   software in your installation could still refer to it.
> 	   There are scripts for finding all references and actually
> 	   obsolete libs, but this is typically a later (and partly
> 	   manual) step after you have updated all pkgs too.

100% right, but note that "3rd party" here means "programs not part of
the netbsd base system", and includes "things built from pkgsrc".

>  3) the minor version was bumped
> 	-> symlinks are fixed to point at the newer version, older
> 	   version is removed by postinstall


So, if you want to find old libs to delete, basically go to /lib and
/usr/lib, and list *.so by ctime.  You'll find most are from your last
update, and some are from long ago.   For each, look at the other
versions that are there and their ctimes.   Then, you can remove the old
ones.  Of course if there are programs linked against it, they will
break.

My ctimes are messed up from a dump/restore to change from regular disk
to ssd, but here is a "ls -ltr /usr/lib/libssl.so*":

  -r--r--r--  1 root  wheel  197155 Jan  6  2004 /usr/lib/libssl.so.2.1
  lrwxr-xr-x  1 root  wheel      13 Jan  6  2004 /usr/lib/libssl.so.2 -> libssl.so.2.1
  -r--r--r--  1 root  wheel  202885 Oct 18  2004 /usr/lib/libssl.so.3.0
  lrwxr-xr-x  1 root  wheel      13 Nov  1  2004 /usr/lib/libssl.so.3 -> libssl.so.3.0
  -r--r--r--  1 root  wheel  265119 Jan 28  2009 /usr/lib/libssl.so.4.0
  lrwxr-xr-x  1 root  wheel      13 Jan 28  2009 /usr/lib/libssl.so.4 -> libssl.so.4.0
  -r--r--r--  1 root  wheel  309887 Nov 17  2014 /usr/lib/libssl.so.6.0
  lrwxr-xr-x  1 root  wheel      13 Nov 17  2014 /usr/lib/libssl.so.6 -> libssl.so.6.0
  -r--r--r--  1 root  wheel  448395 Oct 27  2018 /usr/lib/libssl.so.10.6
  lrwxr-xr-x  1 root  wheel      14 Oct 27  2018 /usr/lib/libssl.so.10 -> libssl.so.10.6
  -r--r--r--  1 root  wheel  528248 Jul 22  2019 /usr/lib/libssl.so.12.0
  lrwxr-xr-x  1 root  wheel      14 Jul 22  2019 /usr/lib/libssl.so.12 -> libssl.so.12.0
  lrwxr-xr-x  1 root  wheel      14 Jul 22  2019 /usr/lib/libssl.so -> libssl.so.12.0

on a sytem currently on 8.  Doing "ls -ltrc" instead gives me:

  lrwxr-xr-x  1 root  wheel      13 May 13  2018 /usr/lib/libssl.so.2 -> libssl.so.2.1
  lrwxr-xr-x  1 root  wheel      13 May 13  2018 /usr/lib/libssl.so.3 -> libssl.so.3.0
  lrwxr-xr-x  1 root  wheel      13 May 13  2018 /usr/lib/libssl.so.4 -> libssl.so.4.0
  lrwxr-xr-x  1 root  wheel      13 May 13  2018 /usr/lib/libssl.so.6 -> libssl.so.6.0
  -r--r--r--  1 root  wheel  197155 May 13  2018 /usr/lib/libssl.so.2.1
  -r--r--r--  1 root  wheel  202885 May 13  2018 /usr/lib/libssl.so.3.0
  -r--r--r--  1 root  wheel  265119 May 13  2018 /usr/lib/libssl.so.4.0
  -r--r--r--  1 root  wheel  309887 May 13  2018 /usr/lib/libssl.so.6.0
  lrwxr-xr-x  1 root  wheel      14 Dec 11  2018 /usr/lib/libssl.so.10 -> libssl.so.10.6
  -r--r--r--  1 root  wheel  448395 Dec 11  2018 /usr/lib/libssl.so.10.6
  lrwxr-xr-x  1 root  wheel      14 Feb 21 19:53 /usr/lib/libssl.so -> libssl.so.12.0
  lrwxr-xr-x  1 root  wheel      14 Feb 21 19:53 /usr/lib/libssl.so.12 -> libssl.so.12.0
  -r--r--r--  1 root  wheel  528248 Feb 21 19:53 /usr/lib/libssl.so.12.0

(Note that mod date here and last system update are not necessarily the
same, as full builds do not always rebuild things when using update
builds.)


Home | Main Index | Thread Index | Old Index