# No such file or directory on upgrading from 12.1 to 12.2



## Morris (Oct 31, 2020)

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?


----------



## the3ajm (Nov 1, 2020)

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.


----------



## a6h (Nov 1, 2020)

Morris said:


> 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

```
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.


```
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)


----------



## Morris (Nov 1, 2020)

the3ajm said:


> 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: 

```
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.


----------



## Morris (Nov 1, 2020)

vigole said:


> There's a line in /etc/freebsd-update.conf
> 
> ```
> Components src 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


vigole said:


> 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.


vigole said:


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


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.


----------



## a6h (Nov 1, 2020)

Morris said:


> Does Freebsd-update not update the source tree during the upgrade process? In that case there is an issue with Freebsd-update.





Morris said:


> I am using the default method and so the configuration is still 'Components world kernel'.


That's the problem. Change it to `Components src world kernel`


----------



## Morris (Nov 1, 2020)

vigole said:


> 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:


> ```
> $ cat /etc/freebsd-update.conf
> # $FreeBSD: releng/12.2/usr.sbin/freebsd-update/freebsd-update.conf 337338 2018-08-04 22:25:41Z brd $
> 
> ...


----------

