No such file or directory on upgrading from 12.1 to 12.2

I just upgraded from 12.1-p10 to 12.2-p0 and ran into an issue.

The first part of freebsd-update -r 12.2-RELEASE went fine. Then the process wanted me to reboot and run install again to finish it off. That’s where it went wrong as the install process after the reboot stalled on a “No such file or directory” error regarding a missing file in /usr/src/ (/usr/src/contrib/apr/include/private/apr_encode_private.h to be precise but it's probably a lot more)

/usr/src/ is populated for me but it was clearly still on 12.1-p10 and so some files required for 12.2 were missing.

Now, one of the tasks of freebsd-update is to keep /usr/src/ updated if it’s populated. Correct? Why then doesn’t it update that directory before it needs it itself?

It would make sense if updating the /usr/src directory is the last thing freebsd-update does in the first phase, prior to the reboot. Is this a bug in freebsd-update?
 
Last edited by a moderator:
Have you tried going to single user mode and install the update again? I would look to see if you can perform the upgrade from there and if there are any output that might be alarming.
 
Now, one of the tasks of freebsd-update is to keep /usr/src/ updated if it’s populated. Correct? Why then doesn’t it update that directory before it needs it itself?
There's a line in /etc/freebsd-update.conf
Code:
Components src world kernel

If you want to let freebsd-update(8), update the /usr/src, then keep it that way.
If you prefer to update src through devel/subversion or svnlite(1), you should comment out src parameter, i.e.

Code:
Components world kernel

I don't know what is going on with your source tree, but there's an easy way: remove it and checkout it again:

Method 1:
rm -fr /usr/src
pkg install security/ca_root_nss devel/subversion
svn checkout https://svn.freebsd.org/base/releng/12.2 /usr/src

OR

Method 2:
rm -fr /usr/src
pkg install security/ca_root_nss
svnlite checkout https://svn.freebsd.org/base/releng/12.2 /usr/src

Footnote:
You don't have to install security/ca_root_nss to svn works, but then you have to accept/trust certification every single time, when you run svn or svnlite command.

Warning 1:
Don't mix different methods of update on same directory: use svn/svnlite or freebsd-update, not both.

Warning 2:
freebsd-update(8) is only works with base/releng/* AKA RELEASE.
You can't use it to update base/stable (STABLE) or base/head (CURRENT)
 
Have you tried going to single user mode and install the update again? I would look to see if you can perform the upgrade from there and if there are any output that might be alarming.
I have solved the issue by manually updating the source tree:
Code:
curl https://download.freebsd.org/ftp/releases/amd64/12.2-RELEASE/src.txz --output /usr/src/src.txz
tar -xf /usr/src/src.txz -C /
and then starting the second phase of the install process. That solved the issue and also proved to me that it was indeed an issue with an outdated source tree.
 
  • Thanks
Reactions: a6h
There's a line in /etc/freebsd-update.conf
Code:
Components src world kernel

If you want to let freebsd-update(8), update the /usr/src, then keep it that way.
If you prefer to update src through devel/subversion or svnlite(1), you should comment out src parameter, i.e.

Code:
Components world kernel
I am using the default method and so the configuration is still 'Components world kernel'. I have had some issues with the source tree in the past but that had appeared to be solved as I'm fairly certain it was working on 12.1
I don't know what is going on with your source tree, but there's an easy way: remove it and checkout it again:
I have updated using curl (see my previous comment) and that solved the issue.
Warning 1:
Don't mix different methods of update on same directory: use svn/svnlite or freebsd-update, not both.

Warning 2:
freebsd-update(8) is only works with base/releng/* AKA RELEASE.
You can't use it to update base/stable (STABLE) or base/head (CURRENT)
This was an update from RELEASE to RELEASE. I never use STABLE or CURRENT.

My question is, should Freebsd-update have updated the source tree during the upgrade process? In that case there is indeed an issue with my source tree.

Or

Does Freebsd-update not update the source tree during the upgrade process? In that case there is an issue with Freebsd-update.
 
That's the problem. Change it to Components src world kernel
Apologies, that was indeed what it said. This is the full contents of my freebsd-update.conf:
Code:
$ cat /etc/freebsd-update.conf
# $FreeBSD: releng/12.2/usr.sbin/freebsd-update/freebsd-update.conf 337338 2018-08-04 22:25:41Z brd $

# Trusted keyprint.  Changing this is a Bad Idea unless you've received
# a PGP-signed email from <security-officer@FreeBSD.org> telling you to
# change it and explaining why.
KeyPrint 800651ef4b4c71c27e60786d7b487188970f4b4169cc055784e21eb71d410cc5

# Server or server pool from which to fetch updates.  You can change
# this to point at a specific server if you want, but in most cases
# using a "nearby" server won't provide a measurable improvement in
# performance.
ServerName update.FreeBSD.org

# Components of the base system which should be kept updated.
Components src world kernel

# Example for updating the userland and the kernel source code only:
# Components src/base src/sys world

# Paths which start with anything matching an entry in an IgnorePaths
# statement will be ignored.
IgnorePaths

# Paths which start with anything matching an entry in an IDSIgnorePaths
# statement will be ignored by "freebsd-update IDS".
IDSIgnorePaths /usr/share/man/cat
IDSIgnorePaths /usr/share/man/whatis
IDSIgnorePaths /var/db/locate.database
IDSIgnorePaths /var/log

# Paths which start with anything matching an entry in an UpdateIfUnmodified
# statement will only be updated if the contents of the file have not been
# modified by the user (unless changes are merged; see below).
UpdateIfUnmodified /etc/ /var/ /root/ /.cshrc /.profile

# When upgrading to a new FreeBSD release, files which match MergeChanges
# will have any local changes merged into the version from the new release.
MergeChanges /etc/ /boot/device.hints

### Default configuration options:

# Directory in which to store downloaded updates and temporary
# files used by FreeBSD Update.
# WorkDir /var/db/freebsd-update

# Destination to send output of "freebsd-update cron" if an error
# occurs or updates have been downloaded.
# MailTo root

# Is FreeBSD Update allowed to create new files?
# AllowAdd yes

# Is FreeBSD Update allowed to delete files?
# AllowDelete yes

# If the user has modified file ownership, permissions, or flags, should
# FreeBSD Update retain this modified metadata when installing a new version
# of that file?
# KeepModifiedMetadata yes

# When upgrading between releases, should the list of Components be
# read strictly (StrictComponents yes) or merely as a list of components
# which *might* be installed of which FreeBSD Update should figure out
# which actually are installed and upgrade those (StrictComponents no)?
# StrictComponents no

# When installing a new kernel perform a backup of the old one first
# so it is possible to boot the old kernel in case of problems.
# BackupKernel yes

# If BackupKernel is enabled, the backup kernel is saved to this
# directory.
# BackupKernelDir /boot/kernel.old

# When backing up a kernel also back up debug symbol files?
# BackupKernelSymbolFiles no
 
Back
Top