# Little help with updating ports



## churchi (May 9, 2012)

Hi *a*ll,

Well, *I* have hit some issues today when upgrading my system and performing maintenance. It seems *I* can't upgrade any ports at the moment.

When *I* show the package version of the ports *I* am getting errors as well.


```
[root@server-01 /usr/ports/packages/devel]# pkg_version -v
OpenSP-1.5.2_2                      =   up-to-date with port
WWWdb-0.8.3                         =   up-to-date with port
adobe-cmaps-20051217_1              =   up-to-date with port
adodb-5.15                          =   up-to-date with port
apache-2.2.22_5                     =   up-to-date with port
apr-ipv6-devrandom-gdbm-db42-1.4.5.1.3.12_1  =   up-to-date with port
aspell-0.60.6.1_1                   =   up-to-date with port
autoconf-2.68                       =   up-to-date with port
autoconf-wrapper-20101119           =   up-to-date with port
automake-1.11.1                     =   up-to-date with port
automake-wrapper-20101119           =   up-to-date with port
pkg_version: the package info for package 'bash-4.2.24' is corrupt
bsdstats-5.5_2                      =   up-to-date with port
ca_root_nss-3.13.4                  =   up-to-date with port
pkg_version: the package info for package 'cacti-0.8.7i' is corrupt
cairo-1.10.2_3,1                    =   up-to-date with port
cclient-2007f,1                     =   up-to-date with port
cm-super-0.3.4_3                    =   up-to-date with port
pkg_version: the package info for package 'cmake-2.8.7' is corrupt
dvipdfmx-20100328                   =   up-to-date with port
dvipsk-tetex-5.95a_5                =   up-to-date with port
en-freebsd-doc-20120308             <   needs updating (index has 20120506)
encodings-1.0.4,1                   =   up-to-date with port
html2text-1.3.2a                    =   up-to-date with port
iftop-0.17                          =   up-to-date with port
imlib2-1.4.5,2                      <   needs updating (port has 1.4.5_1,2)
inputproto-2.0.2                    =   up-to-date with port
latex-cjk-4.8.2_5                   =   up-to-date with port
libGL-7.4.4                         <   needs updating (port has 7.6.1)
libGLU-7.4.4                        <   needs updating (port has 7.6.1)
libX11-1.4.4,1                      =   up-to-date with port
libXau-1.0.6                        =   up-to-date with port
libXaw-1.0.8,2                      <   needs updating (index has 1.0.9,2)
libXdamage-1.1.3                    =   up-to-date with port
libXpm-3.5.9                        =   up-to-date with port
libXrender-0.9.6                    =   up-to-date with port
libXt-1.0.9,1                       <   needs updating (port has 1.1.1,1)
libXxf86vm-1.1.1                    =   up-to-date with port
libcheck-0.9.8                      =   up-to-date with port
libdrm-2.4.12_1                     <   needs updating (port has 2.4.17_1)
nasm-2.09.10,1                      =   up-to-date with port
neon29-0.29.6_4                     =   up-to-date with port
pkg_version: the package info for package 'net-snmp-5.7.1_6' is corrupt
netpbm-10.35.84                     =   up-to-date with port
openjade-1.3.3p1_2                  =   up-to-date with port
pkg_version: the package info for package 'openldap-client-2.4.30' is corrupt
openvpn-2.2.2                       =   up-to-date with port
orc-0.4.16                          =   up-to-date with port
p11-kit-0.11                        =   up-to-date with port
p5-Authen-PAM-0.16_1                =   up-to-date with port
p5-Net-SSLeay-1.47                  <   needs updating (port has 1.48)
pkg_version: the package info for package 'pcre-8.30_1' is corrupt
pdflib-7.0.5                        =   up-to-date with port
pecl-fileinfo-1.0.4                 =   up-to-date with port
pecl-pdflib-2.1.8_1                 =   up-to-date with port
peps-2.0_4                          =   up-to-date with port
perl-5.10.1_7                       =   up-to-date with port
php5-5.3.10_1                       <   needs updating (port has 5.3.11)
php5-bz2-5.3.10_1                   <   needs updating (port has 5.3.11)
php5-ctype-5.3.10_1                 <   needs updating (port has 5.3.11)
php5-dom-5.3.10_1                   <   needs updating (port has 5.3.11)
php5-exif-5.3.10_1                  <   needs updating (port has 5.3.11)
php5-extensions-1.6                 =   up-to-date with port
php5-fileinfo-5.3.10_1              <   needs updating (port has 5.3.11)
php5-filter-5.3.10_1                <   needs updating (port has 5.3.11)
php5-ftp-5.3.10_1                   <   needs updating (port has 5.3.11)
php5-gd-5.3.10_1                    <   needs updating (port has 5.3.11)
php5-hash-5.3.10_1                  <   needs updating (port has 5.3.11)
php5-iconv-5.3.10_1                 <   needs updating (port has 5.3.11)
php5-imap-5.3.10_1                  <   needs updating (port has 5.3.11)
php5-json-5.3.10_1                  <   needs updating (port has 5.3.11)
php5-ldap-5.3.10_1                  <   needs updating (port has 5.3.11)
php5-mcrypt-5.3.10_1                <   needs updating (port has 5.3.11)
php5-mssql-5.3.10_1                 <   needs updating (port has 5.3.11)
php5-mysql-5.3.10_1                 <   needs updating (port has 5.3.11)
php5-odbc-5.3.10_1                  <   needs updating (port has 5.3.11)
php5-openssl-5.3.10_1               <   needs updating (port has 5.3.11)
php5-pdo-5.3.10_1                   <   needs updating (port has 5.3.11)
php5-pdo_sqlite-5.3.10_1            <   needs updating (port has 5.3.11)
php5-phar-5.3.10_1                  <   needs updating (port has 5.3.11)
php5-posix-5.3.10_1                 <   needs updating (port has 5.3.11)
php5-pspell-5.3.10_1                <   needs updating (port has 5.3.11)
php5-recode-5.3.10_1                <   needs updating (port has 5.3.11)
php5-session-5.3.10_1               <   needs updating (port has 5.3.11)
php5-simplexml-5.3.10_1             <   needs updating (port has 5.3.11)
php5-snmp-5.3.10_1                  <   needs updating (port has 5.3.11)
php5-soap-5.3.10_1                  <   needs updating (port has 5.3.11)
php5-sockets-5.3.10_1               <   needs updating (port has 5.3.11)
php5-sqlite-5.3.10_1                <   needs updating (port has 5.3.11)
php5-sqlite3-5.3.10_1               <   needs updating (port has 5.3.11)
php5-tokenizer-5.3.10_1             <   needs updating (port has 5.3.11)
php5-xml-5.3.10_1                   <   needs updating (port has 5.3.11)
php5-xmlreader-5.3.10_1             <   needs updating (port has 5.3.11)
php5-xmlwriter-5.3.10_1             <   needs updating (port has 5.3.11)
php5-zip-5.3.10_1                   <   needs updating (port has 5.3.11)
php5-zlib-5.3.10_1                  <   needs updating (port has 5.3.11)
pixman-0.24.2                       =   up-to-date with port
pkg-config-0.25_1                   =   up-to-date with port
pkg_cutleaves-20090810              =   up-to-date with port
pkg_tree-1.1_2                      =   up-to-date with port
png-1.4.11                          =   up-to-date with port
popt-1.16                           =   up-to-date with port
portaudit-0.6.0                     =   up-to-date with port
portdowngrade-0.6_2                 =   up-to-date with port
portmanager-0.4.1_9                 =   up-to-date with port
portmaster-3.11                     =   up-to-date with port
pkg_version: the package info for package 'portupgrade-2.4.9.3_1,2' is corrupt
pkg_version: the package info for package 'postfix-2.9.1,1' is corrupt
printproto-1.0.5                    =   up-to-date with port
python26-2.6.8                      =   up-to-date with port
recode-3.6_8                        =   up-to-date with port
renderproto-0.11.1                  =   up-to-date with port
pkg_version: the package info for package 'rrdtool-1.4.5' is corrupt
rsync-3.0.9                         =   up-to-date with port
ruby-1.8.7.358,1                    =   up-to-date with port
ruby18-bdb-0.6.6                    =   up-to-date with port
pkg_version: the package info for package 'samba34-3.4.16_1' is corrupt
schroedinger-1.0.11                 =   up-to-date with port
t1utils-1.32                        =   up-to-date with port
taglib-1.7.1                        <   needs updating (port has 1.7.2)
unixODBC-2.3.1                      =   up-to-date with port
pkg_version: the package info for package 'unrar-4.10_1,5' is corrupt
xcb-proto-1.6                       <   needs updating (port has 1.7.1)
[root@server-01 /usr/ports/packages/devel]#
```

I have been using the /portupdater.sh for ages and it has not failed me. *H*owever *I* have some issues when *I* am trying to upgrade some ports today.

When *I* try and upgrade a port this is what *I* am getting:

```
[root@server-01 /usr/home/churchi]# portmaster en-freebsd-doc-20120308

===>>> Currently installed version: en-freebsd-doc-20120308
===>>> Port directory: /usr/ports/misc/freebsd-doc-en

egrep: Makefile: No such file or directory
===>>> Gathering distinfo list for installed ports

grep: Makefile: No such file or directory
make: don't know how to make config-conditional. Stop
===>>> Gathering dependency list for misc/freebsd-doc-en from ports
make: don't know how to make build-depends-list. Stop
===>>> No dependencies for misc/freebsd-doc-en

===>>> Starting build for misc/freebsd-doc-en <<<===

===>>> All dependencies are up to date

make: don't know how to make clean. Stop

===>>> make clean failed
===>>> Aborting update

Terminated
Terminated

===>>> You can restart from the point of failure with this command line:
       portmaster <flags> misc/freebsd-doc-en 

[root@server-01 /usr/home/churchi]#
```

Just wondering if someone could give me a quick hand to fix up some of these issues please?

Thank you.


----------



## churchi (May 9, 2012)

Here are some more captures


```
[root@server-01 /usr/home/churchi]# portmaster -L
===>>> Root ports (No dependencies, not depended on)
===>>> bash-4.2.24
        ===>>> No ORIGIN in /var/db/pkg/bash-4.2.24/+CONTENTS

===>>> bigreqsproto-1.1.1
===>>> binutils-2.22_1
===>>> bsdstats-5.5_2
===>>> cacti-0.8.7i
        ===>>> No ORIGIN in /var/db/pkg/cacti-0.8.7i/+CONTENTS

===>>> cmake-2.8.7
        ===>>> No ORIGIN in /var/db/pkg/cmake-2.8.7/+CONTENTS

===>>> en-freebsd-doc-20120308

===>>> Is /usr/ports/misc/freebsd-doc-en/Makefile missing?
===>>> Aborting update

Terminated
[root@server-01 /usr/home/churchi]#
```


----------



## SirDice (May 9, 2012)

Since it's currently quite messy, and you have a lot of ports to update, it might be easier to simply *pkg_delete -a* the whole lot and start over.


----------



## churchi (May 9, 2012)

Ok. So should *I* just fix up the *make package* issues first? *W*ould *I* *pkg_delete* it and *pkg_add* it back in? Would that fix up the cmake package issue?

*F*rom there maybe *I* can force a rebuild of the packages that are broken.

*D*o you think this would work?

*T*hanks.


----------



## SirDice (May 9, 2012)

It might work but it's going to take a lot of tinkering. That's why I suggested removing everything and starting over. It's usually quicker.


----------



## churchi (May 9, 2012)

*S*o all the ones in the list that *I* had issues with on the first post *I* should *pkg_delete -a* them all and *pkg_add* them back?

*S*orry for all the basic questions. *J*ust need to know as *I'd* like to do it properly first time.


----------



## SirDice (May 9, 2012)

`# pkg_delete -a` will delete _all_ installed packages.

See pkg_delete(1).


----------



## churchi (May 9, 2012)

*R*ight. *S*o is there not any other way *I* can repair the broken packages without re-installing all the ports?


----------



## SirDice (May 9, 2012)

Yes, with a lot of tinkering. You can try removing the corrupted packages and then try updating the other ports. Any missing dependencies would get installed again.


----------



## churchi (May 9, 2012)

*W*ould you be able to give me a few commands *I* can run to remove the broken packages and renstall them please?

*W*ould it help to rebuild (not uninstall) all the ports on my system?


----------



## SirDice (May 9, 2012)

churchi said:
			
		

> would you be able to give me a few commands i can run to remove the broken packages and re install them please?


pkg_delete(1) and pkg_add(1).



> would it help to rebuild (not uninstall) all the ports on my system?


If you're going to do that you might aswell remove them all.


----------



## churchi (May 9, 2012)

Thanks for the advice there.

So if *I* *pkg_delete* them all do *I* have to manually re-add them again to the system? Would *I* use just portmaster or so to add them again?

If *I* *pkg_delete* them, will *I* lose all my settings and configuration files?

Alternatively, could *I* just try and upgrade from 8.1 to say 8.2 and it may fix up the package issues?


----------



## bbzz (May 9, 2012)

Upgrade to 8.2 won't fix that.
You could try something like this (as root):


```
portmaster --list-origins > /root/pkglist
pkg_delete -a
rm -r /usr/local /var/db/pkg
cd /usr/ports/*/portmaster && make install clean
rehash
cat /root/pkglist | xargs portmaster --no-confirm -P -m 'BATCH=yes' -y
```

Note this will make list of all installed packages, delete them all, and reinstall by fetching either packages or building from ports if there isn't up-to-date package available.


----------



## churchi (May 9, 2012)

Thank you bbzz,

So will my configuration files be saved when removing the ports and re adding them like you have suggested in the previous post?


----------



## jef (May 10, 2012)

I consider it always a good idea to back up before anything extreme. At the very least, I'd *tar* up /usr/local/etc so that your locally-configured changes are still accessible. Some packages will overwrite the old configuration.


----------



## bbzz (May 10, 2012)

churchi said:
			
		

> Thank you bbzz,
> 
> So will my configuration files be saved when removing the ports and re adding them like you have suggested in the previous post?



*pkg_delete -a* will delete ports but will not remove your configuration files (they might get overwritten after you reinstall, however). Save any configuration file you have in /usr/local, if you are completely removing that directory, or in any case do a backup.


----------



## chrcol (May 10, 2012)

In my experience removing ports usually keeps config files intact meaning after reinstallation you shouldn*'*t need to reconfigure, however I would still follow what jef said.


----------



## churchi (May 14, 2012)

Hi all,

First off thank you for all the help so far, I am going to give this a crack this week.

So here is how I am going to tackle this problem.

Tar up the following directory /usr/local/
Is there any other directories that I should be backing up as well?

Next I will perform the following set of commands to remove all the packages from my system and re install them all from the list that was generated.


```
portmaster --list-origins > /root/pkglist
pkg_delete -a
rm -r /usr/local /var/db/pkg
cd /usr/ports/*/portmaster && make install clean
rehash
cat /root/pkglist | xargs portmaster --no-confirm -P -m 'BATCH=yes' -y
```

Do I need to remove the /usr/local directory after I use the *pkg_delete -a* command? Or is this necessary to fix up the issues I have?
Will my MYSQL databases be removed in the above process?
Reboot the system into the new environment and hopefully everything will be back ok.
Is there anything else I can do here to make sure this process will go smoothly?
I have a ZFS storage set up on this machine as well. Will there be any issues with this when I remove all the packages on the system?

Chrcol, when you have done this in the past, did you remove the /usr/local directory as well or just use the *pkg_delete -a* command?

Thank you.


----------



## egelor (May 14, 2012)

*I*s it possible that portsnap update or sysinstall help?


----------



## churchi (May 14, 2012)

Hi egelor, would you mind explaining that a little further please?

*Portsnap* currently works.

```
[root@server-01 /var/db/ports/cmake]# portsnap fetch
Looking up portsnap.FreeBSD.org mirrors... none found.
Fetching snapshot tag from portsnap.FreeBSD.org... done.
Fetching snapshot metadata... done.
Updating from Sun May 13 16:14:53 EST 2012 to Tue May 15 07:55:27 EST 2012.
Fetching 4 metadata patches... done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 109 patches.....10....20....30....40....50....60....70....80....90....100.... done.
Applying patches... done.
Fetching 10 new ports or files... done.
```

I have also noticed that the FreeBSD 8.1 ports url is not there any more.


```
[root@server-01 /var/db/ports/cmake]# pkg_add -r cmake
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.1-release/Latest/cmake.tbz: File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.1-release/Latest/cmake.tbz' by URL
[root@server-01 /var/db/ports/cmake]# pkg_add -r rrdtool
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.1-release/Latest/rrdtool.tbz: File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.1-release/Latest/rrdtool.tbz' by URL
```

When I login via the web to the URL: ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/ as you can see there is now no packages-8.1-release any more.

So since my server is on 8.1-RELEASE FreeBSD 8.1-RELEASE, and since the packages-8.1-release is now not on the FreeBSD FTP server, would it be the best way to try and upgrade to packages-8.2-release or packages-8.3-release so that I am able to at least have access to the patches that are being released for the FreeBSD 8.x branch? As currently it seems that for my release there is no access to patches.


----------



## SirDice (May 15, 2012)

Don't use the -release packages at all. They are exactly the same packages as on the installation media and they are NEVER updated.

Set PACKAGESITE to ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/


----------



## churchi (May 15, 2012)

Thank you SirDice, that fixed the *pkg_add* command.

Any thoughts on the proposal I posted above to help fix up my broken system?


----------



## jotawski (May 15, 2012)

Hi,

From your first post,  I used to have a few experiences on that too, http://makham.blogspot.com/2012/02/freebsd-system-administrators-tasks.html.  At that time, I *grep ^pkg* all of output from *pkg_info* and redirect to temporary file.

Simply deleted those packages in that temp. file and re-installing them back will solve those corrupt packages.  Apologize for my late posting.


----------



## bbzz (May 15, 2012)

churchi said:
			
		

> Thank you SirDice, that fixed the *pkg_add* command.
> 
> Any thoughts on the proposal I posted above to help fix up my broken system?




Above recipe will do the job. Save individual configuration files frorm /usr/local, then do what I posted, then copy back configuration files.


----------

