# How to upgrade ports and all apps



## neilms (Jul 11, 2010)

There seems to be something really wrong with my system. I have tried portsnap fetch extract, portsupgrade -R -F emacs, cvusup etc but my ports are not properly uptodate because there are certain packs like firefox, emacs, that i cant build.

To be honest with you, i am 100% confused now with all of these diferrent methods for updating ports.

My questions:

1. Which is the easiest way to update my ports? Is it possible to do it with a simple gui?
2. what is the command (eg portsnap -a?) to update the entire ports collection?


----------



## jb_fvwm2 (Jul 11, 2010)

The way I usually upgrade changes slightly every few
weeks.
Currently:
cvsup every day or so.
csup daily (individual ports or categories)
(the commands saved across reboots so I don't have to
retype...)
....
portmaster ( -d p5-port p5-port OR -d category/port category/port) 
...
OR
a custom .zsh which incorporates native bsd commands.
Some ports won't build with that zsh, so 

```
cd /usr/ports/category/port
/bin/rm -rf work
pkg_delete -f /var/db/pkg/port-number && make install
```
then gather errors to fix.


----------



## zeiz (Jul 11, 2010)

Another approach could be with *portsnap* that is fast and secure. 
After having problems with csup I use only portsnap now and I'm quite happy.
To update ports it's enough just to run
`# portsnap fetch extract` 
for the first time (yes, it downloads and extracts ~60MB for the first time) and
`# portsnap fetch update`
thereafter (it downloads only deltas and it's really fast).
If you used csup before (or installed ports from DVD) it's better to delete all /usr/ports directory first and then run portsnap fetch extract.
That's was step #1. Next if you run
`# pkg_version -vL=`
it shows all your outdated packages (installed ports).
Then read /usr/ports/UPDATING and update your installed ports starting from the most important such as gettext, perl, python and similar. I don't use *-a* option whatsoever: it's troublesome (with exception of _pkg_delete -a_ )
When you have all the installed ports up-to-date the troubles are unlikely.
The last step is installation itself. It could be done by 
`# cd /usr/ports/<pkg_group>/<package> && make install clean`
but it also could be done by 
`# pkg_add -r <package>` if you accept default configs and the up-to-date packages were created already and could be found in a repository corresponding your distribution:
ftp://ftp.freebsd.org/pub/FreeBSD/ports/<ARCH>/packages-N-distro/Latest/
I use both methods depending on current situation.


----------



## sk8harddiefast (Jul 11, 2010)

#portupgrade -a will install the new updates (after portsnap fetch update)


----------



## Alt (Jul 13, 2010)

Right, portsnap works great.
If your installed packages is relatively old, you also must check /usr/ports/UPDATING for some important updating details.
After this use ports-mgmt/portmaster or ports-mgmt/portupgrade to upgrade installed pkgs(installed apps) to new versions if you have them in ports. You can use `pkg_add -r` too, but its less recomended cus this packages frequently have older versions than ports (and this can cause mismatch), but it still can save time.


----------



## gore (Jul 20, 2010)

This is my least favorite thing about BSD. I mean, if someone made a system that simply updated / upgraded, all your ports, and didn't complain, or totally break everything, I think BSD would compete with Linux on the Desktop.

Every Linux distro, even Slackware, is super easy with this... You don't have this ideal that Ports are totally separate and need to be updated in another way (Of which there are like 4 or 5) and you can basically subscribe to Slackware-Security, and whenever a new update is out, you can use wget, grab it, and then upgradepkg *.txz or *.tgz depending on version.

Portmaster -uf just failed on my machine. I have a lot of ports because, well, I like having a GUI, I like having other stuff installed, and I read this:



> All the installed ports can be upgraded using this simple command:
> # portmanager -u



http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html

Simple? Yes. Worked? No. It Terminated, and said it was because of its4...OK, currently deinstalling that just to make it work for now.

I was reading the /usr/ports/UPDATING File, and it said to run "portmaster p5-" which is the first thing it says to do. I did so, and then when it finished, I had new mail and tried to load Mutt, but it doesn't load yet because of a Lib, so, I'm now attempting this again:

portmaster -a

See how it goes.



> If you encounter errors during the upgrade process, you can use the -f option to upgrade/rebuild all ports:
> # portmaster -af



Not sure about that, but it would probably save time to just do that first. That way the slow machine I'm upgrading won't be out of commission for a week.

I know one thing, if I win the Lotto some day, I'm going to spend a hundred grand on tracking down a BSD coder, and have them build me something that works like this:

freebsd-update stuff && portpatch --all

Once I have that working, I'll probably become even more rich because I don't know anyone who when first starting to use BSD, doesn't hate how you to patches compared to basically anything else.


----------



## SirDice (Jul 20, 2010)

Before starting to update _any_ port, read /usr/ports/UPDATING. Sometimes ports need to be updated in a specific order. This will be mentioned in UPDATING. The number one reason why updates fail is because of this. 

Another way to do it is to create a clean jail and build all your ports there. Then you'll never have any dependency issues. Package everything during the build and install those packages on your systems. I've been doing it this way for the past few years and I never had any major issues. The added bonus is that if something during building fails for whatever reason your main system will still be in full working order.


----------



## gore (Jul 20, 2010)

I've currently got that file opened in an SSH window right now so I can track what I'm doing and use a check list approach. The Perl one finished, and the next in line is going right now. Believe me, I've broken a LOT of stuff in my day heh. It's why I don't do portupgrade -af. Lol, I literally watched that go for like a week straight, and then, when it finally got done, it didn't work at all.


----------



## phoenix (Jul 20, 2010)

gore said:
			
		

> Every Linux distro, even Slackware, is super easy with this... You don't have this ideal that Ports are totally separate and need to be updated in another way



To each their own.  The fact that the ports are separate from the base OS and can be updated separately is my *MOST* favourite thing about FreeBSD.  The fact that you *CANNOT* do this on any Linux distro annoys the hell out of me.  Why do I need to upgrade to the next full version of Kubuntu in order to get a newer version of Firefox?  That absolutely boggles my mind.  Why can't I leave the base OS at version X, but upgrade all my apps?  Why can't I run a stable base OS from 2 years ago, but with the very latest versions of my user-level apps?

On FreeBSD, you can.  You can run a stable FreeBSD 6.x from years ago, but with the latest Xorg, Firefox, KDE, OpenOffice.org, etc.  That's something you can't do with a Linux distro.  And yet, you can do this Windows (how many are running Firefox 4.0 on XP, for example).  It's only Linux distros that fail in this department.

Yes, the ports tree isn't always super-simple to use.  But it's not the only way to install software on FreeBSD.  Want to use binary packages only?  No problem.  Want to use a mix of binary packages and port installs?  No problem.  Want to install everything from source via the ports tree?  No problem.

Want to mix source and binary installs on Linux ... be prepared to spend a lot of time figuring out how dpkg/apt/yum/rpm works.


----------



## vivek (Jul 20, 2010)

+1 for freebsd ports. I totally agree with phoenix. 

Just other day I wanted to remove few services / unwanted software from RHEL and so when I run yum remove packageName; it told me it will remove over 258 packages (there are total 329 packages installed) to just get rid of two things including core stuff like php, gd, apache and so on. Linux is all about popularity contest and most business go for it. This is the main reason why bigger business deploys there own Linux distro (e.g., Google or Yahoo (yes they have tons of Linux boxes too)) based upon Debian or Centos.


----------



## gore (Jul 20, 2010)

phoenix said:
			
		

> To each their own.  The fact that the ports are separate from the base OS and can be updated separately is my *MOST* favourite thing about FreeBSD.  The fact that you *CANNOT* do this on any Linux distro annoys the hell out of me.  Why do I need to upgrade to the next full version of Kubuntu in order to get a newer version of Firefox?  That absolutely boggles my mind.  Why can't I leave the base OS at version X, but upgrade all my apps?  Why can't I run a stable base OS from 2 years ago, but with the very latest versions of my user-level apps?
> 
> On FreeBSD, you can.  You can run a stable FreeBSD 6.x from years ago, but with the latest Xorg, Firefox, KDE, OpenOffice.org, etc.  That's something you can't do with a Linux distro.  And yet, you can do this Windows (how many are running Firefox 4.0 on XP, for example).  It's only Linux distros that fail in this department.
> 
> ...



OK, umm, Let me say this first before I continue:

I'm still "new" to Computers compared to most people around. I got my VERY first Computer, in September of 1999. I know this because when I got that Computer, it was my Uncle's Computer, and he had an Internet Account on it, and after a week, I figured out how to get online by guessing his password.

After two weeks of having that machine, I made an account on a website, and it was a site that would display the date you joined. I know that it was 2 weeks after getting it I signed up there, so I know exactly when I got my first PC.

No manuals, no help figuring out anything, sat up all night messing with it until I had each app at least understood (That damn DOS Prompt took a little longer than word.... When you haven't ever used a command line, or a computer for that matter, you're not going to "guess" at that one).

So, being that it's been only since the end of 1999, compared to some people here who probably remember using a TRS-80, or, maybe even a PDP of some sorts... I'm not as old at this.

So with that in mind, I'll now say this:

After getting used to Computers, I started to notice that the thing that REALLY interested me, was Operating Systems. That machine I got first came with Windows 95, and then 6 months later when I accidentally killed it, I got a new one with Windows 98 SE on it. After that I learned about Linux. A friend of mine had been Hacking for years, and we used to discuss things, and he said Linux was what he liked alongside NT. So, I started learning about it, like what it was, and all that.

Not long after, I learned about something called "FreeBSD". I remember I learned about it because ... I think it was DeCSS actually.... The guy who had done that, I read an article, and I THINK that was what happened when I read about how that kid didn't actually use Linux though it could be used on Linux to watch DVDs or something, and that he actually preferred FreeBSD.

I remember reading that, thinking to myself "WTF is FreeBSD?" I looked it up, and saw it was a lot like Linux in that it too, traced itself back to this magical thing called Unix.

Back in those days, Unix was already a Legendary thing to me. I heard so much about it, and I got into Hacking, and every time I did something, I learned about it, and how easy it was to do with Unix, which wouldn't hold you back.

My best friend and I both looked at Unix in the way that would be similar to someone under the age of 4 having keys to a Candy store. We would joke about how it must have been incredible hard to install, because it seemed so cryptic to us.

After a while, I got Linux installed. I was amazed at it, but couldn't get online, couldn't get sound, nothing like that. Hardware wasn't good. After a while I gave up and tried again a while later. I ended up getting a new PC that was going to be used for testing, and I hurried up to install Linux on it. 

In... I think this was some time in 2000, I was at Best Buy. I was walking around the Computer Software section, and saw this "FreeBSD PowerPak" with FreeBSD 4.0. I looked at it like "WOW!!!! It says Unix on the box!!!!" so I bought it. Yes, saying Unix on the box was enough to make me drop 6 weeks of Allowance.

Then again I've literally bought a pack of cigarettes because the pack was shiny...

Anyway, all this time, I had been seeing what these other OSs looked like. I thought it was cool that there was something other than Windows 95 and 98, and boy was I happy about that. And then I started collecting them.

I've got a bunch of OSs now, and I'm more picky about what I use. And I will say this:

I hate Ubuntu. I hate Red Hat. I hate Gentoo. If you use those, I don't know why you're surprised something isn't working. They suck.

I like SUSE, OpenSUSE, Debian, Slackware, and a few smaller less known ones. That's about it. Any other Linux distro to me, is a gamble.

And as for wanting to uninstall something and you couldn't because it wasn't separate like BSD? Well, you were using Red Hat, they suck, they can't make a good distro, that's to be expected.

Of course, on Slackware, that wouldn't happen. Try that. Install looks a lot like BSD, and upgrading can be done how YOU choose to. It won't even stop you.


----------



## vivek (Jul 20, 2010)

You see I don't make corporate decisions. It is always made by some guy seating at 10th floor. If they told me to install Windows 2008, I will have to install it and configure it. It is all about marketing and big buzz words. Linux and Redhat are one of those buzz words. Slackware is much better and it was first distro I tried.


----------



## sirving (Jul 21, 2010)

Here is what I do:
Make sure you are the root user.


```
mkdir /home/csup
cp /usr/share/examples/cvsup/ports-supfile /home/csup
cd /home/csup
```
open the ports-supfile with an editor like vi or ee.
go down to the line that looks like this:

```
*default host=CHANGE_THIS.FreeBSD.org
```
and change it to this:

```
*default host=cvsup8.us.FreeBSD.org
```
and save the changes.

Now to update your ports type 
	
	



```
csup -L 2 /home/csup/ports-supfile
portupgrade -a
```

if you don't have portupgrade installed go to:

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

every time you want to update your ports type:

```
csup -L 2 /home/csup/ports-supfile
portupgrade -a
```


----------



## gore (Jul 21, 2010)

I think I found a reason why I like not having Ports as a secondary system; Basically, FreeBSD updates, upgrades, patches, whatever you want to call it, can be done exactly like Debian when you are doing the Base System. You run this:

`freebsd-update fetch && freebsd-update install`

Just like `apt-get update && apt-get upgrade`

Now, the reason I don't like Ports as a secondary thing, are mostly because of this:

Let's say I have a FreeBSD machine that acts as a Server. Let's say I have another as a desktop. Now, if I want to use X, or anything not in the Base, I have to use Ports. Which is fine. It's easy to do, and a very simple command like "pkg_add -r xorg xterm kde windowmaker enlightenment Eterm pidgin xmms vsftpd twm fvwm".... You get the idea, it's easy to do that and have all that stuff right away. 

Now, let's say I have another desktop and Server, all of which are running multiple versions of Linux (Pretend for a minute anyone would dual boot a Server) and they're running Debian, Open SUSE or SUSE, and Slackware.

What if basically any port, has a security flaw? Patching that on the other machines can be either one line on your Shell, or, you can use a GUI and install the updates. You're only going to reboot if a Kernel update was there, which isn't very often, and even a fresh install, of an old version, will be done with patches, in about 15 minutes.

Now on FreeBSD, this is NOT going to work. The Ports aren't part of the base system, and so first off, that freebsd-update tool won't work. I look into the docs, and see I need to sync my sources basically. OK fine, no big deal:

`portsnap fetch && portsnap update && portsnap extract`

Alright... Oh wait... The patches are still needed.... All that did was grab the Ports that are new, and extract them, but it didn't actually touch my installed Ports. Hmm, OK, read more docs and try to see why it is that one tool updates the base, another tool updates my Ports, but doesn't upgrade them, and really just syncs it... And why another tool is needed to actually install patches / fixes....

Find out that my Base system is fully updated, but there aren't any FTP or HTTP servers in the base system, which means I HAVE to use ports to use it as a server, and neither is X in the base, so to use a GUI I also have to again... OK, fine, now cvsup, portsnap... Why all this to do the same job? Well, that's fine, you have a choice in what you want.. That's a good thing, but why didn't it actually update anything? Hmm, I'm still getting email from my root account that I need to either un-install these or update them... But I did... OK, read docs again..

Personally, if FreeBSD had a tool that actually did the Ports all the way, not just 50%, I think it would not only have more users, but a lot of those Linux only people, would really not have many reasons left not to.

Here is something that personally happened to me earlier:

Now, I've had a bit of a week, and I've been REALLY tired. I haven't been sleeping much, and so I've been kind of... Well, you know how it is, you've been up 30 hours, take a 4 hour nap and you're up again... Well, that.

So earlier today, I was like "You know what? I'm going to try again. I'll do this, and see if it's improved or gotten any easier".

I loaded up my Browser to the Docs, go to Ports and upgrading, and saw what to do. Well, I noticed I had a LOT of updates I needed from checking the root email. OK, so sitting here screwing around with each one, is probably not only a bad idea, but I'll probably screw it up pretty bad doing one section of them at a time.

I did this:

`portmaster -af`

It ran for a while, occasionally popping up to ask how I wanted something, and I thought it was going well. I was wrong, because half way through, something Terminated. I looked on my Console, and saw "its4" was not going to play nice....OK,.... Try a few things from FAQs and Docs... (Like not grabbing THAT port so it won't stop there) and try again.

It didn't work. I didn't type anything else other than that, and now, my Ports seem broken. I tried this to see if it could do it better, or at least get going:

`portupgrade -a`

That didn't work, so I tried :

`portupgrade -af`

Now, THAT should work right? No... 

Any suggestions on how to basically SCRAP the Ports, and start from scratch? Without a format? I'm looking in the docs because I know somewhere in there, it will tell me how to handle this, but for now, how would you go about basically redoing all your Ports?

In case someone answers before I'm done reading this; Is there a way to basically just re-install ALL the Ports I have installed? I mean I don't want every Port installed obviously, but can I get the ones I do have, to basically... Well, let me put it like this... They're broken like Windows NT right now lol.

I'm not giving up that easy though. I should be able to do this, and I always hated it, but, suck it up, man up, and try again I guess..


----------



## phoenix (Jul 21, 2010)

gore said:
			
		

> Now on FreeBSD, this is NOT going to work. The Ports aren't part of the base system, and so first off, that freebsd-update tool won't work. I look into the docs, and see I need to sync my sources basically. OK fine, no big deal:
> 
> portsnap fetch && portsnap update && portsnap extract



First, that command sequence will not work (well, it will, but running extract after update reverts everything back to the beginning).  The correct command is just `# portsnap fetch update`



> Alright... Oh wait... The patches are still needed.... All that did was grab the Ports that are new, and extract them, but it didn't actually touch my installed Ports. Hmm, OK, read more docs and try to see why it is that one tool updates the base, another tool updates my Ports, but doesn't upgrade them, and really just syncs it... And why another tool is needed to actually install patches / fixes....



As I said, if you want to deal with only binary packages, then you can.  Install sysutils/bsdadminscripts and use the *pkg_upgrade* command.  It works in the same way as aptitude.



> Find out that my Base system is fully updated, but there aren't any FTP or HTTP servers in the base system, which means I HAVE to use ports to use it as a server, and neither is X in the base, so to use a GUI I also have to again...



Well, duh, it's just a base OS.  As in, a solid foundation to build on.  Do you complain that Windows doesn't come with an SMTP server?  Or that the Wii doesn't come with a web server?  Or that DOS doesn't ship with a compiler, an IDE, a GUI, and personal maid?  One of the great things about FreeBSD is that it's just a simple Unix OS that you can use to do whatever you want.



> OK, fine, now cvsup, portsnap... Why all this to do the same job? Well, that's fine, you have a choice in what you want.. That's a good thing, but why didn't it actually update anything?



It did update something:  /usr/ports.  That's like complaining that "aptitude update" doesn't actually upgrade anything on your system.



> Personally, if FreeBSD had a tool that actually did the Ports all the way, not just 50%, I think it would not only have more users, but a lot of those Linux only people, would really not have many reasons left not to.



Don't blame the tools.  



> I did this:
> 
> portmaster -af



Never use the -a option together with -f, that's just asking for trouble.  In fact, never use -a, period.

If you want brain-dead simple upgrades, then stick to binary packages.

Otherwise, learn the system.

Update the ports tree:  `[b]portsnap fetch update[/b]`
Check for issues:       `[b]more /usr/ports/UPDATING[/b]`
Check for security updates:  `[b]portaudit -Fda[/b]`
Check for app updates:   `[b]pkg_version -vIl '<'[/b]`
Then, and only then, should you consider if things need to be updated.  And then you should do small batches of updates, in the order listed in UPDATING.



> Any suggestions on how to basically SCRAP the Ports, and start from scratch? Without a format? I'm looking in the docs because I know somewhere in there, it will tell me how to handle this, but for now, how would you go about basically redoing all your Ports?



To remove all installed applications:
`# pkg_delete -a`

Then install bsdadminscripts, and stick to *pkg_add* and *pkg_upgrade*.


----------



## rusty (Jul 21, 2010)

SirDice said:
			
		

> Before starting to update _any_ port, read /usr/ports/UPDATING. Sometimes ports need to be updated in a specific order. This will be mentioned in UPDATING. The number one reason why updates fail is because of this.
> 
> Another way to do it is to create a clean jail and build all your ports there. Then you'll never have any dependency issues. Package everything during the build and install those packages on your systems. I've been doing it this way for the past few years and I never had any major issues. The added bonus is that if something during building fails for whatever reason your main system will still be in full working order.



I'm interested in how you've setup this method, I've been looking at http://www.jeroen.se/articles/freebsd_build_cluster_jail_ports.php, is that a suitable way of running jailed ports?

Is adding packages to the host machine is as simple as? `# pkg_add </path/to/host/path/to/package>/package_name>`


----------



## gore (Jul 21, 2010)

phoenix said:
			
		

> First, that command sequence will not work (well, it will, but running extract after update reverts everything back to the beginning).  The correct command is just `# portsnap fetch update`
> 
> 
> 
> ...



It's actually a little hard to keep up with methods, but I do understand that part, because, well, if a book is released every year, that's considered VERY high up there in volume. But an OS released new every 6 months or so, is like normal for a lot of stuff.

I still have my original copy of "The Complete FreeBSD" which is great, but every method for updating in there, is basically totally out of date. I basically spent like a grand one day on two websites; The FreeBSD Mall, and the Slackware store. Got stickers, case plates, a Mouse pad from both, a tee shirt from both, the Slackware pins, and the newest versions of each on CD, and then, I got the newer Slackware book, and.... Heh, "Teach yourself FreeBSD" and then "The Complete FreeBSD" the updated one, and... Actually it's quicker to just say "I bought every book and software set on FreeBSD Mall" because that's what I did.

I had extra money I'd saved up at the time, and I wanted stuff I could use. So I spent like a grand getting almost everything they sell. The "20 Years of Berkeley Unix" DVD was great. I totally LOVED watching it.

The problem with that though, is that every one of those books, has a different way of how to upgrade, and I don't think any two say the same thing. That isn't all my BSD stuff, I also got FreeBSD-Unleashed, and some others, but since I only use FreeBSD, I don't really get OpenBSD or NetBSD, because, well, OpenBSD is FreeBSD with everything in a state of off to the point that it's barely usable without configuring it, where FreeBSD has that middle ground; It's secure too, but usable out of the box.

I used this to do mine:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html

I was using Portmanager, and it basically failed. I don't quite know why other than a few files which I just uninstalled for the time being. I decided I'd deal with that later and they weren't needed, but now, it's saying "libintl.so.8" is not found.

I don't know why, and I know I didn't remove anything that was like, needed. I checked the thing with portmaster --check-port-dbdir and the other for depends, and it came out just fine.

I have NO idea how that happened. It's saying that lib is gone and I'm sitting there like "What the... I didn't type anything else... The Cats don't know how to type... What the.." So I'm a little confused how that happened really.

Anyway, the portsnap thing, I did do it right on the console, I just forgot the order while I was typing my post, which is why it wasn't the correct order.




EDIT:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-freebsdupdate.html

This too said to use portupgrade -af ...


----------



## phoenix (Jul 21, 2010)

Search the forums for *libintl.so.8*.  You'll find lots of posts on this subject.

The root cause is that gettext (which provides libintl) was updated (libintl.so.9 installed) ... *BUT* all the apps that use gettext were not updated (still looking for libintl.so.8).

Reading */usr/ports/UPDATING* would have caught this.    And there are solutions listed in there.

Alternatively, reading the man pages for portmaster/portupgrade/portmanager would show the "save libraries for upgraded ports into the /usr/local/lib/compat tree while upgrading" option (-w for portmaster).  Using that would save libintl.so.8 into a compat location to allow old ports to continue working until you re-compile them all.


----------



## gore (Jul 22, 2010)

I figured I did something. I mean, I had an SSH window into that box open on this machine so I could follow along with UPGRADING, but, I don't know how it happened. I finished Perl, and then, I went to bed, and when I woke up, I planned on doing the rest. Right now, I'm trying pkg_upgrade -a and a few other switches to see if it does rebuild / reinstall them all.


----------



## ziruzavar (Jul 16, 2021)

Did you complete your update?


----------



## Sevendogsbsd (Jul 16, 2021)

This thread is 11 years old...I forget to look at dates sometimes too so no harm no foul, but you probably won't get an answer


----------

