Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Nov 2025 18:12:08 +0100
From:      =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        polyduekes@proton.me
Cc:        Lexi Winter <ivy@freebsd.org>,  freebsd-current@freebsd.org, bapt@freebsd.org
Subject:   Re: changing from pkgbase to regularbase
Message-ID:  <861pload1z.fsf@ltc.des.dev>
In-Reply-To: <npwDORtr2Yu3U030JdrqqhiwOtcJFCOC80Lrub8U8faFbaBTHvQdSrSDy5fWgQDSTZs30Un0y9UTyIn3i_Mz-dA0bUGdUlklr157U4mw8xM=@proton.me> (polyduekes@proton.me's message of "Sun, 23 Nov 2025 08:07:35 %2B0000")
References:  <aR3Rc_5llfvlEjIo@int21h> <aSEGPTtrfV29u9R9@amaryllis.le-fay.org> <71e4b46c-8d69-451d-92ca-79316ffc4b63@app.fastmail.com> <aSETbVSLxcDa5ssB@amaryllis.le-fay.org> <20251122180931.52c1141475f5faec4fad633c@dec.sakura.ne.jp> <d6ed185f-ed13-4a2c-a875-1b687a0f7b8b@plan-b.pwste.edu.pl> <aSG0JXUhAG2fBal-@amaryllis.le-fay.org> <npwDORtr2Yu3U030JdrqqhiwOtcJFCOC80Lrub8U8faFbaBTHvQdSrSDy5fWgQDSTZs30Un0y9UTyIn3i_Mz-dA0bUGdUlklr157U4mw8xM=@proton.me>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?861pload1z.fsf>