# pkg: POST-INSTALL script failed



## FlorinMarian (Jul 21, 2021)

Hi, guys!
I try to install with pkg some apps and all of them fails with this message:

```
/bin/sh: indexinfo: not found
pkg: POST-INSTALL script failed
```
Same error on all FreeBSD versions 32/64bits: 11, 12, 13.
Any idea?
Thank you!


----------



## SirDice (Jul 21, 2021)

That's not the whole error message. Was there something like `user 'blahblah' disappeared during update` ? Then your password databases got out of sync, it happens sometimes. Just run `vipw` and save and quit (without making any changes). Then run the pkg-install(8) again.


----------



## SirDice (Jul 21, 2021)

FlorinMarian said:


> ```
> /bin/sh: indexinfo: not found
> ```


You seem to be missing print/indexinfo. Are your packages up to date? When was the last time you ran `pkg upgrade`?


----------



## FlorinMarian (Jul 21, 2021)

SirDice said:


> You seem to be missing print/indexinfo. Are your packages up to date? When was the last time you ran `pkg upgrade`?


Thank you for help.
All images 11.4, 12.2 and 13.0 are downloaded few minutes ago and all of them have same issue.
I've used "vipw" command and got output "vipw: password list updated" but error persist, nothing changed.

Preview: 



Thank you!


----------



## T-Daemon (Jul 21, 2021)

There is a similar problem with ports-mgmt/pkg and `indexinfo not found` in PR





						226373 – ports-mgmt/pkg: POST-DEINSTALL script failed:  indexinfo not found
					






					bugs.freebsd.org
				




PR 'Status' is marked  "Closed Works As Intended".


----------



## SirDice (Jul 21, 2021)

Try reinstalling `pkg install -f indexinfo`, something might have gone wrong. 

Squicky clean system shows no issues:

```
root@fbsd-test:~ # uname -a
FreeBSD fbsd-test.dicelan.home 13.0-RELEASE-p3 FreeBSD 13.0-RELEASE-p3 #0: Tue Jun 29 19:46:20 UTC 2021     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
root@fbsd-test:~ # pkg -v
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.16.3...
Extracting pkg-1.16.3: 100%
1.16.3
root@fbsd-test:~ # pkg install sudo
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Updating database digests format: 100%
The following 3 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        gettext-runtime: 0.21 [FreeBSD]
        indexinfo: 0.3.1 [FreeBSD]
        sudo: 1.9.7p1 [FreeBSD]

Number of packages to be installed: 3

The process will require 7 MiB more space.
2 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/3] Fetching sudo-1.9.7p1.txz: 100%    1 MiB   1.4MB/s    00:01
[2/3] Fetching gettext-runtime-0.21.txz: 100%  166 KiB 169.9kB/s    00:01
[3/3] Fetching indexinfo-0.3.1.txz: 100%    6 KiB   5.7kB/s    00:01
Checking integrity... done (0 conflicting)
[1/3] Installing indexinfo-0.3.1...
[1/3] Extracting indexinfo-0.3.1: 100%
[2/3] Installing gettext-runtime-0.21...
[2/3] Extracting gettext-runtime-0.21: 100%
[3/3] Installing sudo-1.9.7p1...
[3/3] Extracting sudo-1.9.7p1: 100%
root@fbsd-test:~ # pkg install python38
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 4 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        libffi: 3.3_1 [FreeBSD]
        mpdecimal: 2.5.1 [FreeBSD]
        python38: 3.8.10 [FreeBSD]
        readline: 8.1.1 [FreeBSD]

Number of packages to be installed: 4

The process will require 120 MiB more space.
18 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/4] Fetching python38-3.8.10.txz: 100%   17 MiB   6.0MB/s    00:03
[2/4] Fetching mpdecimal-2.5.1.txz: 100%  322 KiB 329.5kB/s    00:01
[3/4] Fetching readline-8.1.1.txz: 100%  361 KiB 369.2kB/s    00:01
[4/4] Fetching libffi-3.3_1.txz: 100%   39 KiB  40.1kB/s    00:01
Checking integrity... done (0 conflicting)
[1/4] Installing mpdecimal-2.5.1...
[1/4] Extracting mpdecimal-2.5.1: 100%
[2/4] Installing readline-8.1.1...
[2/4] Extracting readline-8.1.1: 100%
[3/4] Installing libffi-3.3_1...
[3/4] Extracting libffi-3.3_1: 100%
[4/4] Installing python38-3.8.10...
[4/4] Extracting python38-3.8.10: 100%
=====
Message from python38-3.8.10:

--
Note that some standard Python modules are provided as separate ports
as they require additional dependencies. They are available as:

py38-gdbm       databases/py-gdbm@py38
py38-sqlite3    databases/py-sqlite3@py38
py38-tkinter    x11-toolkits/py-tkinter@py38
```


----------



## covacat (Jul 21, 2021)

seems the problem is you don't have /usr/local/bin in PATH


----------



## FlorinMarian (Jul 21, 2021)

I applied command "pkg install indexinfo" and updated pkg catalog answering "y" but error persists.



Thank you!


----------



## FlorinMarian (Jul 21, 2021)

covacat said:


> seems the problem is you don't have /usr/local/bin in PATH


It may be because I select "GPT" as partition scheme, then delete all 3 partitions created automatically, I use all the space to / partition with label "freebsd" and /boot it's created automatically?
Thank you!


----------



## SirDice (Jul 21, 2021)

Please copy/paste the text only instead of posting a picture of text. 



FlorinMarian said:


> It may be because I select "GPT" as partition scheme, then delete all 3 partitions created automatically, I use all the space to / partition with label "freebsd" and /boot it's created automatically?


Irrelevant.


----------



## covacat (Jul 21, 2021)

```
[root@uk /usr/home/user]# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/user/bin
[root@uk /usr/home/user]# PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
[root@uk /usr/home/user]# pkg delete gmake
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:
        gmake: 4.3_2

Number of packages to be removed: 1

The operation will free 2 MiB.

Proceed with deinstalling packages? [y/N]: y
[1/1] Deinstalling gmake-4.3_2...
[1/1] Deleting files for gmake-4.3_2: 100%
/bin/sh: indexinfo: not found
/bin/sh: indexinfo: not found
/bin/sh: indexinfo: not found
pkg: POST-DEINSTALL script failed
```


----------



## SirDice (Jul 21, 2021)

What does `which indexinfo` show?

```
root@fbsd-test:~ # which indexinfo
/usr/local/bin/indexinfo
```


----------



## FlorinMarian (Jul 21, 2021)

SirDice said:


> What does `which indexinfo` show?
> 
> ```
> root@fbsd-test:~ # which indexinfo
> ...




```
root@www:~ # which indexinfo
indexinfo: Command not found.
root@www:~ #
```


----------



## SirDice (Jul 21, 2021)

And does `echo $PATH` show /usr/local/bin?


----------



## FlorinMarian (Jul 21, 2021)

SirDice said:


> And does `echo $PATH` show /usr/local/bin?




```
root@www:~ # echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
root@www:~ #
```


----------



## SirDice (Jul 21, 2021)

We'll just keep poking until we get there. `ls -al /usr/local/bin/indexinfo`?

```
root@fbsd-test:~ # ls -al /usr/local/bin/indexinfo
-rwxr-xr-x  1 root  wheel  11176 Jul  1 03:05 /usr/local/bin/indexinfo
```


```
root@fbsd-test:~ # ldd /usr/local/bin/indexinfo
/usr/local/bin/indexinfo:
        libz.so.6 => /lib/libz.so.6 (0x800247000)
        libc.so.7 => /lib/libc.so.7 (0x800263000)
```


----------



## FlorinMarian (Jul 21, 2021)

```
root@www:~ # ls -al /usr/local/bin/indexinfo
ls: /usr/local/bin/indexinfo: No such file or directory
root@www:~ # ldd /usr/local/bin/indexinfo
ldd: /usr/local/bin/indexinfo: No such file or directory
root@www:~ #
```


----------



## SirDice (Jul 21, 2021)

Ok, so somehow print/indexinfo doesn't install anything in your case. Because in a previous post you mentioned you did `pkg install indexinfo`. 

Maybe the cached version is a little wonky, lets clear the package cache: `pkg clean -a`
Then run `pkg -d install -f indexinfo`


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

Installed packages to be REINSTALLED:
        indexinfo-0.3.1 [FreeBSD]

Number of packages to be reinstalled: 1

6 KiB to be downloaded.

Proceed with this action? [y/N]: y
DBG(1)[54828]> Request to fetch pkg+http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly/All/indexinfo-0.3.1.txz
DBG(1)[54828]> opening libfetch fetcher
DBG(1)[54828]> Fetch > libfetch: connecting
DBG(1)[54828]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/quarterly/All/indexinfo-0.3.1.txz with opts "i"
DBG(1)[54828]> Fetch: fetcher chosen: http
[1/1] Fetching indexinfo-0.3.1.txz: 100%    6 KiB   5.7kB/s    00:01
Checking integrity...DBG(1)[54828]> Binary> loading /var/cache/pkg/indexinfo-0.3.1~d4818e637c.txz
DBG(1)[54828]> check integrity for 1 items added
 done (0 conflicting)
DBG(1)[54828]> want to upgrade advisory to exclusive lock
[1/1] Reinstalling indexinfo-0.3.1...
[1/1] Extracting indexinfo-0.3.1: 100%
DBG(1)[54828]> Cleaning up old version
DBG(1)[54828]> release an exclusive lock on a database
DBG(1)[54828]> release an advisory lock on a database
```


----------



## FlorinMarian (Jul 21, 2021)

SirDice said:


> Ok, so somehow print/indexinfo doesn't install anything in your case. Because in a previous post you mentioned you did `pkg install indexinfo`.
> 
> Maybe the cached version is a little wonky, lets clear the package cache: `pkg clean -a`
> Then run `pkg -d install -f indexinfo`
> ...


The problems persists.
Please keep in mind i've downloaded all 6 images today and there's no cache.
Also please notice that i've installed manuall indexinfo but that didn't changed anything.

Best regards, Florin.


----------



## SirDice (Jul 21, 2021)

FlorinMarian said:


> Also please notice that i've installed manuall indexinfo but that didn't changed anything.


Please post the output from `pkg -d install -f indexinfo`. I need to see what is happening.


----------



## FlorinMarian (Jul 21, 2021)

SirDice said:


> Please post the output from `pkg -d install -f indexinfo`. I need to see what is happening.




```
root@www:~ # pkg -d install -f indexinfo
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:i386/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.16.3...
Extracting pkg-1.16.3: 100%
DBG(1)[713]> pkg initialized
Updating FreeBSD repository catalogue...
DBG(1)[713]> PkgRepo: verifying update for FreeBSD
DBG(1)[713]> PkgRepo: need forced update of FreeBSD
DBG(1)[713]> Pkgrepo, begin update of '/var/db/pkg/repo-FreeBSD.sqlite'
DBG(1)[713]> Request to fetch pkg+http://pkg.FreeBSD.org/FreeBSD:11:i386/quarterly/meta.conf
DBG(1)[713]> opening libfetch fetcher
DBG(1)[713]> Fetch > libfetch: connecting
DBG(1)[713]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:11:i386/quarterly/meta.conf with opts "i"
DBG(1)[713]> Fetch: fetcher chosen: http
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
DBG(1)[713]> Request to fetch pkg+http://pkg.FreeBSD.org/FreeBSD:11:i386/quarterly/packagesite.txz
DBG(1)[713]> opening libfetch fetcher
DBG(1)[713]> Fetch > libfetch: connecting
DBG(1)[713]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:11:i386/quarterly/packagesite.txz with opts "i"
DBG(1)[713]> Fetch: fetcher chosen: http
Fetching packagesite.txz: 100%    6 MiB 300.9kB/s    00:20
DBG(1)[713]> PkgRepo: extracting packagesite.yaml of repo FreeBSD
DBG(1)[733]> PkgRepo: extracting signature of repo in a sandbox
DBG(1)[713]> Pkgrepo, reading new packagesite.yaml for '/var/db/pkg/repo-FreeBSD.sqlite'
Processing entries: 100%
FreeBSD repository update completed. 28941 packages processed.
All repositories are up to date.
DBG(1)[713]> want to get an advisory lock on a database
Updating database digests format: 100%
DBG(1)[713]> problem has no requests
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        indexinfo: 0.3.1

Number of packages to be installed: 1

6 KiB to be downloaded.

Proceed with this action? [y/N]: y
DBG(1)[713]> Request to fetch pkg+http://pkg.FreeBSD.org/FreeBSD:11:i386/quarterly/All/indexinfo-0.3.1.txz
DBG(1)[713]> opening libfetch fetcher
DBG(1)[713]> Fetch > libfetch: connecting
DBG(1)[713]> Fetch: fetching from: http://pkgmir.geo.freebsd.org/FreeBSD:11:i386/quarterly/All/indexinfo-0.3.1.txz with opts "i"
DBG(1)[713]> Fetch: fetcher chosen: http
[1/1] Fetching indexinfo-0.3.1.txz: 100%    6 KiB   5.7kB/s    00:01
Checking integrity...DBG(1)[713]> Binary> loading /var/cache/pkg/indexinfo-0.3.1~bb860b5389.txz
DBG(1)[713]> check integrity for 1 items added
 done (0 conflicting)
DBG(1)[713]> want to upgrade advisory to exclusive lock
[1/1] Installing indexinfo-0.3.1...
[1/1] Extracting indexinfo-0.3.1: 100%
DBG(1)[713]> release an exclusive lock on a database
DBG(1)[713]> release an advisory lock on a database
root@www:~ #
```


----------



## SirDice (Jul 21, 2021)

Great, now a `pkg info -l indexinfo`.


----------



## FlorinMarian (Jul 21, 2021)

SirDice said:


> pkg info -l indexinfo




```
root@www:~ # pkg info -l indexinfo
indexinfo-0.3.1:
        /usr/local/bin/indexinfo
        /usr/local/share/licenses/indexinfo-0.3.1/BSD2CLAUSE
        /usr/local/share/licenses/indexinfo-0.3.1/LICENSE
        /usr/local/share/licenses/indexinfo-0.3.1/catalog.mk
root@www:~ #
```


----------



## SirDice (Jul 21, 2021)

Good, as you can see the package does contain /usr/local/bin/indexinfo. Now why doesn't that end up on your system?


----------



## FlorinMarian (Jul 21, 2021)

SirDice said:


> Good, as you can see the package does contain /usr/local/bin/indexinfo. Now why doesn't that end up on your system?


After a reboot it works but I've tried to achieve this output before being generated SSH keys (after fresh install, I had in mind to run some commands and then to shutdown VM to be converted into KVM template).
Thank ou!


----------



## SirDice (Jul 21, 2021)

FlorinMarian said:


> After a reboot it works


It's odd you needed to reboot for the files to "appear" on disk. That shouldn't be needed. Even if it had really, really slow I/O the files should be there almost instantly.


----------



## FlorinMarian (Jul 21, 2021)

SirDice said:


> It's odd you needed to reboot for the files to "appear" on disk. That shouldn't be needed. Even if it had really, really slow I/O the files should be there almost instantly.


There are RAID0 new Samsung 860 EVO disks, newly installed server.
Can you tell me, please how to safely remove SSH keys if this is single way to achieve desired output?
Thank you!


----------



## SirDice (Jul 21, 2021)

FlorinMarian said:


> Can you tell me, please how to safely remove SSH keys if this is single way to achieve desired output?


The host SSH keys? You can simply remove /etc/ssh/ssh_host_*. The next time the sshd service is started those keys will be automatically generated. I do this for all my VM images or else everything that's cloned from those images will have the same host keys.


----------



## FlorinMarian (Jul 21, 2021)

SirDice said:


> The host SSH keys? You can simply remove /etc/ssh/ssh_host_*. The next time the sshd service is started those keys will be automatically generated. I do this for all my VM images or else everything that's cloned from those images will have the same host keys.


Thank you very much!
About speed, I've realised today that on ISO installing there were just 336 files/sec and maybe that was the cause of reported error in this topic. (slow SSD, no idea why).

Best regards, Florin.


----------

