# upgrading 9.3 - ports, perl



## netaccs (Feb 6, 2018)

Hello.

Have some issue after upgrading the FreeBSD.
Here is a little story.
FreeBSD 9.3 amd64.  Using
portsnap fetch, portsnap extract and portsnap update to keep my ports up to date.
After doing that and trying to install any package from ports got this error:


```
"/usr/ports/Mk/bsd.port.mk", line 1043: Unknown directive Unknown modifier 't' Variable .CURDIR is recursive.
```

So I decided to upgrade the OS. Using this guide upgrade the OS to 10.3. After done that few have issue when trying to install few ports.
For example, when trying to install samba, this error output:
===>  samba47-4.7.4_1 Invalid perl5 version 5.18.

What I should do and should I perform update to 11.1 first ?

Thanks in advance !


----------



## tingo (Feb 6, 2018)

Everytime you upgrade FreeBSD from a major version to another (in other words 9.x > 10.x, or 10.x > 11.x) you must reinstall all ports. 
Doing this with tools for upgrading ports is very time consuming, more time consuming than installing all ports from scratch.
IMHO, it is better to get a listing of all ports installed before the upgrade, then remove all installed ports and install ports from scratch after the upgrade.
Also, it is smart to check that all ports you need are still present in the ports tree before doing the upgrade. You can use FreshPorts.org for this.


----------



## SirDice (Feb 7, 2018)

Yep, after a major version upgrade you need to reinstall all ports/packages. So make sure you run these commands:

```
pkg-static install -f pkg  # Updates pkg for your version
pkg upgrade -f  # Reinstalls all packages
```


----------



## netaccs (Feb 7, 2018)

I prefer to not perform updating OS, but cannot fix problem with ports on 9.3.
I see that if I have change to make fresh install on new pc and configure it from beginning ? 

Now I see that there is no samba3x in ports only samba4x, which I cannot install


```
pkg-static: samba47-4.7.4_1 conflicts with samba36-libsmbclient-3.6.24_2 (installs files into the same place)   .  Problematic file: /usr/local/libdata/pkgconfig/smbclient.pc
*** Error code 70
Stop.
make[1]: stopped in /usr/ports/net/samba47
*** Error code 1
```

I will try upgrade to 11.1 now and see what can I do about it.


Thanks for pkg commands.


----------



## SirDice (Feb 7, 2018)

netaccs said:


> I prefer to not perform updating OS, but cannot fix problem with ports on 9.3.


The reason it's not working is because FreeBSD 9.3 is End-of-Life since December 2016 and is not supported any more.

https://www.freebsd.org/security/unsupported.html



> Now I see that there is no samba3x in ports only samba4x, which I cannot install


Samba 3.6 (the last of the 3.x series) has been End-of-Life since March 2015.


----------



## netaccs (Feb 7, 2018)

So I have to uninstall samba36 somehow. Cannot do it using ports, cause there no samba3x ports.
Are there any way to remove it ?


----------



## SirDice (Feb 7, 2018)

`pkg delete samba36` and you probably also want to run `pkg autoremove` after that.


----------



## netaccs (Feb 7, 2018)

pkg delete samba36

```
No packages matched for pattern 'samba36'
```
Anyway, I upgrade to 11.1 now I can "make" packet from ports.

I know that isn't for the right topic, but can you help with this error ?

```
default/examples/libsmbclient/testnotify_13.o: In function `main':
/usr/ports/net/samba47/work/samba-4.7.4/bin/../examples/libsmbclient/testnotify.c:66: undefined reference to `smbc_notify'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Waf: Leaving directory `/usr/ports/net/samba47/work/samba-4.7.4/bin'
Build failed:  -> task failed (err #1):
        {task: cc_link testnotify_13.o -> testnotify}
  File "buildtools/bin/waf", line 76, in <module>
        Scripting.prepare(t, cwd, VERSION, wafdir)
  File "/usr/ports/net/samba47/work/samba-4.7.4/third_party/waf/wafadmin/Scripting.py", line 147, in prepare
        error(str(e))
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/net/samba47
*** Error code 1
```


----------



## ShelLuser (Feb 7, 2018)

How did you upgrade your other ports? If you installed binaries (by using `pkg upgrade`) then you might not want to install Samba from ports. Instead of building it yourself grab it from the repository too (using `pkg install`).

Generally speaking it's not a good idea to mix ports and packages.


----------



## netaccs (Feb 8, 2018)

Ports was updated using portsnap.  Than use this:

```
pkg-static install -f pkg  # Updates pkg for your version
pkg upgrade -f  # Reinstalls all packages
```
I install samba using pkg install, instead of making in ports.


ShelLuser said:


> Generally speaking it's not a good idea to mix ports and packages.


What is the difference between make in ports and pkg ?
When using make there options what mods to install. Example for samba - ad, cups support and etc.
When using pkg, there is no that kind of install guide.


----------



## ldgc (Feb 8, 2018)

Hi netaccs 
To better understand the difference between ports and packages, I suggest you to read https://www.freebsd.org/doc/handbook/ports-overview.html and Thread [Guide] About ports and (binary) packages.62126


----------



## netaccs (Feb 8, 2018)

Thanks for the guide and helping me

Let says that there two ways to manage applications.

One is using pkg. 
For example "pkg install samba","pkg upgrade samba" and other pkg commands.
If I use this method, than package comes to my machine compiled and I cannot "add futures"
like adding active directory, cups, vfs object and other "mods" of the package.

Another way is using "make" from ports.
For example going to "/usr/ports/net/samba47/" and type "make".
Than it will compile package with parameters/futures  that I choose - active directory, cups, vfs and others.

If I want to update ports, I type
portsnap fetch, portsnap extract and finally portsnap fetch update

But I cannot update packages, while using pkg, they are already compiled right?
As I understand pkg is keeping it repository up to date somehow, not like ports.

For example using pkg for package editor/nano is version 2.9.1, but in ports is 2.9.2.
So If I want to use 2.9.2 I have to make it from ports (should I uninstall it first with pkg?)

Is all that true ?

Thanks in advance !


----------



## ldgc (Feb 8, 2018)

netaccs said:


> One is using pkg.
> For example "pkg install samba","pkg upgrade samba" and other pkg commands.
> If I use this method, than package comes to my machine compiled and I cannot "add futures"
> like adding active directory, cups, vfs object and other "mods" of the package.


It is correct.



netaccs said:


> Another way is using "make" from ports.
> For example going to "/usr/ports/net/samba47/" and type "make".
> Than it will compile package with parameters/futures that I choose - active directory, cups, vfs and others.


It is correct. One suggestion: instead of just running `make`, you can compile, install and remove the directory called work altogether by running
`make install clean`.



netaccs said:


> If I want to update ports, I type
> portsnap fetch, portsnap extract and finally portsnap fetch update


portsnap does not update installed ports, what it does is update the Ports Collection tree. Also `portsnap extract` is only necessary when portsnap is used for the first time, after that just run `portsnap fetch` and `portsnap update` or `portsnap fetch update`.
To upgrade installed ports, please read section 4.5.3 of https://www.freebsd.org/doc/handbook/ports-using.html



netaccs said:


> But I cannot update packages, while using pkg, they are already compiled right?


It is not true, you can update binary packages repository with `pkg update` and upgrade installed binary packages with `pkg upgrade`.



netaccs said:


> As I understand pkg is keeping it repository up to date somehow, not like ports.


It is not true. Ports has the Ports Collection while pkg has its own repository and a binary package can only be created when its port is available.



netaccs said:


> For example using pkg for package editor/nano is version 2.9.1, but in ports is 2.9.2.


It is true if you are using the default quarterly branch of pkg repository. pkg repository has two branches: quarterly and latest.
The first is for extended support and the second is for the latest version. For example, editors/nano version with pkg repository set to latest is 2.9.2, which is the same version of its port version.


----------



## netaccs (Feb 13, 2018)

Thanks for explanation.
Just giving example.

```
pkg info nano
nano-2.9.1
```


```
pkg  update
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01
Fetching packagesite.txz: 100%    6 MiB   2.1MB/s    00:03
Processing entries: 100%
FreeBSD repository update completed. 28778 packages processed.
All repositories are up to date.
```


```
pkg info nano
nano-2.9.1
```
While

```
portsnap fetch update
```


```
cat /usr/ports/editors/nano/distinfo
TIMESTAMP = 1518396864
SHA256 (nano-2.9.3.tar.gz)
```


----------



## netaccs (Mar 7, 2018)

I use this topic instead opening new one.
I try to make update from 9.0 stable to 11.1
First I update to 9.3 Release. Now I am trying to 10.3, cause when trying directly to 11.1 there were some error.

```
uname -a
FreeBSD inv 10.1-RELEASE-p41 FreeBSD 10.1-RELEASE-p41 #0: Fri Oct 21 23:03:01 UTC 2016     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```
May be I miss or mess something, but now I have many files look like

```
cat /etc/shells
<<<<<<< current version
# $FreeBSD: stable/9/etc/shells 59717 2000-04-27 21:58:46Z ache $
=======
# $FreeBSD: releng/10.1/etc/shells 59717 2000-04-27 21:58:46Z ache $
>>>>>>> 10.1-RELEASE
#
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/sh
/bin/csh
/bin/tcsh
/usr/sbin/nologin
```

Also running this 
	
	



```
freebsd-update fetch
/usr/sbin/freebsd-update: config_<<<<<<<: not found
Error processing configuration file, line 1:
==> <<<<<<< current version
```
First line of file is /usr/sbin/freebsd-update: config
*#!/bin/sh*

Can I fix all of them automatically ?


----------



## SirDice (Mar 7, 2018)

netaccs said:


> First I update to 9.3 Release.


Make sure you're on 9.3-RELEASE-p45 or a higher patch level. The bug that will prevent the upgrade to 11.x was fixed with 9.3-RELEASE-p45.



netaccs said:


> Can I fix all of them automatically ?


Nope, the reason you're seeing those is because the automatic merge failed. So you'll have to fix those by hand.


----------



## netaccs (Mar 8, 2018)

I fix the files manually.  Then upgrade to 10.3 then to 11.1 Release-p7.
Thanks for helping.

Can I remove these files
	
	



```
2.1G    /var/db/freebsd-update/files
```

Also, what could be the reason of 

```
/usr/local/etc/rc.d/postgresql start
Shared object "libpq.so.5" not found, required by "pg_ctl"
```
and in any /usr/ports/

```
make
make: "/usr/ports/Mk/bsd.port.mk" line 1316: Cannot open /usr/ports/Mk/bsd.sanity.mk
make: "/usr/ports/Mk/bsd.port.mk" line 1765: Cannot open /usr/ports/Mk/bsd.ssp.mk
make: "/usr/ports/Mk/bsd.port.mk" line 2242: Cannot open /usr/ports/Mk/bsd.licenses.mk
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/ports/editors/nano
```


----------



## SirDice (Mar 8, 2018)

netaccs said:


> Can I remove these files


When the upgrade is finished and completely done, yes. Before I start a major update I usually clear out /var/db/freebsd-update/*. So there won't be any stale files left that could potentially cause problems and I start with a "fresh" download of the patches.


> ```
> /usr/local/etc/rc.d/postgresql start
> Shared object "libpq.so.5" not found, required by "pg_ctl"
> ```


This looks like a failed or missed upgrade of Postgres, on my system:

```
dice@wintermute:~ % pkg which /usr/local/lib/libpq.so.5
/usr/local/lib/libpq.so.5 was installed by package postgresql96-client-9.6.8
```
Check yours and reinstall the client if necessary. 



> and in any /usr/ports/


Those look like errors in the ports tree itself. Just remove the whole tree and checkout a fresh one.

```
rm -rf /usr/ports/*
portsnap fetch extract
```


----------



## netaccs (Mar 8, 2018)

Cleaned up  /var/db/freebsd-update/*
Reinstall postgresql96-client-9.6.8
Reinstall ports 
Thanks !


----------

