Re: changing from pkgbase to regularbase
- In reply to: polyduekes_a_proton.me: "Re: changing from pkgbase to regularbase"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 23 Nov 2025 17:12:08 UTC
polyduekes@proton.me writes:
> what is the correct way to depkgbasify?
There is no “correct” way. Here's what I would suggest:
1. Make sure your system is up-to-date and consistent and you have a
matching source tree installed:
# pkg upgrade -y
# pkg install -y FreeBSD-set-src
# pkg autoremove -y
2. Make a list of non-pkgbase non-automatic packages:
# pkg query -e '%a == 0 && %o !~ base/*' %n >packages
3. Delete your installed package database:
# rm /var/db/pkg/local.sqlite
4. Reinstall non-pkgbase packages:
# pkg install -fy $(cat packages)
This will of course also reinstall all dependencies, but we are
deliberately only specifying non-automatic packages so the end result
is the same as what we started out with. If we had made a list of
_all_ installed packages, we would end up with everything now being
marked non-automatic, and `pkg autoremove` would no longer work
properly.
5. Populate /var/db/etcupdate so it will work when you later upgrade
from source:
# etcupdate extract
6. Optional but recommended — disable the pkgbase repository:
# rm /usr/local/etc/pkg/repos/FreeBSD.conf
(this file will have been created by the installer and should contain
a single line that enables the FreeBSD-base repository; without it,
the repository remains defined in /etc/pkg/FreeBSD.conf but disabled)
You can also remove cached information about the repository, which
you will no longer need:
# rm -rf /var/db/pkg/repos/FreeBSD-base
At this point you can replace /usr/src with a git clone and upgrade as
usual (`make -C /usr/src -j1.5 world kernel && etcupdate -B`).
There is a shortcut for steps 2-4. I think it is both sufficient and
safe, but I don't know pkg's internals well enough to say for sure;
perhaps bapt@ can weight in. First you need to install the sqlite3 cli:
# pkg install -Ay sqlite3
You can then use it to remove information about base packages from the
package database, leaving the rest intact so you don't have to reinstall
them:
# sqlite3 /var/db/pkg/local.sqlite \
"delete from packages where origin like 'base/%';"
If you choose this route you can also drop the autoremove in step 1,
which I only put in to shorten steps 2 and 4. You still have to perform
step 5 (and optionally 6).
DES
--
Dag-Erling Smørgrav - des@FreeBSD.org