# May I please, please cancel/abort "portupgrade -a"?



## reallytrying (Aug 26, 2011)

I screwed up.

I've been trying to upgrade some things on the server for PCI compliance, when I went to upgrade PHP something didn't go quite right, and I've had to add some extensions manually since then, as we notice errors popping up here and there. Where every other extension has been fine, today tried to add php5-zip and ran into problems.

Somewhat out of frustration and somewhat to just try another route to get it to work, I:


```
portupgrade -a
```

So yeah, that's supposed to upgrade everything, that should work!

After things started breaking (all the sites on the box, just because turns out mysql had stopped), some quick research turned up how much how much of a complete FreeBSD idiot I am. I'm mostly just a web developer who uses search engines to usually get by okay with some other things.

So the sites are back up, but portupgrade is still running, and if I understand correctly, this could go on for eternity.

I am worried that:

1) If I CTRL+C to try to cancel it, things will break
2) There is a hurricane coming soon and would like to leave work early to get out of town for a couple days
3) If I just let it run and leave work early, things will break
4) Haven't slept a wink, and I will find another way to make things break

I just realized that it pauses waiting for user input periodically -- can I let it sit at one of those screens and get back to this when I can really keep an eye on the sites, or otherwise "safely" CTRL+C from one of those screens? :r


----------



## wblock@ (Aug 26, 2011)

ssh(1) means you don't have to sit in the path of a hurricane.

-a can be a problem.  It will try to upgrade everything that needs upgrading.  If it's been a long time since the last upgrade, the chances of something that needs manual steps increase (see /usr/ports/UPDATING before updating, every time).  The chances of an individual upgrade failing increase, also.

ports-mgmt/portmaster is the new hotness, which automates many things that portupgrade does not do by default.  Like showing all options screens before starting the build; that can be done with portupgrade's -c or -C options.

Many services are stopped but not restarted when the port is deinstalled (as part of the upgrade, in this case).  They aren't started automatically when a port is installed or reinstalled.


----------



## UNIXgod (Aug 26, 2011)

reallytrying said:
			
		

> 1) If I CTRL+C to try to cancel it, things will break
> 2) There is a hurricane coming soon and would like to leave work early to get out of town for a couple days
> 3) If I just let it run and leave work early, things will break
> 4) Haven't slept a wink, and I will find another way to make things break



I'd like to restate what wblock said on the importance of reading /usr/ports/UPDATING FIRST before running port(upgrade|master)

To answer your questions in order:

1) CTRL+C won't break anything in portupgrade as long as it's not updating the database. So just make sure it's in the middle of the build.

2) For your safety I would suggest not worrying and go out of town as planned. Life is too short to put yourself at risk for such things as upgrading port versions. Be safe my friend and put yourself and your family above everything else.

3) If you use a third party utility like tmux or gnu/screen you can leave the computer and log into it remotely off of ssh. If there is an issue you can diagnose it and fix it remotely. If you have read UPDATING you should have little issues.

4) Go to sleep. You figured out that the mysql daemon does not restart itself after upgrade. This may be because in some cases you may need to dump the old version db and repopulate the new version db. I don't believe you need to do that with patch releases though. This may be a perfect case to upgrade a single port that needs attention over just running the -a switch.

Good luck =)


----------



## kpedersen (Aug 27, 2011)




----------



## reallytrying (Aug 31, 2011)

Guys, thanks so much! And LOL!! at that image!

This has been an interesting past few days, to say the least...

I've definitely perused /usr/ports/UPDATING before, with it being a common first suggestion in the forum 

Turned out that OSX entirely froze during one of the user input screens, so ended up shutting down and skipping town -- thanks for the concern, the hurricane situation actually ended up being one of the easier things to handle this past weekend..

Thanks for the tips about portmaster and good to know about CTRL+C safety!

This looks like the relevant section of UPDATING:


```
Portupgrade users:

        pkg_delete -f php5-pcre-5.2.6
        pkgdb -F
        portupgrade as usual

  Portmaster users:

        pkg_delete -f php5-pcre\*
        portmaster php5

  If you are using pecl ports you might need to force an update on them:

        portupgrade -f pecl\*
  or
        portmaster pecl

  If you have the pecl hash, json and/or zip extensions you need to replace
  them with the PHP5 bundled ones, e.g.:

        portmaster/portupgrade -o archivers/php5-zip archivers/pecl-zip
        portmaster/portupgrade -o devel/php5-json devel/pecl-json
        portmaster/portupgrade -o security/php5-hash security/pecl-hash
```

But nothing I try, and have tried a lot of things, is working...


```
/usr/ports/archivers/php5-zip# make install clean
```

Chokes here:


```
/usr/ports/archivers/php5-zip/work/php-5.3.8/ext/zip/php_zip.c:30:31: error: ext/pcre/php_pcre.h: No such file or directory
/usr/ports/archivers/php5-zip/work/php-5.3.8/ext/zip/php_zip.c: In function 'php_zip_pcre':
/usr/ports/archivers/php5-zip/work/php-5.3.8/ext/zip/php_zip.c:663: error: 'pcre' undeclared (first use in this function)
/usr/ports/archivers/php5-zip/work/php-5.3.8/ext/zip/php_zip.c:663: error: (Each undeclared identifier is reported only once
/usr/ports/archivers/php5-zip/work/php-5.3.8/ext/zip/php_zip.c:663: error: for each function it appears in.)
/usr/ports/archivers/php5-zip/work/php-5.3.8/ext/zip/php_zip.c:663: error: 're' undeclared (first use in this function)
/usr/ports/archivers/php5-zip/work/php-5.3.8/ext/zip/php_zip.c:664: error: 'pcre_extra' undeclared (first use in this function)
```

I've read things about "pcre" being included with the latest version of PHP and that being some part of the issue, but I'm running out of ideas.. I don't want to lose the configuration (and certainly not take the sites down for too long) if I uninstall and reinstall PHP and/or Apache which also needs upgrading, and am not even aware of a good route to go about uninstalling/reinstalling it.. I've only done the upgrades, which has worked fine on two other machines of similar configurations...


----------



## reallytrying (Sep 6, 2011)

As an update, I still don't know what to do about this :-( Still nothing I've tried has worked.

Another update is that I'm finally leaving this situation, and it's been rocky, but might be a nice going away present to have it resolved


----------



## jb_fvwm2 (Sep 7, 2011)

```
#something to try
portmaster -d -B -i /var/db/pkg/... /var/db/pkg...
```
Sometimes I also pkg_delete some of them before that... that command might even serve whoever subsequently maintains the server(s) (After backups of course... and/or neglecting the"-B") ...


----------



## wblock@ (Sep 7, 2011)

I wish I knew something specific to suggest.  Unfortunately I don't use PHP.  The shotgun approach is to throw the automatic checkers at it, like
`# portmaster --check-depends`
`# portmaster --check-port-dbdir`
`# pkg_libchk`
Those are from ports-mgmt/portmaster and sysutils/bsdadminscripts.


----------



## reallytrying (Sep 8, 2011)

Thanks so much! I think that a combination of these things helped a lot!

Ran

```
# portmaster --check-depends
# portmaster --check-port-dbdir
```

And that seemed to indicate that it was doing something good about pecl. Also tried portsnap fetch and update and extract in there somewhere, and at some point the /usr/ports/archivers/php5-zip contents got cleared out entirely...  Then, since for some reason php5-zip wasn't in /var/db/pkg/, was able to copy the directory over from one of the working machines, and did the portmaster -d -B -i /var/db/pkg/... /var/db/pkg..... php5-zip seems to be working now!!


----------

