How do I update poudriere jail following STABLE?

I have recently decided to move from 13.2-RELEASE to 13.2-STABLE. Everything has gone well, and the process of updating from source, whilst slower, it has its own attraction. My next step is to build packages for stable. I can create poudrire jails following stable:
Bash:
poudriere -c -j 13-stable -v 13.2-STABLE
My question is how do I upgrade it so that it is in sync with build stable version of the host? The usual jail update doesn't work for STABLE

Bash:
#poudriere jail -u -j 13-stable-amd64
[00:00:00] Upgrading using http
freebsd-update.NJKt3oCy: Cannot upgrade from a version that is not a release
(including alpha, beta and release candidates)
using freebsd-update.NJKt3oCy. Instead, FreeBSD can be directly
upgraded by source or upgraded to a RELEASE/RELENG version
prior to running freebsd-update.NJKt3oCy.
Currently running: 13.2-STABLE
13.2-STABLE
I notice that poudriere manual also refers to src.conf and src-env.conf.
/usr/local/etc/poudriere.d/src.conf
/usr/local/etc/poudriere.d/src-env.conf

Am I correct at assuming they have to reflect the settings in host. Currently the host has:
/etc/src.conf
Bash:
WITH_CCACHE_BUILD=
WITHOUT_FLOPPY=
WITHOUT_WIRELESS=
WITHOUT_TESTS=
WITHOUT_HYPERV=
WITHOUT_LLVM_TARGET_ALL=
WITHOUT_LIB32=

/etc/src-env.conf
Bash:
WITH_META_MODE=YES
 
How I do it. My build server runs 14-STABLE[*]. It's updated through the normal build(7) process. Once the host itself has been updated I do the following to create images for 14-STABLE.

Code:
cd /usr/src/release
make clean   # Need to do this, it will not automagically detect things have been rebuilt
make -DNOPORTS -DNODOC -DKERNCONF="GENERIC" release
make -DNOPORTS -DNODOC -DKERNCONF="GENERIC" DESTDIR=/storage/release/14-stable install

Then in poudriere, created the jail like so: poudriere jail -c -j 14-stable -m url=file:///storage/release/14-stable/ftp -v 14-STABLE
And can be updated (after I have rebuild those images): poudriere jail -u -j 14-stable

[*] It's stable/14 now, but it was stable/13 before that, and stable/12 before that, etc. The process remains the same throughout.
 
[*] It's stable/14 now, but it was stable/13 before that, and stable/12 before that, etc. The process remains the same throughout.
What would be the best (or right) way to upgrade from a stable version to the next? from 13/stable to 14/stable, for example?
PS.: My question is regards the poudriere jail and the ports repo, not the host ;·)
 
What would be the best (or right) way to upgrade from a stable version to the next? from 13/stable to 14/stable, for example?
Same way as with every other update/upgrade. Fetch the right sources, read /usr/src/UPDATING, build world/kernel, install kernel/world, etcupdate(8) and don't forget delete-old/delete-old-libs.

PS.: My question is regards the poudriere jail and the ports repo, not the host
Create a new poudriere jail with the new version. I always create a new jail for every major or minor version update. Existing jails are only updated with patch updates. Except the -stable ones, those are updated for as long as that stable branch exists.

Code:
root@molly:/usr/local/etc/poudriere.d # poudriere jail -l
JAILNAME    VERSION         ARCH  METHOD                                    TIMESTAMP           PATH
13-stable   13.2-STABLE     amd64 url=file:///storage/release/13-stable/ftp 2023-08-13 22:01:59 /usr/local/poudriere/jails/13-stable
132-release 13.2-RELEASE-p2 amd64 http                                      2023-08-13 22:06:37 /usr/local/poudriere/jails/132-release
14-stable   14.0-ALPHA3     amd64 url=file:///storage/release/14-stable/ftp 2023-08-26 15:57:39 /usr/local/poudriere/jails/14-stable
You have new mail.
I will soon remove that 13-stable jail as I don't have any systems running 13-STABLE anymore, they've all been upgraded now.
 
I've created my poudriere jail as follows.
I'm sharing src and built objects within bare-metal base and poudriere jail.

poudriere jail -c -v stable/14 -a amd64 -K MYKERNCONF -j 14amd64 -m src=/usr/src

Change MYKERNCONF above to which you are building base.
If you are using GENERIC, option "-K MYKERNCONF" is NOT needed.

With this example, you can sanely use your custom kernel.
This is useful if you are building base yourself and building pkgs for your local environment only.

When you are going to upgrade base, update src tree, update bare-metal base as usual, then update your poudriere jail with option "-c" changed to "-u". poudriere updates its jail using already-built /usr/obj (by default).
 
Thanks T-Aoki

This was the [poudriere jail option I was missing. -m Build Method.
The manual seems to indicate a -b is also needed.
-b Build the source provided with the -m src=path option


git clone https://git.FreeBSD.org/src.git /usr/src
Add needed source patch
poudriere jail -c -j rock3a -v 15.0-CURRENT -K GENERIC-NODEBUG -b -J3 -m src=/usr/src
Trying to build a CURRENT jail on RockPi4 using 14.1-RELEASE host.
Don't know if that is posible.
 
The manual seems to indicate a -b is also needed.
-b Build the source provided with the -m src=path option
It would, unless you also have /usr/obj with alrady built objects from /usr/src.

I have my use-case documented at brew.bsd.cafe.

Trying to build CURRENT jail on 14.1-RELEASE
Don't know if that is posible.
It's not supported, as jails runs on running bare-metal kernel. Only the same or older branches / older commits of the same branch is officially supported. If you want to run CURRENT (main) on 14.1, you should use bhyve(8) instead of jail.
This is because newer userland could want newer (and not yet merged) functionalities of kernel. But if (luckily) nothing actually call newer functionalities, it would likely run on jail, not supported, though.
 
it would likely run on jail, not supported, though.
You got this right. It works but it does not understand GENERIC_NODEGUG kernel in jail.

I am picking my brain with -P Patch option of poudriere jail.

poudriere jail -a arm64.aarch64 -c -j rock3c -v 15.0-CURRENT -b -J40 -m src=/usr/src15.0 -x -P /poudriere/patch/pcie.patch

I just built like above but it did not seem to patch source. It went right to building. Will check when done.
Perhaps I have to plant patch in /usr/src15.0/ directory then poudriere jail copies into jail the source tree specified.

I tried a custom path and it appeared to have failed.
 
Last edited:
It would, unless you also have /usr/obj with already built objects from /usr/src.
I am so glad you brought that up. I was having troubles with builds and I flushed all of /usr/obj/.
I had no idea a cleaned jail would still have files there. It fixed my problems.
I did notice the underlaying jails still function fine as /usr/obj/ contents seem to be the leftover build tools.

45 Min. for a fresh run is not terrible.
[00:43:14] Jail rock64 14.1-RELEASE-p6 1401000 arm64.aarch64 is ready to be used

poudriere jail -a arm64.aarch64 -c -j rock64 -v 14.1-RELEASE -K GENERIC-MMCCAM -b -J40 -m src=/usr/src14.1

Still trying to figure out why poudriere jails will launch binmiscctl ((if I launch my command twice)) but poudriere bulk will not launch it.

Also if I launch the module manually it does not seem to work.
kldload imgact_binmisc.ko

Poudriere is doing all the magic for me. I need to figure out what IT is. X-Tools.
 
OK so it seems there needs to be an activator.

I have installed QEMU Single User package

Looking at manpage for binmiscctl(8)

I see this example:

Code:
      Add  QEMU  bsd-user program as an image activator for ARM AARCH64 bina-
       ries:

         # binmiscctl add arm64 \
           --interpreter "/usr/local/bin/qemu-aarch64-static" \
           --magic "\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\
            \x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00" \
           --mask  "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\
            \xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" \
           --size 20 --set-enabled

So when I specify aarch64 Poudriere Jails adds this activator for binmiscctl?
 
What about using Poudriere Jail Update to change a Kernel in a jail?

Want to change from GENERIC-MMCCAM to GENERIC.

Will -u update catch that -K Kernel change in my update jail command?

Now I delete jail and recreate. That takes time.

I have updated versions with -t version but not tried changing just kernel.
 
What about using Poudriere Jail Update to change a Kernel in a jail?

Want to change from GENERIC-MMCCAM to GENERIC.

Will -u update catch that -K Kernel change in my update jail command?

Now I delete jail and recreate. That takes time.

I have updated versions with -t version but not tried changing just kernel.

Not 100% sure but maybe, as in my case poudriere jail 100% matches (except timestamps) with my bare-metal base. For me,

poudriere jail -u -v stable/14 -a amd64 -K <kernconf> -j <jailname> -m src=/usr/src


updates /boot/ in poudriere jail. With this, poudriere updates jail using /usr/obj as pre-built binaries. Timestamps are newer than bare-metal, as it is the time of install.
 
poudriere jail -c -v stable/14 -a amd64 -K MYKERNCONF -j 14amd64 -m src=/usr/src

Change MYKERNCONF above to which you are building base.
If you are using GENERIC, option "-K MYKERNCONF" is NOT needed.

With this example, you can sanely use your custom kernel.
This is useful if you are building base yourself and building pkgs for your local environment only.

When you are going to upgrade base, update src tree, update bare-metal base as usual, then update your poudriere jail with option "-c" changed to "-u". poudriere updates its jail using already-built /usr/obj (by default).
If I got it correctly you mean something like that order ?:
1. cd /usr/src update source
2. make buildworld
3. make buildkernel
4. make installworld|installkernel
5. poudriere jail -u -v stable/14 -a amd64 -K MYKERNCONF -j 14amd64 -m src=/usr/src.
 
If I got it correctly you mean something like that order ?:
1. cd /usr/src update source
2. make buildworld
3. make buildkernel
4. make installworld|installkernel
5. poudriere jail -u -v stable/14 -a amd64 -K MYKERNCONF -j 14amd64 -m src=/usr/src.
Basically, yes. But you'd better following the procedure described in Chapter 26.6 of the Handbook, then, update poudriere as you've described.

Note that for quite rare cases, shutdown -r now on step6 is needed to be shutdown now to just drop into single user mode.

This happened, for example, all of
  • Root-on-ZFS installation
  • libc gets some updates that requires upgraded kernel
  • Old libc no longer works on upgraded kernel
were applicable.

In this case, if rebooted on step 6, root pool cannot be imported because installed libc no longer works (so /sbin/zfs and /sbin/zpool doesn't work), and not automatically falled back to /rescue/zfs and /rescue/zpool.
But this is quite rare case, although nearly fatal once happenes and you don't have installer memstick or another drive having another FreeBSD to be used for rescue purpose. Thankfully, when I've been bitten by this, I had stable and main in different drive and could rescue with another.
 
Back
Top