# Child process pid=##### terminated abnormally: Bus error



## user00 (Sep 10, 2022)

After I have installed updates today pkg began to throw the error in subject and dump its core (static does the same).
So I cannot install any packages or make install any ports.
Any ideas how to fix this?

FreeBSD somehost 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64


----------



## VladiBG (Sep 10, 2022)

corrupted pkg db maybe...
what is the output of `pkg-static -d update`


----------



## user00 (Sep 10, 2022)

```
# pkg-static -d update
DBG(1)[32401]> pkg initialized
Updating FreeBSD repository catalogue...
DBG(1)[32401]> PkgRepo: verifying update for FreeBSD
DBG(1)[32401]> Pkgrepo, begin update of '/var/db/pkg/repo-FreeBSD.sqlite'
DBG(1)[32401]> Request to fetch pkg+[URL]http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly/meta.conf[/URL]
DBG(1)[32401]> opening libfetch fetcher
DBG(1)[32401]> Fetch > libfetch: connecting
DBG(1)[32401]> Fetch: fetching from: [URL]http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/quarterly/meta.conf[/URL] with opts "i"
DBG(1)[32401]> Request to fetch pkg+[URL]http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly/packagesite.pkg[/URL]
DBG(1)[32401]> opening libfetch fetcher
DBG(1)[32401]> Fetch > libfetch: connecting
DBG(1)[32401]> Fetch: fetching from: [URL]http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/quarterly/packagesite.pkg[/URL] with opts "i"
DBG(1)[32401]> Request to fetch pkg+[URL]http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly/packagesite.txz[/URL]
DBG(1)[32401]> opening libfetch fetcher
DBG(1)[32401]> Fetch > libfetch: connecting
DBG(1)[32401]> Fetch: fetching from: [URL]http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/quarterly/packagesite.txz[/URL] with opts "i"
FreeBSD repository is up to date.
All repositories are up to date.
```


----------



## CyberCr33p (Sep 10, 2022)

Do you still have this issue after rebooting your computer?


----------



## user00 (Sep 10, 2022)

Yes...


----------



## CyberCr33p (Sep 10, 2022)

Maybe if you remove "pkg-static" using `pkg del pkg` it will download it again the next time you try to install a package. But better to wait for someone else to confirm this.


----------



## user00 (Sep 10, 2022)

Why does it need to be removed and downloaded again?


----------



## CyberCr33p (Sep 10, 2022)

If a file related to pkg-static is corrupted it will fix it.


----------



## VladiBG (Sep 10, 2022)

i don't see the error in your second post.
Try to reinstall the pkg using `pkg-static bootstrap -f`


----------



## user00 (Sep 10, 2022)

That did it. Installed some package w/o error.
Thanks a lot!

Do we know/are we able to find out what the problem was?


----------



## user00 (Sep 10, 2022)

It just did it again, as I was making a port:

===>   Registering installation for libtextstyle-0.21 as automatic
Installing libtextstyle-0.21...
Child process pid=19098 terminated abnormally: Bus error
*** Error code 138

Went to the VM and found that its screen is covered in

vm_fault: pager read error, pid ##### (pkg-static)

I never had this issue until 13 came up. Will have to scrap it and use other options.


----------



## covacat (Sep 10, 2022)

try

```
mv /var/db/pkg/local.sqlite  /var/db/pkg/local.sqlite.bak
echo .dump |sqlite3 /var/db/pkg/local.sqlite.bak |sqlite3 /var/db/pkg/local.sqlite
```


----------



## VladiBG (Sep 11, 2022)

On which hypervisor is running this VM?
What is the filesystem type that you are using?


----------



## SirDice (Sep 12, 2022)

VladiBG said:


> Try to reinstall the pkg using `pkg-static bootstrap -f`


Use `pkg bootstrap -f`. The difference here is pkg(7) (/usr/sbin/pkg) and pkg(8) (/usr/local/sbin/pkg). If you remove pkg(8); `pkg delete pkg`, there won't be a pkg-static anymore either (since it's part of the ports-mgmt/pkg package).


----------



## VladiBG (Sep 12, 2022)

just read the pkg(8) about pkg-static



> *pkg-static* is a statically linked variant of *pkg* typically only used for the initial installation of *pkg*.



Edit:
if pkg(8) failed to execute due to some lib mismatch then pkg-static can be used to reinstall pkg otherwise you can't use `pkg delete -f pkg` as it will also fail. So you have to use pkg-static or /usr/sbin/pkg (7) to bootstrap pkg(8)


----------



## SirDice (Sep 12, 2022)

VladiBG said:


> just read the pkg(8) about pkg-static


Yes. It's useful. But it's installed as part of ports-mgmt/pkg. So if you remove that package you also remove pkg-static. There is a difference between pkg(7) (part of the base) and pkg(8). `pkg boostrap -f` runs pkg(7), not pkg(8) (confused yet?)


----------

