Re: Recover from a corrupt pkg DB

From: Tatsuki Makino <>
Date: Tue, 30 Aug 2022 21:23:47 UTC
Ports that need to be reinstalled can usually be found in pkg check -sna.

Tatsuki Makino wrote on 2022/08/31 06:19:
> Hello.
> I also just recently unlinked /var/db/pkg/local.sqlite to a place where it cannot be traced from the /var file system :)
> To recover from that, there should already be a backup that others have mentioned, in which case the following command is all that is needed to restore it.
> xzcat /var/backups/pkg.sql.xz | pkg shell
> Now all that is left is to re-install the port that was installed after that backup was made, and you will most likely be back to normal.
> After the backup is made, if the port tree is updated and there are any plist changes, no :)
> Regards.