# Upgrading from 11 Release to 12 Current



## antuan (Jun 12, 2017)

What is the way for upgrading FreeBSD from 11 Release to 12 Current?


----------



## ShelLuser (Jun 12, 2017)

No offense intended but if you need to ask such a trivial question then you may not want to run -CURRENT, for the simple reason that -CURRENT is a developers snapshot which can give you much more problems than the upgrade procedure itself. For example: there isn't any guarantee that the snapshot will work at all.

But to answer your question...  The best way to do this (in my opinion) is to check out the source code and then compiling the whole OS from scratch. You can then use the regular upgrade procedures to (try) and make sure that everything continues to work. Once again: there are no guarantees.

So, for example: `# svn co https://svn.freebsd.org/base/head /usr/src`. Then set up the required configuration (/etc/src.conf and optionally a custom kernel configuration) and build and install the base system. The handbook has a section on upgrading FreeBSD from source which might be of some help here. But also be sure to check out /usr/src/Makefile because that contains some good instructions as well.

Also noteworthy: src.conf(5) is a good source of information regarding the options you can use in /etc/src.conf _however..._ if you use the `man src.conf` command you'd get the manualpage for the currently installed base system. These wouldn't list any options for a new version, especially when compilation options got added or removed.

Therefor the right way to check up on these is to use the manualpage(s) from the source tree. So: `man -M /usr/src/share/man src.conf`. This would give you all the relevant options which you can use for the base system you're about to build and install.


----------



## antuan (Jun 12, 2017)

In fact, I wanted to improve sysutils/docker-freebsd which obviously has some operating problems. I saw that there was a patch. So I installed Subversion in order to update my ports via svn to improve this port, but nothing has changed. So I might change my question as follows: How to improve docker since version 12-CURRENT?


----------



## ShelLuser (Jun 13, 2017)

Your comments make little sense.

First: you don't need Subversion to keep your ports tree up to date, look into portsnap(8) for that which might be easier on you.

Another thing: the ports collection does not follow FreeBSD releases. In fact, the ports collection doesn't have any version numbers at all because updates are done on a per-port basis. See /usr/ports/UPDATING. If you want to improve on a port, then check out the Porters handbook.


----------



## SirDice (Jun 13, 2017)

All versions of FreeBSD on all (supported) architectures use the exact same ports tree. 

Obligatory warning: Topics about unsupported FreeBSD versions


----------



## antuan (Jun 13, 2017)

Yes I have tested portsnap and it is much faster and can be less laborious. But I still can not get the patched version of docker. Because after doing

```
portsnap fetch extract
portsnap fetch update
pkg upgrade
```
I check the docker version and it gives me this

```
docker-freebsd-20150625            <
```


----------



## rigoletto@ (Jun 13, 2017)

You are doing it wrong. Portsnap update the ports tree, while pkg deal with the package repository, what is never synced with ports. The packages in the repository are updated/rebuilt from time-to-time.

EDIT: not to say `pkg` uses the quarterly repository by default, and not the latest.

To use ports you need to build them "manually", as explained in the handbook. Alternatively to the methods described there, and if you want to use ports exclusively (not the pre-built packages), you can also use ports-mgmt/synth.


----------



## ShelLuser (Jun 14, 2017)

Yups. What you want to do here is check out ports(7).

Go to /usr/ports/sysutils/docker-freebsd and from there check out the port. For example: `# make extract`, this would download and unpack the required source files in the working directory. After that you can fully study the source tree as well as the scripts being used to build it and set it up.


----------



## antuan (Jun 14, 2017)

At the risk of appearing silly.

1) Installation and upgrade

We will say that I have a fresh installation from an iso file -> `uname -a`

```
FreeBSD svn-update 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```
The date tells us 2016. So probably the first thing to do is to update everything!!! I think we are currently at 11.0-RELEASE-p9 and I have 11.0-RELEASE-p1. So I have already tried freebsd-update(8) for that and it looks good.

2) Docker Installation
At this point, I want to install the latest version of docker...I go to /usr/ports/sysutils/docker-freebsd and execute the command `make extract`. But I have a hard time understanding how I could add this patch.
I tried to do it with svn(1), but the command `svn patch ~ egypcio/freebsd/ports` (as described in same page) returns with an error: ~egypcio/freebsd/ports does not exist.
So surely I'm doing something wrong, because the repository egipcio/freebsd exists but egypcio/freebsd/ports returns to a 404 page.


----------



## ShelLuser (Jun 14, 2017)

antuan said:


> At the risk of appearing silly.


No worries. We all have to start somewhere and being as clear as possible about this is more likely to help us spot where things go wrong and help you fix that. But most of all: I know that all of this can be a little daunting at first.



antuan said:


> 2) Docker Installation
> At this point, I want to install the latest version of docker...I go to /usr/ports/sysutils/docker-freebsd and execute the command `# make extract`. But I have a hard time understanding how I could add this patch.


You don't have to. That patch was meant to update the port so that it would run better on the latest FreeBSD snapshot, which you don't use. I don't have hands on experience with the aftermath of PR's but considering that the report was closed and marked as fixed I can't help think that there's nothing left to fix here.

So you should be able to install the port using `# make install clean`. Or, as you apparently did before, use the binary package (so: using `# pkg install docker-freebsd`). That would install the latest version which was made available for FreeBSD, ready to use.

I also checked the details of the patch you referred to and it seems to me that all the patch does is change a few lines in Makefile and distinfo (most specifically lines which contain version numbers) but nothing more. Which, to me, would render this patch somewhat useless because it doesn't actually change much, nothing related to the actual source code anyway.

Something which is made quite clear here:


```
root@box:/usr/ports # svn patch ~egypcio/freebsd/ports/ports.HEAD.r419559.sysutils.docker-freebsd.patch
U         sysutils/docker-freebsd/Makefile
U         sysutils/docker-freebsd/distinfo
```
But to address your actual question.. If you check the link I shared above you'll gain access to the actual patch itself. Copy the whole thing (so control-a, control-c, copy all that text) and create a new file in the ports directory called "docker.patch", then paste this stuff in.

_Warning:_ I'd strongly advice you to copy the port directory and experiment on that instead of messing with the actual port itself. This allows you to easily revert your changes.

So:

```
macron:/home/peter/temp/docker-freebsd $ ls
Makefile        docker.patch    pkg-descr
distinfo        files/          pkg-message
macron:/home/peter/temp/docker-freebsd $ head docker.patch
Index: sysutils/docker-freebsd/Makefile
===================================================================
--- sysutils/docker-freebsd/Makefile    (revision 419559)
+++ sysutils/docker-freebsd/Makefile    (working copy)
@@ -2,7 +2,7 @@
 # $FreeBSD$

 PORTNAME=      docker-freebsd
-PORTVERSION=   20150625
+PORTVERSION=   20150701
```
Now...  In order to apply such a patch you'd need the patch(1) command. The patch itself points to sysutils/docker-freebsd/Makefile but in my example that file sits in the current directory. That's nothing which patch can't handle; we need to strip the first parts of the file entry which can be done using -p (referred to as 'strip count').

We need to strip 2 parts (sysutils/ and docker-freebsd/) so I'll be using this command: `patch -p2 < docker.patch`.

The result is a messy Makefile (not all parts got changed, seems the patch was made based on outdated information) but a fully patched distfile. You can fix this by manually replacing 20150625 in the Makefile with 20150701.

After that you should have all the suggested changes applied. But I obviously can't be sure that they'll also actually work.


----------



## antuan (Jun 14, 2017)

I'll test it


----------



## antuan (Jun 14, 2017)

I had made a mistake but the compilation works


----------



## antuan (Jun 14, 2017)

Compilation and installation were done well. Your help has been very useful to me. Here is the result of `# docker version`

```
Client version: 1.7.0-dev
Client API version: 1.19
Go version (client): go1.6.2
Git commit (client): b1c37d2
OS/Arch (client): freebsd/amd64
Server version: 1.7.0-dev
Server API version: 1.19
Go version (server): go1.6.2
Git commit (server): b1c37d2
OS/Arch (server): freebsd/amd64
```
But the patch has no effect. I wanted to see if `# docker run hello-world` was working correctly but here is the result

```
Unable to find image 'hello-world:latest' locally
latest: Pulling from hello-world
fc882b159a63: Pull complete
f054dc87ed76: Pull complete
Digest: sha256:9a4ec8dac439d00fff31bf41b23902bfd7f7465d4b4c8c950e572e7392f33c66
Status: Downloaded newer image for hello-world:latest
jail: exec /hello: No such file or directory
jail: /hello: failed
```
For centos, I have the same error; On the other hand it works with debian. Where is the error?


----------



## rigoletto@ (Jun 14, 2017)

I do not know anything about Docker, but you may want to take a look on here.


----------



## antuan (Jun 14, 2017)

Thanks, That's where I started


----------



## antuan (Jun 14, 2017)

I just told myself that the title of my post is* Upgrading from 11 Release to 12 Current* and that it deviates on *docker* who took my head for three days. So maybe I'll stop there, Unless someone knows the error.


----------



## rigoletto@ (Jun 14, 2017)

It may take a while. I feel most FreeBSD folks (me included) do not care for Docker, instead uses jails or full virtualization _via_ bhyve. However, you may have more luck at the mailling lists or irc channels.

EDIT: as you said you had the same problem on CentOS, it is quite normal to be reproductive on FreeBSD. Docker works on FreeBSD over the Linuxolator, what uses CentOS binaries.


----------



## antuan (Jun 15, 2017)

Yes, this is all interesting about linuxolator and I will have to think about it seriously. But I don't have the impress that the problem comes from there since I can launch *debian* or for example: *repositoryjp/centos* `# docker run -t -i repositoryjp/centos /bin/bash`. I think this is more of the fact that docker (under freebsd) is at the stage of development and that it does not work at 100%, or it is due to the version used. But I'm not expert enough to say what.
Then the question of jails: I have a server that runs with jails and ezjail to manage all that, and it works like a real diesel. Perhaps need to change the timing belt one every ten years. The good thing about docking is the possibility of being able to serve you or test the distribution that you want without it costing you material resources. And for example on a remote server, I think it's not bad.


----------



## antuan (Jun 16, 2017)

I just watched *full virtualization via bhyve* that I did not know and of course docker becomes irrelevant. Thanks Baron !!!


----------

