ppr is a terminal utility that repairs and verifies FreeBSD and GhostBSD package databases.
It provides clear, progressive feedback and real-time status updates.
- Name: PGSD pkg repair (ppr)
- Author: Pacific Grove Software Distribution Foundation
- License: BSD 2-Clause
- Copyright: © 2025 Pacific Grove Software Distribution Foundation
- GhostBSD or PGSD
- Go 1.21 or newer
- Root privileges
pkg(8)utility available in$PATH
git clone https://github.com/pgsdf/ppr.git
cd ppr
make buildThe included Makefile supports both amd64 and arm64 builds:
make build-amd64
make build-arm64
make releaseAll build artifacts and checksums will be placed in the bin/ directory.
Run ppr as root to perform all repair stages:
sudo ./ppr| Option | Description | Default |
|---|---|---|
--dry-run |
Show intended actions without applying changes | false |
--compact |
Compact, minimal output mode | false |
--report-json <file> |
Write detailed JSON event log to file | none |
--timeout <duration> |
Set overall timeout (e.g. 30m, 1h) | 20m |
sudo ./ppr --compact --report-json /var/log/ppr-$(date +%Y%m%d).json-
Check Repository Network
Verifies all repositories are reachable and their metadata endpoints respond.
Verifies DNS resolution for repository hosts
-
Detect Environment
Confirms execution as root and checks system compatibility.
-
Clear Repository Cache
Removes outdated or corrupted
repo-*.sqlite*files. -
Force Package Update
Refreshes repository data with
pkg update -f. -
Verify Package Database
Performs integrity checks with
pkg check -da. -
Recompute Package Metadata
Rebuilds dependency and manifest data with
pkg check -r -a. -
Last Resort Recovery
Moves
local.sqliteaside if needed. If none exists, ppr reports: “No local.sqlite found — package database is already in a clean state.”
[
{
"time": "2025-02-01T05:22:00Z",
"stage": "repo_network_check",
"status": "ok",
"message": "Repository network reachable",
"detail": "[✓] https://pkg.ghostbsd.org/stable/FreeBSD:14:amd64/latest (ok)"
},
{
"time": "2025-02-01T05:23:00Z",
"stage": "move_local_sqlite",
"status": "ok",
"message": "No local.sqlite found",
"detail": "Package database is already in a clean state"
}
]Statuses: ok, warn, skip, error
sudo ./pprCheck your network configuration or /etc/pkg/GhostBSD.conf.
Manual recovery steps:
sudo rm -f /var/db/pkg/repo-*.sqlite*
sudo rm -f /var/db/pkg/local.sqlite
sudo pkg bootstrap -f
sudo pkg update -f
sudo pkg upgrade -f| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General failure |
| 2 | Invalid arguments |
| 126 | Permission denied (not run as root) |
ppr/
├── main.go # Program source
├── Makefile # Cross-platform build definitions
├── go.mod # Go module dependencies
└── README.md # Project documentation
BSD 2-Clause License © 2025 Pacific Grove Software Distribution Foundation