# the usual not logical behaviour of pkg autoremove



## piggy (Jan 30, 2019)

Like in the subject. It never been coherent to me.

On a brand new 64 bit box I just built using port and working perfectly fine I do have this situazione:


```
$ sudo pkg check -d
Password:
Checking all packages: 100%
$
```

Then if I run autoremove to clean some bit up, it propose to delete even fundamental files and part of the developer environment (Automake, autoconf, binutils...)


```
$ sudo pkg autoremove
Password:
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 128 packages:

Installed packages to be REMOVED:
        qt5-uiplugin-5.12.0_1
        qt5-designer-5.12.0_1
        qt5-uitools-5.12.0_2
        asciidoc-8.6.10_1
        automake-1.16.1_1
        autoconf-2.69_2
        autoconf213-2.13.000227_7
        autoconf-wrapper-20131203
        ghostscript9-agpl-base-9.26
        groff-1.22.4
        bash-5.0.2
        bdftopcf-1.1_2
        binutils-2.31.1_1,1
        bison-3.2.2,1
        boost-jam-1.69.0
        node-11.7.0_1
        c-ares-1.14.0_2
        py27-sphinx-1.6.5_1,1
        curl-7.63.0_1
        cmake-3.13.3
        check-0.12.0_1
        docbook-xsl-1.79.1_1,1
        minixmlto-0.0.2_1
        docbook-1.5
        docbook-sgml-4.5_1
        docbook-xml-5.0_3
        eigen-3.3.7
        evdev-proto-4.19
        flock-2.30.1
        frei0r-1.6.1
        imake-1.0.7_2,1
        gccmakedep-1.0.3
        gettext-tools-0.19.8.1_1
        gmake-4.2.1_3
        gmp-api-39
        gperf-3.0.3_2
        vala-0.40.11,1
        graphviz-2.40.1_7
        gsfonts-8.11_8
        help2man-1.47.8_1
        html2text-1.3.2a
        intltool-0.51.0_1
        iso8879-1986_3
        itstool-2.0.2_2
        jam-2.6
        jbig2dec-0.15
        lua52-5.2.4
        swig30-3.0.12
        xcb-proto-1.13
        py27-MarkupSafe-1.0
        py27-Jinja2-2.10
        py27-mako-1.0.7_1
        py27-pytz-2018.9,1
        py27-Babel-2.6.0
        py27-pygments-2.3.0
        py27-docutils-0.14_3
        py27-six-1.12.0
        py27-cryptography-2.3
        py27-openssl-18.0.0
        py27-urllib3-1.22,1
        py27-requests-2.21.0
        py27-html5lib-1.0.1
        py27-sphinxcontrib-websupport-1.1.0
        py27-sphinx_rtd_theme-0.4.2
        py27-alabaster-0.7.6
        py27-cython-0.29
        py27-pystemmer-1.3.0_2
        py27-snowballstemmer-1.2.0_1
        py27-setuptools_scm-1.17.0
        py27-pytest-runner-2.11.1
        py27-chardet-3.0.4
        py27-idna-2.7
        py27-pycparser-2.18
        py27-cffi-1.11.5
        py27-asn1crypto-0.22.0
        py27-enum34-1.1.6
        py27-ipaddress-1.0.22
        py27-pysocks-1.6.8
        py27-certifi-2018.11.29
        py27-imagesize-0.7.1
        py27-typing-3.6.4
        scons-3.0.1
        py27-funcsigs-1.0.2
        py27-beaker-1.10.0
        py27-libxml2-2.9.8_1
        libgd-2.2.5_1,1
        p5-Locale-libintl-1.31
        texinfo-6.5_4,1
        libidn-1.34_1
        libnghttp2-1.36.0
        libtool-2.4.6_1
        libuv-1.25.0
        ruby-2.4.5_1,1
        libyaml-0.2.1
        lxqt-build-tools-0.5.0_1
        m4-1.4.18_1,1
        makedepend-1.0.5_2,1
        meson-0.49.0
        mpfr-4.0.1_2
        nasm-2.14.02,1
        ninja-1.8.2_1,2
        opencl-2.2_1
        p5-Locale-gettext-1.07
        p5-Parse-Yapp-1.05_2
        p5-Text-Unidecode-1.30
        p5-Unicode-EastAsianWidth-1.40
        p5-XML-Parser-2.44
        qt5-buildtools-5.12.0_2
        pkgconf-1.6.0,1
        protobuf-3.6.1_1,1
        psutils-1.17_5
        py27-webencodings-0.5.1
        qt5-linguist-5.12.0_2
        qt5-assistant-5.12.0_2
        qt5-help-5.12.0_2
        qt5-qmake-5.12.0_2
        rhash-1.3.5
        sdocbook-xml-1.1_2,2
        texi2html-5.0_2,1
        tradcpp-0.5.3
        usbids-20181204
        v4l_compat-1.6.3_3
        xf86-video-scfb-0.0.4_7
        xmlcharent-0.3_2
        xorg-cf-files-1.0.6
        xorg-macros-1.19.2
        yasm-1.3.0
        zip-3.0_1

Number of packages to be removed: 128

The operation will free 662 MiB.

Proceed with deinstalling packages? [y/N]: n
```

The system was carefully built using ports, it is quietly basic (some development tools needed, Lumina as desktop, various needed network and file sharing tools, X environment and accellerating graphics tools like Mesa). It is curious to see, in this case, `pkg autoremove` is incoherent even related with the check function, like I show above.

I do use and built Linux Gentoo machines as much as FreeBSD machines (my two fav OS), then the equivalent deepclean function is usually better tailored in my experience. And I don't understand why Autoremove on FreeBSDS act like this. Like this, is useless.


----------



## SirDice (Jan 30, 2019)

piggy said:


> Then if I run autoremove to clean some bit up, it propose to delete even fundamental files and part of the developer environment (Automake, autoconf, binutils...)


These are not part of the environment, they're mostly _build_ dependencies, not _run_ dependencies. Ergo, you don't need them for running software, only to build.

If any one of these is installed automatically but you want to prevent autoremove from removing it set them to non-automatic with `pkg set -A 0 <pkgname>`. See pkg-set(8).


----------



## piggy (Jan 30, 2019)

SirDice said:


> These are not part of the environment, they're mostly _build_ dependencies, not _run_ dependencies. Ergo, you don't need them for running software, only to build.
> 
> If any one of these is installed automatically but you want to prevent autoremove from removing it set them to non-automatic with `pkg set -A 0 <pkgname>`. See pkg-set(8).


Ok for those, and what about bash or curl? Curl is my ftp of choice, why should I remove it? And even if I do not use bash in this very moment, it could be usefull and I could like to have it on the ijnstalled base. Ok for pkg set, then I still think pkg autoremove could be tailored better.


----------



## SirDice (Jan 30, 2019)

piggy said:


> Ok for those, and what about bash or curl? Curl is my ftp of choice, why should I remove it?


Both were probably installed as a dependency of something you have since removed. So they are marked as "automatic" and because there's nothing depending on them any more pkg-autoremove(8) will remove them. That's when pkg-set(8) comes in handy.


----------

