Summary: | pkgbase: pkg autoremove is removing packages it shouldn't | ||
---|---|---|---|
Product: | Base System | Reporter: | Mina Galić <freebsd> |
Component: | misc | Assignee: | freebsd-pkgbase (Nobody) <pkgbase> |
Status: | Closed FIXED | ||
Severity: | Affects Some People | CC: | dfr, emaste, grahamperrin, manu, marklmi26-fbsd, pkgbase, rosenke |
Priority: | --- | Keywords: | needs-qa, pkgbase |
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
Mina Galić
2021-03-05 22:46:47 UTC
(In reply to Mina Galić from comment #0) I wonder if the pkg command for automremove should have been using -c to operate in a chroot context instead of using -r, -c making it more likely see a self consistent context? sudo pkg -c /isolates/pkg-auto-remove-bug/root autoremove For reference: -c ⟨chroot path⟩, --chroot ⟨chroot path⟩ pkg will chroot in the ⟨chroot path⟩ environment. (I had to look it up to notice the -c vs -r distinction.) that's a very good point! i should see if pkg -c or pkg -j make any other decisions I got the Same Problem in 12 Stable Revision 370727. After a basic Install of ca 77 packages pkg wants to remove 68 of them. [root@dsssrvt4j1 /usr/local/etc/rc.d]# pkg info -d FreeBSD-libarchive FreeBSD-libarchive-12.2.s20220105232846: [root@dsssrvt4j1 /usr/local/etc/rc.d]# pkg info -r FreeBSD-libarchive FreeBSD-libarchive-12.2.s20220105232846: My current workaroung when setting up jails is for port in $(jexec ${jailname} pkg autoremove -n | grep FreeBSD | xargs -n 1); do jexec ${jailname} pkg lock -y ${port} done I'm wondering if this is related to bug 265570. Somehow, the solver is deciding that these lib packages are not needed - in the linked bug, I had problems with a rogue package in the regular ports repo which claims to provide most of the base libraries. Disabling the FreeBSD repo doesn't change the behaviour of autoremove so probably nothing to do with bug 265570 No, it's because the solver doesn't take into account the shlib_needed property of the manually installed packages. Since there is no strict dependencies between those packages, pkg decide to remove those who were not installed directly by the user. Looking at pkg issue list, this problem has been around for a long time. Should we add explicit dependencies in FreeBSD-base? That would help defend against bad packages like gnatcross-sysroot-aarch64 as well as fixing autoremove. (In reply to dfr from comment #7) No, both are pkg bugs that someone (tm) needs to fix. perhaps we should link the appropriate pkg bugs on GitHub here and vice versa. (In reply to Mark Millard from comment #1) I forgot to report back test results -c / -r / -j seem to make no difference on the host system, autoremove suggested I remove Kerberos, i obliged, because i don't use Kerberos, only to be reminded five minutes later that ssh links to it i have now worked around this issue by pkg-set(8)ting affected packages as not automatic (-A 0). This was easy for the host system, where my fetch and Kerberos were affected, but it's a lot of packages in jails, and that mystifies me. Which packages on the host make it so that a majority of PkgBase packages are marked as actually needed? fixed with pkg 1.19.0 |