A lot of ports installed, necessary?

Hello all,

On the old server we had around 120 ports installed.
The main difference on our new server, is that we now also have textproc/elasticsearch7 and java/openjdk8 installed.

And now we have 280 ports installed instead, with all dependencies.
That's a huge difference.

I just deinstalled archivers/zstd (no dependencies) as it didn't build with devel/meson.
I recently also deinstalled graphics/libdrm (no dependencies) as it also didn't build.
It feels that errors like this is going to be more common.

I have never used pkg, only cvsup and portmaster.
Is pkg a better choice, as we don't make any changes in the code anyway?

Is there any way to find out what's needed of all this?
I'm feeling lost in the ports jungle,

Ps: I do recognize a lot of them ;)

Thank you,

Code:
===>>> Root ports (No dependencies, not depended on)
===>>> boost-jam-1.72.0
===>>> bootstrap-openjdk8-r450802_1
===>>> dialog4ports-0.1.6
===>>> gitup-0.94
===>>> libxshmfence-1.3
===>>> nasm-2.15.05,1
===>>> pftop-0.7_9
===>>> pkg-1.16.3
===>>> pkgconf-1.7.4,1
===>>> portmaster-3.19_28
===>>> re2c-0.14.3
===>>> redis-6.0.13
===>>> smartmontools-7.2_1
===>>> sshguard-2.4.1,1
===>>> tcl86-8.6.11_1
===>>> wayland-protocols-1.21
===>>> xorg-macros-1.19.3
===>>> xtrans-1.4.0
===>>> zip-3.0_1
===>>> 19 root ports


===>>> Trunk ports (No dependencies, are depended on)
===>>> alsa-lib-1.2.2
===>>> autoconf-wrapper-20131203
===>>> boehm-gc-8.0.4_1
===>>> ca_root_nss-3.63
===>>> db5-5.3.28_7
===>>> expat-2.3.0
===>>> freetype2-2.10.4
===>>> fusefs-libs-2.9.9_2
===>>> giflib-5.2.1
===>>> gnome_subr-1.0
===>>> icu-69.1,1
===>>> indexinfo-0.3.1
===>>> jansson-2.13.1
===>>> java-zoneinfo-2021.a
===>>> javavmwrapper-2.7.7
===>>> jbigkit-2.1_1
===>>> jpeg-turbo-2.0.6
===>>> jsoncpp-1.9.4
===>>> libICE-1.0.10,1
===>>> libXau-1.0.9
===>>> libargon2-20190702
===>>> libdaemon-0.14_1
===>>> libdnet-1.13_3
===>>> libedit-3.1.20210216,1
===>>> libepoll-shim-0.0.20210418
===>>> libevent-2.1.12
===>>> libfontenc-1.1.4
===>>> libiconv-1.16
===>>> libinotify-20180201_2
===>>> libltdl-2.4.6
===>>> liblz4-1.9.3,1
===>>> libmspack-0.10.1
===>>> libnghttp2-1.43.0
===>>> libpaper-1.1.24.4
===>>> libpthread-stubs-0.4
===>>> libsigsegv-2.12
===>>> libsodium-1.0.18
===>>> libunwind-20201110
===>>> libuv-1.41.0
===>>> libxml2-2.9.10_3
===>>> libzip-1.7.3
===>>> lsof-4.94.0,8
===>>> lzo2-2.10_1
===>>> mpdecimal-2.5.1
===>>> oniguruma-6.9.7.1
===>>> panda-cclient-20130621_1
===>>> pciids-20210426
===>>> pcre-8.44
===>>> pcre2-10.36
===>>> perl5-5.32.1_1
===>>> pixman-0.40.0_1
===>>> png-1.6.37_1
===>>> socat-1.7.4.1_1
===>>> unixODBC-2.3.9
===>>> xmlcatmgr-2.2_2
===>>> xorgproto-2021.4
===>>> xxhash-0.8.0
===>>> 57 trunk ports


===>>> Branch ports (Have dependencies, are depended on)
===>>> apache24-2.4.46_2
===>>> apr-1.7.0.1.6.1_1
===>>> autoconf-2.69_3
===>>> avahi-app-0.8
===>>> bash-5.1.8
===>>> boost-libs-1.72.0_5
===>>> curl-7.76.1
===>>> dbus-1.12.20_4
===>>> dbus-glib-0.110
===>>> dejavu-2.37_1
===>>> diffutils-3.7
===>>> docbook-1.5
===>>> docbook-sgml-4.5_1
===>>> docbook-xml-5.0_3
===>>> docbook-xsl-1.79.1_1,1
===>>> fontconfig-2.13.93,1
===>>> galera26-26.4.8_1
===>>> gdbm-1.19
===>>> gdk-pixbuf2-2.40.0
===>>> getopt-1.1.6
===>>> gettext-runtime-0.21
===>>> glib-2.66.7_1,1
===>>> gmp-6.2.1
===>>> gnutls-3.6.15
===>>> iso8879-1986_3
===>>> jna-5.7.0
===>>> libSM-1.2.3,1
===>>> libX11-1.7.1,1
===>>> libXdmcp-1.1.3
===>>> libXext-1.3.4,1
===>>> libXfixes-5.0.3_2
===>>> libXrender-0.9.10_2
===>>> libXt-1.2.1,1
===>>> libarchive-3.5.1,1
===>>> libffi-3.3_1
===>>> libgcrypt-1.9.2_1
===>>> libgd-2.3.1,1
===>>> libgpg-error-1.42
===>>> libidn2-2.3.1
===>>> libnotify-0.7.9_1
===>>> libslang2-2.3.2_2
===>>> libtasn1-4.17.0
===>>> libtextstyle-0.21
===>>> libunistring-0.9.10_1
===>>> libxcb-1.14_1
===>>> libxslt-1.1.34_1
===>>> lua52-5.2.4
===>>> m4-1.4.18_1,1
===>>> mariadb104-client-10.4.19
===>>> mesa-libs-20.2.3
===>>> mkfontscale-1.2.1
===>>> nettle-3.7.2_2
===>>> ninja-1.10.2,2
===>>> openjdk8-8.292.10.1
===>>> p11-kit-0.23.22_1
===>>> p5-Locale-gettext-1.07
===>>> p5-Locale-libintl-1.32
===>>> p5-Text-Unidecode-1.30
===>>> p5-Unicode-EastAsianWidth-12.0
===>>> p5-XML-Parser-2.44
===>>> php74-7.4.19
===>>> php74-bcmath-7.4.19
===>>> php74-bz2-7.4.19
===>>> php74-ctype-7.4.19
===>>> php74-curl-7.4.19
===>>> php74-dom-7.4.19
===>>> php74-filter-7.4.19
===>>> php74-gd-7.4.19
===>>> php74-iconv-7.4.19
===>>> php74-intl-7.4.19
===>>> php74-json-7.4.19
===>>> php74-mbstring-7.4.19
===>>> php74-mysqli-7.4.19
===>>> php74-opcache-7.4.19
===>>> php74-openssl-7.4.19
===>>> php74-pdo-7.4.19
===>>> php74-pdo_mysql-7.4.19
===>>> php74-pdo_sqlite-7.4.19
===>>> php74-phar-7.4.19
===>>> php74-posix-7.4.19
===>>> php74-session-7.4.19
===>>> php74-simplexml-7.4.19
===>>> php74-soap-7.4.19
===>>> php74-sockets-7.4.19
===>>> php74-sqlite3-7.4.19
===>>> php74-tokenizer-7.4.19
===>>> php74-xml-7.4.19
===>>> php74-xmlreader-7.4.19
===>>> php74-xmlwriter-7.4.19
===>>> php74-xsl-7.4.19
===>>> php74-zip-7.4.19
===>>> php74-zlib-7.4.19
===>>> py38-Babel-2.9.1
===>>> py38-Jinja2-2.11.2_1
===>>> py38-acme-1.15.0,1
===>>> py38-alabaster-0.7.12
===>>> py38-beaker-1.11.0
===>>> py38-certifi-2020.12.5
===>>> py38-cffi-1.14.5
===>>> py38-chardet-3.0.4_3,1
===>>> py38-configargparse-1.4
===>>> py38-configobj-5.0.6_1
===>>> py38-cryptography-3.3.2
===>>> py38-distro-1.5.0
===>>> py38-docutils-0.17.1
===>>> py38-idna-2.10
===>>> py38-imagesize-1.2.0
===>>> py38-josepy-1.5.0
===>>> py38-libxml2-2.9.10_3
===>>> py38-markupsafe-1.1.1_1
===>>> py38-openssl-20.0.1
===>>> py38-packaging-20.9
===>>> py38-parsedatetime-2.6
===>>> py38-pycparser-2.20
===>>> py38-pygments-2.7.2
===>>> py38-pyparsing-2.4.7
===>>> py38-pyrfc3339-1.1
===>>> py38-pysocks-1.7.1
===>>> py38-pystemmer-2.0.0.1
===>>> py38-pytz-2021.1,1
===>>> py38-requests-2.25.1
===>>> py38-requests-toolbelt-0.9.1
===>>> py38-setuptools-44.0.0_1
===>>> py38-six-1.16.0
===>>> py38-snowballstemmer-2.1.0
===>>> py38-sphinxcontrib-applehelp-1.0.2
===>>> py38-sphinxcontrib-devhelp-1.0.2
===>>> py38-sphinxcontrib-htmlhelp-1.0.3
===>>> py38-sphinxcontrib-jsmath-1.0.1
===>>> py38-sphinxcontrib-qthelp-1.0.3
===>>> py38-sphinxcontrib-serializinghtml-1.1.4
===>>> py38-urllib3-1.25.11,1
===>>> py38-zope.component-4.2.2
===>>> py38-zope.event-4.1.0
===>>> py38-zope.interface-5.3.0
===>>> python38-3.8.10
===>>> readline-8.1.1
===>>> rhash-1.4.1
===>>> rsync-3.2.3_1
===>>> sdocbook-xml-1.1_2,2
===>>> shared-mime-info-2.0
===>>> sqlite3-3.35.5_1,1
===>>> tiff-4.3.0
===>>> tpm-emulator-0.7.4_2
===>>> trousers-0.3.14_3
===>>> w3m-0.5.3.20210424
===>>> wayland-1.19.0
===>>> webp-1.2.0
===>>> xmlcharent-0.3_2
===>>> 149 branch ports


===>>> Leaf ports (Have dependencies, not depended on)
===>>> acme.sh-2.8.9
===>>> apache-ant-1.10.8
===>>> automake-1.16.3
===>>> bash-completion-2.11,2
===>>> binutils-2.33.1_4,1
===>>> bison-3.7.6,1
===>>> cairo-1.16.0_1,3
===>>> check-0.15.2
===>>> cmake-3.20.2
===>>> cups-2.3.3op2
===>>> docbook-xsl-ns-1.79.1
===>>> elasticsearch7-7.10.1
===>>> gettext-tools-0.21
===>>> gmake-4.3_2
===>>> gobject-introspection-1.66.1,1
===>>> gperf-3.1
===>>> help2man-1.48.3
===>>> htop-3.0.4_1
===>>> intltool-0.51.0_1
===>>> itstool-2.0.6
===>>> libXdamage-1.1.5
===>>> libXrandr-1.5.2
===>>> libXxf86vm-1.1.4_3
===>>> libatomic_ops-7.6.10
===>>> libpciaccess-0.16
===>>> libtool-2.4.6_1
===>>> llvm10-10.0.1_5
===>>> llvm80-8.0.1_4
===>>> mariadb104-server-10.4.19
===>>> mc-nox11-4.8.26
===>>> meson-0.57.1_1
===>>> mod_php74-7.4.19
===>>> mpfr-4.1.0
===>>> open-vm-tools-11.2.5,2
===>>> php74-composer-1.10.21
===>>> php74-extensions-1.0
===>>> php74-fileinfo-7.4.19
===>>> php74-imap-7.4.19
===>>> php74-pecl-APCu-5.1.20
===>>> php74-pecl-mailparse-3.1.1
===>>> php74-sodium-7.4.19
===>>> postfix-3.6.0,1
===>>> pure-ftpd-1.0.49_1
===>>> py38-asn1crypto-1.4.0
===>>> py38-certbot-1.15.0,1
===>>> py38-cython-0.29.21_1
===>>> py38-mako-1.0.14_1
===>>> py38-mock-3.0.5
===>>> py38-repoze.sphinx.autointerface-0.8
===>>> py38-sphinx-3.5.2,1
===>>> py38-sphinx_rtd_theme-0.4.3
===>>> scons-py37-3.1.2_1
===>>> swig-4.0.2
===>>> texinfo-6.7_5,1
===>>> xcb-proto-1.14.1
===>>> xmlto-0.0.28
===>>> 56 leaf ports


===>>> 281 total installed ports
        ===>>> There are no new versions available
 
Take a look at pkg. Command pkg autoremove will remove packages which were installed as dependencies and are not required any more (installing a port produces an installed package). Build and config tools will be pulled in again if a port is updated.
 
Packages have dependencies so it's normal they are pulled in.
If you know what you are doing you can remove options of packages and rebuild, then less dependencies are pulled in.
 
I define an alias for pkg to show "reverse dependencies" (packages that depend on "x"):
reverse-depends 'query %rn-%rv'

That way if I see something in pkg prime-list that makes me go "huh" I can see what depends on it.

pkgs are easy if the default options work for you
ports are easy if you need to tweak every config option and have memory and cycles to rebuild after every upgrade.
pkgs and ports sometimes don't play together nicely.

As pkgs get updated/fixed, you may have old lingering dependencies, as Tieks points out pkg autoremove helps there.

Some packages have different "flavors" with different options so you may not need to rebuild a port. Example is "evince" (a PDF viewer). There is "evince" and "evince-lite": the -lite is without GNOME dependencies. There are probably others, this is just an easy example for me to use.
 
Thank you very much for your answers, much appreciated.

I have read about pkg now, and I think I'll move to pkg when moving from 12.x to 13.x.

Tieks I tested to run pkg autoremove and this is what I got :)

Code:
# pkg autoremove
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 110 packages:

Installed packages to be REMOVED:
        apache-ant: 1.10.8
        autoconf: 2.69_3
        autoconf-wrapper: 20131203
        automake: 1.16.3
        avahi-app: 0.8
        bash-completion: 2.11,2
        binutils: 2.33.1_4,1
        bison: 3.7.6,1
        boehm-gc: 8.0.4_1
        boost-jam: 1.72.0
        bootstrap-openjdk8: r450802_1
        cairo: 1.16.0_1,3
        check: 0.15.2
        cmake: 3.20.2
        cups: 2.3.3op2
        dbus: 1.12.20_4
        dbus-glib: 0.110
        docbook: 1.5
        docbook-sgml: 4.5_1
        docbook-xml: 5.0_3
        docbook-xsl: 1.79.1_1,1
        docbook-xsl-ns: 1.79.1
        getopt: 1.1.6
        gettext-tools: 0.21
        gmake: 4.3_2
        gmp: 6.2.1
        gnome_subr: 1.0
        gnutls: 3.6.15
        gobject-introspection: 1.66.1,1
        gperf: 3.1
        help2man: 1.48.3
        intltool: 0.51.0_1
        iso8879: 1986_3
        itstool: 2.0.6
        jsoncpp: 1.9.4
        libXdamage: 1.1.5
        libXext: 1.3.4,1
        libXfixes: 5.0.3_2
        libXrandr: 1.5.2
        libXrender: 0.9.10_2
        libXxf86vm: 1.1.4_3
        libarchive: 3.5.1,1
        libatomic_ops: 7.6.10
        libdaemon: 0.14_1
        libevent: 2.1.12
        libidn2: 2.3.1
        libltdl: 2.4.6
        libpaper: 1.1.24.4
        libpciaccess: 0.16
        libtasn1: 4.17.0
        libtextstyle: 0.21
        libtool: 2.4.6_1
        libunistring: 0.9.10_1
        libuv: 1.41.0
        libxshmfence: 1.3
        llvm10: 10.0.1_5
        llvm80: 8.0.1_4
        lua52: 5.2.4
        lzo2: 2.10_1
        m4: 1.4.18_1,1
        meson: 0.57.1_1
        mpfr: 4.1.0
        nasm: 2.15.05,1
        nettle: 3.7.2_2
        ninja: 1.10.2,2
        p11-kit: 0.23.22_1
        p5-Locale-gettext: 1.07
        p5-Locale-libintl: 1.32
        p5-Text-Unidecode: 1.30
        p5-Unicode-EastAsianWidth: 12.0
        p5-XML-Parser: 2.44
        pciids: 20210426
        pixman: 0.40.0_1
        pkgconf: 1.7.4,1
        py38-alabaster: 0.7.12
        py38-cython: 0.29.21_1
        py38-docutils: 0.17.1
        py38-imagesize: 1.2.0
        py38-packaging: 20.9
        py38-pygments: 2.7.2
        py38-pyparsing: 2.4.7
        py38-pystemmer: 2.0.0.1
        py38-repoze.sphinx.autointerface: 0.8
        py38-snowballstemmer: 2.1.0
        py38-sphinx: 3.5.2,1
        py38-sphinx_rtd_theme: 0.4.3
        py38-sphinxcontrib-applehelp: 1.0.2
        py38-sphinxcontrib-devhelp: 1.0.2
        py38-sphinxcontrib-htmlhelp: 1.0.3
        py38-sphinxcontrib-jsmath: 1.0.1
        py38-sphinxcontrib-qthelp: 1.0.3
        py38-sphinxcontrib-serializinghtml: 1.1.4
        re2c: 0.14.3
        rhash: 1.4.1
        scons-py37: 3.1.2_1
        sdocbook-xml: 1.1_2,2
        swig: 4.0.2
        tcl86: 8.6.11_1
        texinfo: 6.7_5,1
        tpm-emulator: 0.7.4_2
        trousers: 0.3.14_3
        w3m: 0.5.3.20210424
        wayland-protocols: 1.21
        xcb-proto: 1.14.1
        xmlcatmgr: 2.2_2
        xmlcharent: 0.3_2
        xmlto: 0.0.28
        xorg-macros: 1.19.3
        xtrans: 1.4.0
        zip: 3.0_1

Number of packages to be removed: 110
The operation will free 2 GiB.
Proceed with deinstalling packages? [y/N]:
 
Packages have dependencies so it's normal they are pulled in.
If you know what you are doing you can remove options of packages and rebuild, then less dependencies are pulled in.

I always check if there are options I can remove, like IPv6 support that I know I don't use.
But mostly I'll leave it with the default pre selected options.
 
I have never used pkg, only cvsup and portmaster.
Is pkg a better choice, as we don't make any changes in the code anyway?
If the default options suit your needs then you are better off using pkg to install and update binary packages. This is much faster than building from ports and avoids the need to install lots of build dependencies.
 
It is. Command pkg autoremove will show you the list of packages that will be deleted if you choose Y to proceed. Choice N is default. You will see many build and config tools after a fresh install.
 
I using amd64 FreeBSD 12.2-RELEASE-p6, have everything installed from ports using portmaster and usually go with the defaults unless it's something like IPv6 or something known I don't need.

I show 529 packages installed and if I run the command get 120 that would be removed at 2GB space freed up:

Code:
root@bakemono:/ # pkg autoremove
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 120 packages:

Installed packages to be REMOVED:
    autoconf: 2.69_3
    autoconf-wrapper: 20131203
    autoconf213: 2.13.000227_7
    automake: 1.16.3
    bash-completion: 2.11,2
    bdftopcf: 1.1_2
    binutils: 2.33.1_4,1
    bison: 3.7.5,1
    brotli: 1.0.9,1
    c-ares: 1.17.1
    celt: 0.11.3_3
    cmake: 3.19.6
    cppunit: 1.14.0_9
    db5: 5.3.28_7
    docbook: 1.5
    docbook-sgml: 4.5_1
    docbook-xml: 5.0_3
    docbook-xsl: 1.79.1_1,1
    docbook-xsl-ns: 1.79.1
    enscript-a4: 1.6.6_3
    flex: 2.6.4_2
    font-util: 1.3.2
    frei0r: 1.7.0.18
    gettext-tools: 0.21
    gmake: 4.3_2
    gperf: 3.1
    groff: 1.22.4_3
    gsed: 4.8
    gsfonts: 8.11_8
    gtk-doc: 1.33.2
    help2man: 1.48.1
    html2text: 1.3.2a,1
    intltool: 0.51.0_1
    iso8879: 1986_3
    itstool: 2.0.6
    jackit: 0.125.0_12
    jam: 2.6
    jsoncpp: 1.9.4
    libarchive: 3.5.1,1
    libtextstyle: 0.21
    libtool: 2.4.6_1
    libuv: 1.41.0
    llvm11: 11.0.1
    luit: 20190106_1
    m4: 1.4.18_1,1
    meson: 0.57.1
    minixmlto: 0.0.3
    mpfr: 4.1.0
    nasm: 2.15.05,1
    netsurf-buildsystem: 1.9
    ninja: 1.10.2,2
    node: 15.14.0_1
    opencl: 3.0
    p5-Encode-HanExtra: 0.23_1
    p5-Encode-JIS2K: 0.03
    p5-Locale-gettext: 1.07
    p5-Locale-libintl: 1.32
    p5-Text-Unidecode: 1.30
    p5-Unicode-EastAsianWidth: 12.0
    p5-XML-Parser: 2.44
    pkgconf: 1.7.4,1
    psutils: 1.17_5
    py37-Babel: 2.9.0
    py37-CommonMark: 0.9.1
    py37-Jinja2: 2.11.2_1
    py37-alabaster: 0.7.6
    py37-beaker: 1.11.0
    py37-certifi: 2020.12.5
    py37-cffi: 1.14.5
    py37-chardet: 3.0.4_3,1
    py37-cryptography: 3.3.2
    py37-cython: 0.29.21
    py37-docutils: 0.16
    py37-future: 0.18.2
    py37-idna: 2.10
    py37-imagesize: 1.1.0
    py37-libxml2: 2.9.10_3
    py37-mako: 1.0.14_1
    py37-markupsafe: 1.1.1_1
    py37-openssl: 20.0.1
    py37-packaging: 20.9
    py37-pycparser: 2.20
    py37-pygments: 2.7.2
    py37-pyparsing: 2.4.7
    py37-pysocks: 1.7.1
    py37-pystemmer: 2.0.0.1
    py37-pytz: 2020.5,1
    py37-recommonmark: 0.5.0_2
    py37-requests: 2.22.0_2
    py37-snowballstemmer: 1.2.1
    py37-sphinx: 3.5.2,1
    py37-sphinxcontrib-applehelp: 1.0.2
    py37-sphinxcontrib-devhelp: 1.0.2
    py37-sphinxcontrib-htmlhelp: 1.0.3
    py37-sphinxcontrib-jsmath: 1.0.1
    py37-sphinxcontrib-qthelp: 1.0.3
    py37-sphinxcontrib-serializinghtml: 1.1.4
    py37-sqlite3: 3.7.10_7
    py37-urllib3: 1.25.11,1
    qt5-buildtools: 5.15.2_1
    qt5-qmake: 5.15.2
    rhash: 1.4.1
    rust: 1.51.0
    rust-cbindgen: 0.19.0
    sdocbook-xml: 1.1_2,2
    sndio: 1.7.0
    swig: 4.0.2
    texi2html: 5.0_2,1
    texinfo: 6.7_4,1
    uchardet: 0.0.7
    v4l_compat: 1.20.0
    vala: 0.48.10,1
    xcb-proto: 1.14.1
    xmlcatmgr: 2.2_2
    xmlcharent: 0.3_2
    xorg-macros: 1.19.2
    yasm: 1.3.0
    yelp-tools: 3.38.0
    yelp-xsl: 3.38.3
    zip: 3.0_1

Number of packages to be removed: 120

The operation will free 2 GiB.

Proceed with deinstalling packages? [y/N]: n
root@bakemono:/ #

But I'm using a laptop as a general purpose desktop and you're running a server.
 
Well if nothing else I don't want the zip application to be removed. That comes in handy on a desktop from time to time.

A couple days ago I had to delete all my old distfiles after I got a kernel warning I was over the alloted HDD space on disk by 3%. That still didn't take it down far enough to give me free space so I used security/wipe to delete all the .avi and .mp4 files from my Video directory at the login terminal to fix it.

Wipe being something I install with the start of every build but the first time it's really come in handy when I needed it and was already installed.
 
Code:
    ( pkg info -ra; echo : ) | awk -F: '/:$/ {if(p != "")
            {print p};p=$1}
            !/:$/ {p = ""}'

This lists the ports that are not required by any other. You can go thru that list and see if you actually need these.
 
Back
Top