FreeBSD Update all php packages to a new version

When PHP is installed on a FreeBSD system, you have a lot of packages, for example:

pkg prime-list
php80-ctype
php80-curl
php80-exif
...
php80-tokenizer
php80-zip
php80-zlib

To update all these packages to newer version the following can be used :-)

# first note what was installed (optional but recommended)
pkg prime-list > /tmp/installed-packeges.txt

# then execute the update command php80 => php83
cat /tmp/installed-packages.txt | grep php80 | sed 's/php80/php83/g' | xargs -o  pkg install

Freebsd bastille console not working after upgrade 13 to 14

After updating my host system to FreeBSD 14.0, it was time to update the bsatille jails.
The jails I've running are thin jails , with symlinks to the release of the given jail.

Summary of the update

The jail have been updated following the instructions found at the bastille manual

# ensure the new version is bootstrapped and update to the latest patch release: 
bastille bootstrap 14.0-RELEASE update

# and change the 13.2 to 14.0 mount
bastille stop TARGET
bsatille edit TARGET fstab

# force reinstallation and upgrade all packages
# the pkg boostrap  isn't in the manual but IS required
bastille start TARGET
bastille pkg TARGET bootstrap -f
bastille pkg TARGET update
bastille pkg TARGET upgrade -f
bastille restart TARGET

bastille console fails

Next the jail seemed to be running, but unfortunately bastille console TARGET just stops without any errors/warning etc.

Though bastille console didn't work, It was still possible to enter the jail via jexec

jexec TARGET

Incorrect /etc configuration files

The problem is described in the following post: https://forums.freebsd.org/threads/newbie-upgrade-problem-13-2-release-14-0-release-merge-conflict.91219/

The reason is that pam_opie.so seems to have been removed. it can be fixed by simply moving that auth method as describe there.

A much better way is to update the outdated /etc configuration files! (These haven't been updated yet!)

Update the /etc configuration with etcupdate

First make sure the freebsd sources are available in /usr/jails/bastille/releases/14.0-RELEASE/usr/src

I solved this by copying the sources from my host system to the release.

cp -Rp /usr/src/ /usr/local/bastille/releases/14.0-RELEASE/usr/src/

You can also download the source directly via this link: )
https://cgit.freebsd.org/src/snapshot/releng/14.0.tar.gz

Next perform the etcupdate in the jail.

jexec TARGET
etcupdate
etcupdate resolve # if there are conflicts

Fix merge conflicts if they happen.
After that bastille console should work again!

FreeBSD update 13 to 14

I've just updated my server from 13.2-RELEASE to 14.0-RELEASE. This when pretty flawlessly, I had an issue with slow updating of the userland part. (The update after the first reboot)

It was extremely slow, update userland was already running for more then an hour. Pretting Ctrl+t to view what it was doing, i noticed it was [wait]ing most of the time.

Searching for this problem I found a solution speed it up dramaticly.
Setting the following control variable (in another terminal) made the update finish almost instantly.

sysctl vfs.zfs.dmu_offset_next_sync=0

After the next reboot this flag is turned back to the original value.

Thanks to the contributors of the following references:

Install postgresql in FreeBSD jail enable sysvipc

Installen postgresql on a FreeBSD jail can result in an error when intializing the database.

 service postgresql initdb
running bootstrap script ... 2023-02-24 10:21:41.757 CET [29388] FATAL:  could not create shared memory segment: Function not implemented
2023-02-24 10:21:41.757 CET [29388] DETAIL:  Failed system call was shmget(key=37383, size=56, 03600).

By default shared memory via sysvipc is not allowed.

sysctl security.jail.sysvipc_allowed
#=> security.jail.sysvipc_allowed: 0

To solve this enable sysvipc for the given jail...
For bastille this can be added to the config file: /usr/local/bastille/jails/jailname/jail.conf

allow.sysvipc = 1;

Restart jail.

sysctl security.jail.sysvipc_allowed
#=> security.jail.sysvipc_allowed: 1