# rebuild all installed ports



## ccc (Aug 12, 2009)

hi

I'd like to rebuild all installed packages on my freeBSD 7.2.
Is it:
	
	



```
portmaster -aF
```
 more effective than:
	
	



```
portupgrade -farR
```


----------



## DutchDaemon (Aug 12, 2009)

Both do nothing with your ports tree. See portsnap(8).
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-portsnap.html


----------



## ccc (Aug 12, 2009)

sorry, I mean rebuild the portsystem.


----------



## SirDice (Aug 12, 2009)

Read /usr/ports/UPDATING before you do anything.


----------



## DutchDaemon (Aug 12, 2009)

[cmd=]portmaster -Raf[/cmd] should do fine. To speed things up, you could add flags like -BCd. See portmaster(8) for their meaning. If you currently have any ports with warnings (from portaudit), set DISABLE_VULNERABILITIES=yes in the environment first to prevent the run from aborting when it encounters a port listed as unsafe. And yes, what SirDice said. Handle ports mentioned there separately before you do the entire run.


----------



## xiaoj (Aug 13, 2009)

```
portupgrade -af
```


----------



## fender0107401 (Aug 13, 2009)

1.

```
cd /usr/src
make update
```
2.

```
cd /usr/ports/ports-mgmt/portupgrade
make deinstall
make install clean
```

3.

```
portupgrade -af
```


I think you shold do this, if you upgrade from one release to another.


----------



## nforced (Oct 19, 2016)

How about now?

```
root@daemon:/home/amp # cd /usr/ports/ports-mgmt/portupgrade
root@daemon:/usr/ports/ports-mgmt/portupgrade # make deinstall
make: "/usr/ports/Mk/bsd.port.mk" line 1172: UNAME_r (11.0-RELEASE-p1) and OSVERSION (1003000) do not agree on major version number.

root@daemon:/usr/ports/ports-mgmt/portupgrade # make install clean
make: "/usr/ports/Mk/bsd.port.mk" line 1172: UNAME_r (11.0-RELEASE-p1) and OSVERSION (1003000) do not agree on major version number.
```


```
root@daemon:/usr/ports/ports-mgmt/portupgrade # portmaster -af

===>>> The value of DISTDIR cannot be empty
===>>> Aborting update
```

Looking at https://www.freebsd.org/releases/11.0R/announce.html
I should do

```
Upgrading from FreeBSD 10.3-RELEASE and Earlier
     # : > /usr/bin/bspatch
      # freebsd-update upgrade -r 11.0-RELEASE
      # freebsd-update install
      <reboot the system>
      # freebsd-update install
      <rebuild third-party software>
      # freebsd-update install
```

That's all fine but there are no instructions on how to do *<rebuild third-party software>*  via pkg or portmaster which should be there as these are the two most common cases from what I've see from the couple of years as FreeBSD user.While pkg is more easy to use that doesn't give a "standard" way on how to upgrade ports via unified tool as portmaster. Now many people can jump on me saying "read the manual" so if I understand https://www.freebsd.org/doc/handbook/ports-using.html right all I have to do is

```
If errors are encountered during the upgrade process, add -f to upgrade and rebuild all ports:

# portmaster -af
```

Is this still valid?


----------



## SirDice (Oct 19, 2016)

For pkg(8) after the second run of `freebsd-update install` (when it tells you to update third party software) use this:

```
pkg-static install -f pkg # This re-installs pkg for the new ${ABI} settings
pkg upgrade -f # This will reinstall everything
```

If you want to use portmaster(8) then, yes, the process is still the same.


----------



## jrronimo (Nov 4, 2016)

SirDice said:


> For pkg(8) after the second run of `freebsd-update install` (when it tells you to update third party software) use this:
> 
> ```
> pkg-static install -f pkg # This re-installs pkg for the new ${ABI} settings
> ...



Newbie question, but will doing this rebuild for portmaster or reinstallation for pkg of 3rd party software affect any config files I've modified? I'm going through the 10.3 -> 11.0 process right now and that's my next step.


----------



## SirDice (Nov 4, 2016)

No, packages (or ports) never overwrite existing configuration files. So your changes should be safe regardless of how many times you install or uninstall a package or port.


----------

