Solved thin jail mixup between 13.2 and 14.0 caused ld-elf.so.1: Shared object "libcap_dns.so.2" not found, required by "ping"

I was following the handbook when creating a thin jail and ended up with a jail where ping reports the following error:
ld-elf.so.1: Shared object "libcap_dns.so.2" not found, required by "ping"

The fault is probably mine, but I wanted to understand better what happened. My host is 14.0-RELEASE, though I don't know if I'm on p3 or p4 (it's possible that I just need to reboot and my kernel will end up being p4, but if I recall correctly, the only time I've run `freebsd-update fetch install` since last boot on the host I got

Code:
# freebsd-update fetch install                                                  
src component not installed, skipped                                            
Looking up update.FreeBSD.org mirrors... 3 mirrors found.                                                                                                         
Fetching metadata signature for 14.0-RELEASE from update2.freebsd.org... done.                                                                                    
Fetching metadata index... done.                                                
Inspecting system... done.                                                      
Preparing to download files... done.                                            
                                                                                
No updates needed to update system to 14.0-RELEASE-p4.                          
No updates are available to install.  
$ freebsd-version
14.0-RELEASE-p4
$ uname -a
FreeBSD redacted 14.0-RELEASE-p3 FreeBSD 14.0-RELEASE-p3 #0: Mon Dec 11 04:56:01 UTC 2023
root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

Since I was doing some copy-pasting, I had accidentally grabbed the base.txz of 13.2-RELEASE, but wrongly started calling it 14.0-RELEASE in the directory that I used, which I assume, should have had no effect on the outcome.

Code:
   39  doas fetch https://download.freebsd.org/ftp/releases/amd64/amd64/13.2-RELEASE/base.txz -o /usr/local/jails/media/14.0-RELEASE-base.txz                    
   40  doas tar -xf /usr/local/jails/media/14.0-RELEASE-base.txz -C /usr/local/jails/templates/14.0-RELEASE --unlink                                              
   41  doas cp /etc/resolv.conf /usr/local/jails/templates/14.0-RELEASE/etc/resolv.conf                                                                           
   42  doas cp /etc/localtime /usr/local/jails/templates/14.0-RELEASE/etc/localtime                                                                               
   43  doas freebsd-update -b /usr/local/jails/templates/14.0-RELEASE/ fetch                                                                                      
   44  doas freebsd-update -b /usr/local/jails/templates/14.0-RELEASE/ install                                                                                    
   45  zfs snapshot rpool/fbsd/jails/templates/14.0-RELEASE@base                                                                                                  
   46  doas  zfs snapshot rpool/fbsd/jails/templates/14.0-RELEASE@base

I then made a jail out of this template, which does have allow.raw_sockets, but like I said at the beginning, when I jexec inside, this jail now reports being a 14.0-RELEASE-p4, and ping breaks with

Code:
# freebsd-version
14.0-RELEASE-p4
# ping
ld-elf.so.1: Shared object "libcap_dns.so.2" not found, required by "ping"
# man freebsd-update
ld-elf.so.1: Shared object "libcap_fileargs.so.1" not found, required by "head"

Did things go south for me when I used the host's freebsd-update without specifying a new working directory with -d (in 43-44), so that's how it started to try to update to 14.0 release? I didn't think fetch and install would upgrade the version. I didn't see a mention of the current version in /etc/freebsd-update.conf
 
My host is 14.0-RELEASE, though I don't know if I'm on p3 or p4 (it's possible that I just need to reboot and my kernel will end up being p4
P4 was userland only. Your kernel will still be at P3.

The freebsd-update(8) step messed things up. It downloaded and installed patches for 14.0-RELEASE on the 13.2-RELEASE jail.

so that's how it started to try to update to 14.0 release?
Only partially, just the things that got updated with the patches. The rest of the "base" are still the 13.2 executables and libraries. If you look closely at any of the patches you'll see /bin/freebsd-version always gets updated. This executable has the "userland" version baked in.
 
Thanks SirDice.

If anyone else ends up in a similar situation, I was able to revert the patches from 14.0 that got applied to my 13.2 base, and then apply the correct 13.2 patches with

Code:
doas freebsd-update -b /usr/local/jails/templates/14.0-RELEASE/ rollback
doas freebsd-update --currently-running 13.2 -b /usr/local/jails/templates/14.0-RELEASE fetch install

followed by a zfs rename to make the template location reflect reality.
 
Back
Top