Bug 220049 - ports-mgmt/pkg installs unneeded packages
Summary: ports-mgmt/pkg installs unneeded packages
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-pkg (Nobody)
Keywords: needs-qa
: 228389 (view as bug list)
Depends on:
Reported: 2017-06-16 15:35 UTC by Miroslav Lachman
Modified: 2020-10-11 05:28 UTC (History)
7 users (show)

See Also:
bugzilla: maintainer-feedback? (pkg)
koobs: merge-quarterly?


Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Lachman 2017-06-16 15:35:57 UTC
Sometimes (very often in my case with about 20 machines) "pkg install" or "pkg upgrade" installed some packages which were not needed and running "pkg autoremove" imediately after previsou upgrade / install command just uninstall those packages.

This is simple example from today. I just need to install "pgtop", along with dependencies "libnghttp2" were also installed:

root@fido ~/# pkg install pgtop
Updating codelab repository catalogue...
Fetching meta.txz: 100%    820 B   0.8kB/s    00:01
Fetching packagesite.txz: 100%  136 KiB 139.5kB/s    00:01
Processing entries: 100%
codelab repository update completed. 470 packages processed.
Updating e2efa repository catalogue...
Fetching meta.txz: 100%    820 B   0.8kB/s    00:01
Fetching packagesite.txz: 100%   37 KiB  37.6kB/s    00:01
Processing entries: 100%
e2efa repository update completed. 114 packages processed.
All repositories are up to date.
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        pgtop: 0.05_3 [e2efa]
        libnghttp2: 1.22.0 [codelab]
        p5-DBI: 1.636_1 [e2efa]
        p5-DBD-Pg: 3.6.2 [e2efa]

Number of packages to be installed: 4

The process will require 3 MiB more space.
977 KiB to be downloaded.

Proceed with this action? [y/N]: y
[1/4] Fetching pgtop-0.05_3.txz: 100%   24 KiB  24.9kB/s    00:01
[2/4] Fetching libnghttp2-1.22.0.txz: 100%  105 KiB 107.1kB/s    00:01
[3/4] Fetching p5-DBI-1.636_1.txz: 100%  685 KiB 701.6kB/s    00:01
[4/4] Fetching p5-DBD-Pg-3.6.2.txz: 100%  163 KiB 166.6kB/s    00:01
Checking integrity... done (0 conflicting)
[1/4] Installing p5-DBI-1.636_1...
[1/4] Extracting p5-DBI-1.636_1: 100%
[2/4] Installing p5-DBD-Pg-3.6.2...
[2/4] Extracting p5-DBD-Pg-3.6.2: 100%
[3/4] Installing pgtop-0.05_3...
[3/4] Extracting pgtop-0.05_3: 100%
[4/4] Installing libnghttp2-1.22.0...
Extracting libnghttp2-1.22.0: 100%

But nobody needs "libnghttpd2"

root@fido ~/# pkg info -r -d libnghttp2

root@fido ~/# pkg autoremove
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages:

Installed packages to be REMOVED:

Number of packages to be removed: 1

Proceed with deinstalling packages? [y/N]: y
[1/1] Deinstalling libnghttp2-1.22.0...
[1/1] Deleting files for libnghttp2-1.22.0: 100%

Similar issue was encountered on last "pkg upgrade" on almost all our machines where "libarchive" was installed and immediately deleted by "pkg autoremove".

We are using own Poudriere repo, FreeBSD 10.3, pkg 1.10.1

Let me know how can I debug this issue and I will provide more details.
Comment 1 Bryan Drewery freebsd_committer 2017-06-17 22:59:56 UTC
This is likely an old issue with tracking shared library dependencies.
Comment 2 Miroslav Lachman 2017-06-20 14:31:33 UTC
(In reply to Bryan Drewery from comment #1)
A found referenced bug before I filed this PR because I thought it was already fixed and this is new one. 
Is this old issue?
Comment 3 Miroslav Lachman 2017-06-30 10:13:26 UTC
Is there something I can fix / workaround in local pkg database? It is really annoying to run pkg autoremove after each pkg install or pkg upgrade.

It always want to install libarchive and some other libs.

# pkg install pear-Net_DNS2
Updating codelab repository catalogue...
codelab repository is up to date.
All repositories are up to date.
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        pear-Net_DNS2: 1.4.3
        libarchive: 3.3.1,1
        lzo2: 2.10_1

Number of packages to be installed: 3
Comment 4 Zsolt Udvari 2018-07-07 14:48:54 UTC
*** Bug 228389 has been marked as a duplicate of this bug. ***
Comment 5 Daniel Engberg 2020-03-20 08:02:03 UTC
Still an issue?
Comment 6 Miroslav Lachman 2020-03-20 08:47:39 UTC
(In reply to daniel.engberg.lists from comment #5)
I cannot say if it was the same issue or just a similar one but the last month I installed "some package" on bunch of our servers, it pulled "another package" as dependency and then "pkg autoremove" deleted this dependency.
Unfortunately I don't remember the exact package names.

If you want to close this issue then close it and I will reopen it if I see this again.
Comment 7 Derek Schrock 2020-10-11 05:28:07 UTC
Since I moved to using both FreeBSD 12amd64 latest repo and my own internal repo I'm seeing a lot of this with almost every pkg-install or pkg-upgrade.  pkg is installing gcc9 (and deps) to only have pkg-autoremove remove them.

My current test case is:

1) Use FreeBSD 12amd64 latest repo
2) Create a local repo via 'poudriere bulk -j 12amd64 lang/gcc9'
3) Configure pkg to use both repos
4) 'pkg install py27-sqlite3'

This should try to install gcc9.