# pkg: POST-DEINSTALL script failed



## matt_k (Sep 10, 2021)

Hello, I encountered this problem with qt5-testlib, which keeps on reinstalling and uninstalling itself whenever I run pkg update && pkg upgrade and pkg autoremove.

So, here is the output of `pkg clean -a && pkg -d install -f qt5-testlib && pkg remove qt5-testlib`


```
~> pls pkg clean -a
The following package files will be deleted:
        /var/cache/pkg/qt5-testlib-5.15.2_1~8682ca4f00.pkg
        /var/cache/pkg/qt5-testlib-5.15.2_1.pkg
The cleanup will free 160 KiB

Proceed with cleaning the cache? [y/N]: Y
Deleting files: 100%
All done
~> pls pkg -d install -f qt5-testlib

DBG(1)[99101]> pkg initialized
Updating FreeBSD repository catalogue...
DBG(1)[99101]> PkgRepo: verifying update for FreeBSD
DBG(1)[99101]> Pkgrepo, begin update of '/var/db/pkg/repo-FreeBSD.sqlite'
DBG(1)[99101]> Request to fetch pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/latest/meta.conf
DBG(1)[99101]> opening libfetch fetcher
DBG(1)[99101]> Fetch > libfetch: connecting
DBG(1)[99101]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/latest/meta.conf with opts "i"
DBG(1)[99101]> Request to fetch pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/latest/packagesite.pkg
DBG(1)[99101]> opening libfetch fetcher
DBG(1)[99101]> Fetch > libfetch: connecting
DBG(1)[99101]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/latest/packagesite.pkg with opts "i"
DBG(1)[99101]> Request to fetch pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/latest/packagesite.txz
DBG(1)[99101]> opening libfetch fetcher
DBG(1)[99101]> Fetch > libfetch: connecting
DBG(1)[99101]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/latest/packagesite.txz with opts "i"
FreeBSD repository is up to date.
All repositories are up to date.
DBG(1)[99101]> want to get an advisory lock on a database
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        qt5-testlib: 5.15.2_1

Number of packages to be installed: 1

160 KiB to be downloaded.

Proceed with this action? [y/N]: Y
DBG(1)[99101]> Request to fetch pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/latest/All/qt5-testlib-5.15.2_1.pkg
DBG(1)[99101]> opening libfetch fetcher
DBG(1)[99101]> Fetch > libfetch: connecting
DBG(1)[99101]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/latest/All/qt5-testlib-5.15.2_1.pkg with opts "i"
DBG(1)[99101]> Fetch: fetcher chosen: http
[1/1] Fetching qt5-testlib-5.15.2_1.pkg: 100%  160 KiB 163.9kB/s    00:01   
Checking integrity...DBG(1)[99101]> Binary> loading /var/cache/pkg/qt5-testlib-5.15.2_1~8682ca4f00.pkg
DBG(1)[99101]> check integrity for 1 items added
 done (0 conflicting)
DBG(1)[99101]> want to upgrade advisory to exclusive lock
[1/1] Installing qt5-testlib-5.15.2_1...
[1/1] Extracting qt5-testlib-5.15.2_1: 100%
DBG(1)[99101]> release an exclusive lock on a database
DBG(1)[99101]> release an advisory lock on a database
~> pkg info -l qt5-testlib
qt5-testlib-5.15.2_1:
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/callgrind_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/cycle_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/linux_perf_event_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qabstracttestlogger_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qappletestlogger_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qbenchmark_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qbenchmarkevent_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qbenchmarkmeasurement_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qbenchmarkmetric_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qbenchmarkperfevents_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qbenchmarktimemeasurers_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qbenchmarkvalgrind_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qcsvbenchmarklogger_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qjunittestlogger_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qplaintestlogger_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qsignaldumper_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtaptestlogger_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qteamcitylogger_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtestblacklist_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtestcoreelement_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtestcorelist_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtestelement_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtestelementattribute_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtesthelpers_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtestjunitstreamer_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtestlog_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtestresult_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtesttable_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qtestutil_macos_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qttestlib-config_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qxctestlogger_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/qxmltestlogger_p.h
        /usr/local/include/qt5/QtTest/5.15.2/QtTest/private/valgrind_p.h
        /usr/local/include/qt5/QtTest/QAbstractItemModelTester
        /usr/local/include/qt5/QtTest/QEventSizeOfChecker
        /usr/local/include/qt5/QtTest/QSignalSpy
        /usr/local/include/qt5/QtTest/QSpontaneKeyEvent
        /usr/local/include/qt5/QtTest/QTest
        /usr/local/include/qt5/QtTest/QTestAccessibility
        /usr/local/include/qt5/QtTest/QTestData
        /usr/local/include/qt5/QtTest/QTestDelayEvent
        /usr/local/include/qt5/QtTest/QTestEvent
        /usr/local/include/qt5/QtTest/QTestEventList
        /usr/local/include/qt5/QtTest/QTestEventLoop
        /usr/local/include/qt5/QtTest/QTestKeyClicksEvent
        /usr/local/include/qt5/QtTest/QTestKeyEvent
        /usr/local/include/qt5/QtTest/QTestMouseEvent
        /usr/local/include/qt5/QtTest/QtCoverageScanner
        /usr/local/include/qt5/QtTest/QtTest
        /usr/local/include/qt5/QtTest/QtTestDepends
        /usr/local/include/qt5/QtTest/QtTestGui
        /usr/local/include/qt5/QtTest/QtTestNetwork
        /usr/local/include/qt5/QtTest/QtTestVersion
        /usr/local/include/qt5/QtTest/QtTestWidgets
        /usr/local/include/qt5/QtTest/qabstractitemmodeltester.h
        /usr/local/include/qt5/QtTest/qbenchmark.h
        /usr/local/include/qt5/QtTest/qbenchmarkmetric.h
        /usr/local/include/qt5/QtTest/qsignalspy.h
        /usr/local/include/qt5/QtTest/qtest.h
        /usr/local/include/qt5/QtTest/qtest_global.h
        /usr/local/include/qt5/QtTest/qtest_gui.h
        /usr/local/include/qt5/QtTest/qtest_network.h
        /usr/local/include/qt5/QtTest/qtest_widgets.h
        /usr/local/include/qt5/QtTest/qtestaccessible.h
        /usr/local/include/qt5/QtTest/qtestassert.h
        /usr/local/include/qt5/QtTest/qtestcase.h
        /usr/local/include/qt5/QtTest/qtestdata.h
        /usr/local/include/qt5/QtTest/qtestevent.h
        /usr/local/include/qt5/QtTest/qtesteventloop.h
        /usr/local/include/qt5/QtTest/qtestkeyboard.h
        /usr/local/include/qt5/QtTest/qtestmouse.h
        /usr/local/include/qt5/QtTest/qtestspontaneevent.h
        /usr/local/include/qt5/QtTest/qtestsystem.h
        /usr/local/include/qt5/QtTest/qtesttouch.h
        /usr/local/include/qt5/QtTest/qttestglobal.h
        /usr/local/include/qt5/QtTest/qttestlib-config.h
        /usr/local/include/qt5/QtTest/qttestversion.h
        /usr/local/lib/cmake/Qt5Test/Qt5TestConfig.cmake
        /usr/local/lib/cmake/Qt5Test/Qt5TestConfigExtras.cmake
        /usr/local/lib/cmake/Qt5Test/Qt5TestConfigVersion.cmake
        /usr/local/lib/qt5/libQt5Test.prl
        /usr/local/lib/qt5/libQt5Test.so
        /usr/local/lib/qt5/libQt5Test.so.5
        /usr/local/lib/qt5/libQt5Test.so.5.15
        /usr/local/lib/qt5/libQt5Test.so.5.15.2
        /usr/local/lib/qt5/mkspecs/modules/qt_lib_testlib.pri
        /usr/local/lib/qt5/mkspecs/modules/qt_lib_testlib_private.pri
        /usr/local/libdata/pkgconfig/Qt5Test.pc
        /usr/local/share/licenses/qt5-testlib-5.15.2_1/LGPL21
        /usr/local/share/licenses/qt5-testlib-5.15.2_1/LICENSE
        /usr/local/share/licenses/qt5-testlib-5.15.2_1/catalog.mk
~> pls pkg remove qt5-testlib
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
        qt5-testlib: 5.15.2_1

Number of packages to be removed: 1

Proceed with deinstalling packages? [y/N]: y
[1/1] Deinstalling qt5-testlib-5.15.2_1...
[1/1] Deleting files for qt5-testlib-5.15.2_1: 100%
pkg: POST-DEINSTALL script failed
~>
```

So, what should I try next? I don't care about this package, it got in as a dependency, but whenever I run `pkg upgrade`, it wants to get in again:

```
New packages to be INSTALLED:
        openldap24-client: 2.4.59_2
        qt5-testlib: 5.15.2_1
```


----------



## zirias@ (Sep 10, 2021)

Not sure whether there's already a PR, but this topic was discussed on #bsdports (EFNet). `pkg autoremove` will remove the package again (it _should_ only be a build dependency), so there's definitely one or two things fishy with this pkg currently…

(in short: the problem is not at your end)


----------



## scottro (Sep 10, 2021)

I think there is a PR, at some point I did search and find one--I think.  My memory is hazy though. Patch coming? Maybe? 



			https://srobb.net/info.mp4


----------



## grahamperrin@ (Sep 18, 2021)

matt_k said:


> I don't care about this package,



Is its presence troublesome?



matt_k said:


> it got in as a dependency,



If the dependency is proper, then `pkg upgrade` will properly install the package. 

You can create then register a fake manifest, as outlined at and under <https://forums.FreeBSD.org/threads/80412/post-528187> *however* I can not guess the mid-/long-term impact of doing so for devel/qt5-testlib.


----------



## matt_k (Sep 20, 2021)

grahamperrin said:


> Is its presence troublesome?


It is not, I don't care about a few kbytes on my drive.



grahamperrin said:


> If the dependency is proper, then `pkg upgrade` will properly install the package.


Yes, it will, but it will get removed again whenever I issue `pkg autoremove` with _POST-DEINSTALL script failed._
It will get installed again whenever I issue `pkg upgrade`.
Pkg will install/uninstall the package ad absurdum.

For the time being, I locked the package, so `pkg autoremove` won't remove it.



grahamperrin said:


> You can create then register a fake manifest, as outlined at and under <https://forums.FreeBSD.org/threads/80412/post-528187> *however* I can not guess the mid-/long-term impact of doing so for devel/qt5-testlib.


Thanks, I'll look into it.


----------

