On 2024/01/27 20:43:17 +0100, Jan Stary <[email protected]> wrote:
> On Jan 27 17:46:07, [email protected] wrote:
> > I'm looking at one of my OpenBSD systems here that has been upgraded
> > over a long time, and has /usr/local running out of space.
> >
> > It seems there's a lot of old versions of shared libraries in
> > /usr/local/lib, like for example:
> >
> > > # ls -al /usr/local/lib/libvpx.so.*
> > > -rw-r--r-- 1 root bin 1909442 Mar 27 2018
> > /usr/local/lib/libvpx.so.10.0
> > > -rw-r--r-- 1 root bin 2047296 Oct 11 2018
> > /usr/local/lib/libvpx.so.11.0
> > > -rw-r--r-- 1 root bin 3182104 Apr 19 2021
> > /usr/local/lib/libvpx.so.12.0
> > > -rw-r--r-- 1 root bin 2049592 Sep 26 2021
> > /usr/local/lib/libvpx.so.13.0
> > > -rw-r--r-- 1 root bin 2062112 Sep 29 2022
> > /usr/local/lib/libvpx.so.14.0
> > > -rw-r--r-- 1 root bin 2057584 Mar 25 2023
> > /usr/local/lib/libvpx.so.15.0
> > > -rw-r--r-- 1 root bin 2069504 Oct 6 00:20
> > /usr/local/lib/libvpx.so.16.0
> > > -rw-r--r-- 1 root bin 1869707 Jul 26 2016
> > /usr/local/lib/libvpx.so.7.0
> > > -rw-r--r-- 1 root bin 1909806 Oct 2 2017
> > /usr/local/lib/libvpx.so.8.0
> >
> > Is this expected, or a result of some error I made during upgrades?
>
> That's definitely weird. Which packages own these files?
> $ pkg_info -E /usr/local/lib/libvpx.so.8.0
> $ doas pkg_check -Fq
>
> > Usually I'm just running pkg_add -u to pull fresh versions of packages.
> > And is there some "standard" way to get rid of the old versions?
>
> pkg_add generally replaces the old version with the new versions.
not exactly. it leaves old libraries around when they're needed by other
packages. this is documented in pkg_add(1)
4. Shared libraries deserve special treatment: each shared library from
the old packages that does no longer exist in the new packages, but
that is required from a wantlib of another package is kept along in
a stub package named .libs-<pkgname>.
I haven't found a mix of flags to list these .libs-* packages, but you
should be able to find them in /var/db/pkg
$ ls -d /var/db/pkg/.libs-*
usually, pkg_delete -a should get rid of them once they're not needed
anymore. (i.e. all the packages are successfully updated -- this
includes also packages built and installed locally.)
> > I could probably compare whatever is there against the pkglocate
> > database or check each file against pkglocate individually and parse
> > the output or something
>
> That's what pkg_info -F does.
and sysclean -p too I believe.