# minor version upgrade from src



## tommyhp2 (Apr 10, 2021)

Hi,

I'm unable to find an official documentation in the manual and wiki regarding upgrading minor version (12.1 to 12.2) from src.  Currently, I'm doing
`freebsd-update upgrade -r 12.2-RELEASE`
etc... per manual on upgrading.  Then
`cd /usr/src && make buildworld && make buildkernel && make installkernel`
etc... as per manual for reduced kernel and OS base.  Is it possible to upgrade from 12.1 to 12.2 via build world of 12.2 and install on top of 12.1 without the `freebsd-update upgrade ...`?

Thanks.


----------



## diizzy (Apr 10, 2021)

Yes it's possible and this tells you how to do it. https://docs.freebsd.org/en/books/handbook/book.html#makeworld


----------



## ShelLuser (Apr 10, 2021)

I can't help wonder what made you believe that you needed freebsd-update in the first place? 

Once you have the source tree installed through Git ("`# git clone https://git.freebsd.org/src.git /usr/src`") then you can use it to upgrade to _any_ version you want, you don't even have to check for new versions online. Just keep your tree up to date ("`git pull`") and check what releases are available by using `git branch -r`.

Once you identified a version you'd like to use (in your case this is 12.2) you simply switch to it: `git switch releng/12.2`. From there you can do your usual building and installing.

No freebsd-update required. In fact... on my servers (maintained through the source tree) that program doesn't even exist anymore.


----------



## mickey (Apr 10, 2021)

The instructions are also found in /usr/src/Makefile:

Makefile - src - FreeBSD source tree


----------



## tingo (Apr 10, 2021)

The converse is also true: if you have updated your system with freebsd-update, there is (usually) no need and no benefit to running  a source-based upgrade (in other words "make world").


----------



## tommyhp2 (Apr 11, 2021)

diizzy said:


> Yes it's possible and this tells you how to do it. https://docs.freebsd.org/en/books/handbook/book.html#makeworld


That's what I've been using to update the OS for the same version, including minor.



ShelLuser said:


> I can't help wonder what made you believe that you needed freebsd-update in the first place?


Section 24.2.3 of https://docs.freebsd.org/en/books/handbook/book.html#updating-upgrading-freebsdupdate



ShelLuser said:


> Once you have the source tree installed through Git ("`# git clone https://git.freebsd.org/src.git /usr/src`") then you can use it to upgrade to _any_ version you want, you don't even have to check for new versions online. Just keep your tree up to date ("`git pull`") and check what releases are available by using `git branch -r`.
> 
> Once you identified a version you'd like to use (in your case this is 12.2) you simply switch to it: `git switch releng/12.2`. From there you can do your usual building and installing.
> 
> No freebsd-update required. In fact... on my servers (maintained through the source tree) that program doesn't even exist anymore.


The section 25.5.3 https://docs.freebsd.org/en/books/handbook/cutting-edge/#makeworld
provided the commands for git but I was getting an error:

`git clone --branch releng/12.2 ssh://git@gitrepo.freebsd.org/src.git /usr/src
Cloning into '/usr/src'...
git@gitrepo.freebsd.org: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights`

I'll try your suggested git command.  Thanks.  Perhaps I should file a PR for documentation error?



tingo said:


> The converse is also true: if you have updated your system with freebsd-update, there is (usually) no need and no benefit to running  a source-based upgrade (in other words "make world").


 Have you compared the default generic vs a custom kernel size?  Then there are also other unwanted/unneeded libraries in the base OS like lib32, debug, etc...  That's the reason I prefer FreeBSD over any Linux.  Default mininum install is already smaller than any Linux. Ability to easily reduce some bloat (depends on your perspective/environment) further is big bonus


----------



## ShelLuser (Apr 12, 2021)

tommyhp2 said:


> I'll try your suggested git command.  Thanks.  Perhaps I should file a PR for documentation error?


Sounds like a plan, if time permits (won't have much spare time the upcoming weeks) I might even take a crack at that page myself because...  I can only facepalm when I read some of that stuff.

For example...  `git pull /usr/src` is totally ridiculous, as well explained (IMO) in git-pull(1):



> SYNOPSIS
> git pull [<options>] [<repository> [<refspec>...]]
> [...]
> <repository> should be the name of a remote repository as passed to
> git-fetch(1).


Hopefully needless to say: /usr/src makes no sense in this context. It gets even worse: if you're not 'inside' a valid Git repository then `git pull ...` will refuse to run anyway:


```
peter@vps:/home/peter $ git pull /usr/src
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
```
So how anyone could come up with that command is way beyond me.


----------

