That's a first, and if my futile searches are any indicator, a first ever for anyone.
Everything I use in #FreeBSD is installed from ports, not pkg, yet I somehow managed to bork my pkg database so badly that pkg-static keeps randomly removing vital packages like www/firefox and x11/xorg-server while upgrading (and later reinstalling) completely unrelated ports.
#FreeBSD Ahah. The first `pkg` in my path is /usr/sbin/pkg from base, while the first `pkg-static` is /usr/local/sbin/pkg-static from ports-mgmt/pkg, the two sources got out of sync (ports a higher version number than base), ports-mgmt/portmaster explicitly uses pkg-static, and I never noticed which `pkg` and `pkg-static` I was using outside of that. Yep, that would do it.
#FreeBSD While I slept, portmaster descended thousands of levels deep into a circular dependencies loop: deskutils/zim > devel/xdg-utils > textproc/xmlto > www/w3m > graphics/imlib2 > graphics/libheif > multimedia/ffmpeg > graphics/libcaca > graphics/imlib2 > graphics/libheif > multimedia/ffmpeg.
Make-installing zim and restarting portmaster without zim somehow broke the circular dependency loop, despite nothing being functionally different.
I had to `rm /var/db/pkg/*` and re-bootstrap pkg to stop my installed ports from being randomly uninstalled. I did that a few days ago, and it worked.
Now I have my most needed ports reinstalled (installed anew, according to #FreeBSD), and my system is back to mostly normal again.
But because I wiped out my pkg database, I have a few thousand now-untracked binaries that I need to sort through, finding out the hard way which ports installed them.
@arielmt we always mv /var/db/pkg{,.bad} so we have the old databaste to compare against
@atax1a I'm an even bigger idiot than that. I just remembered I have /.zfs/snapshot/(most_recent_name)/var/db/pkg/ to compare against.
@arielmt oh, yeah, we love us some snapped shots
Current status: Run GHC