Using Ports or Packages

So after my recent experience Thread 10-1-release-missing-libjpeg-so-8.50844/ of having dependencies get out of whack I now have to decide what way I want to go forward; using ports or packages, but not both.

Many on this forum suggest using ports. Many say do not mix, but I don't see many web article saying that, and some articles say you can mix because the only real difference is *where* the code is compiled. But obviously there more to it than that.

Obviously the man pages are a good start, but I'm looking for real meat n potatoes text on each system, including do's don't, best practices. Personally I prefer pkg, but it seems ports might still have an edge, even though it seems pkg is the future. I've read through section 5 of the handbook, but I find it tells me some info about the various commands, and provide some high level info, but I still can't 'see it' in my mind. Know what I mean?

Would any of you be able to point me to URLs that greatly explain and illustrate the difference between the two, and how to 'master' each? Or maybe I need another book? I have Absolute FreeBSD 2nd Edition, and The Complete FreeBSD but they are dated, and don't really cover pkg.

Thanks again all,
P.M.
 
How many systems are you supporting? If it's just one, ask yourself what the attraction is with binary packages. They save time? But how much time did troubleshooting the problem in that other thread take? I've seen more than a few people spending more time fighting with packages than it would take to just build the port and be done with it. I prefer ports because they are built in-place, with the local settings and flags. They don't have the built-in assumptions of binary packages. On a recent computer, most ports do not take that long to build anyway. The biggest ports, like LibreOffice, do not need to be rebuilt often.

As far as mixing ports and packages, it can be done. It can be more complex than using packages alone, because there are issues of dependencies and other potential problems that must be considered. Again, are the savings in build time worth it?

If you are supporting more than one system, consider using one as a build system with ports-mgmt/poudriere to build your own packages.
 
There are advantages to ports-mgmt/poudriere even if you are only building for one system. Some ports can be built in parallel (useful if you have a multi-core system) and you are building with a clean environment inside a jail, which can reduce the occurrence of some build errors. Here is a tutorial if poudriere fits your needs.
 
You can go with all packages, use poudriere to build updated packages in the jail from ports. Then use ports-mgmt/portmaster with package only options set in /usr/local/etc/portmaster.rc. It's easy to remove the jail, to start over, and remove your packages from the base system this way, if things go wrong.
 
How many systems are you supporting?
4 machines will be in server NAS appliance role (3 are built but 2 of those need their ports updated :p), and 2 will be desktops with 1 of those already built, and all are for home use. Remember my first post - to rid my house of Microsoft. So from a effort perspective you're right ports is no biggie. I'm just trying to think things out more, and of course developing new skills is always good right. Maybe I should focus on ports and ports management for the time being until I understand that much much better. Then I could explore pkg.

I find it odd though, pkg seems to be touted as the next generation software management platform for FreeBSD, but it doesn't seem to be embraced very well. Maybe because people like the control of ports.

Thanks again, and for anyone feel free to post URLs of some great reading material, or book suggestions.
 
I find it odd though, pkg seems to be touted as the next generation software management platform for FreeBSD, but it doesn't seem to be embraced very well. Maybe because people like the control of ports.
It's the next generation of package management, not software management. If you use packages then it's the way to go. If you use ports then no.
 
IIRC there was a similar discussion some time ago. A proposed solution was to mostly install official packages and build ports only for a few custom packages. To minimize potential conflicts between official packages and ports get the exact same ports revision that was used to build official packages:
svn up -r `fetch -qo - http://beefy2.isc.freebsd.org/data/10amd64-default/.data.json | jq -r '.builds[.builds.latest].svn_url | split("@")[1]'`
The above command comes from the old thread, I couldn't find it to make correct attribution.

I'm wondering what our resident FreeBSD gurus think about this approach?

Personally I feel it is a waste of time (and electricity) to build local packages which will be the same as the official ones.
 
Last edited by a moderator:
Personally I feel it is a waste of time (and electricity) to build local packages which will be the same as the official ones.
I agree, but the main disadvantage with packages built by someone else is that you don't get to choose the build options. I don't run a desktop environment, so I prefer not to have things like Hal, D-Bus, etc. With dependency trees, changing even one build option on a port can be the difference between a lot of packages being installed or not.
 
I'm sure I'll see some disagreement with this, but there are a few problems here with these approaches in my opinion. A new or relatively new user should at least understand the basics of ports as well as package management and how they relate (such as what the OP seems to be trying to do here) before attempting to use a slightly esoteric or somewhat more advanced approach to managing their system packages. Both devel/svn and ports-mgmt/poudriere are excellent tools to use (I'm using both), but setting up poudriere and using somewhat long or advanced svn commands can sometimes be quite confusing, daunting or even frustrating for a new or relatively new user, especially someone with no prior UNIX/Linux experience. I see great guides all over the Internet for setting things up or managing things in FreeBSD, but not all of them allow the user with some or little experience to understand what it is they are actually doing other then running some foreign commands in sequence to get an (hopefully positive) end result. This is why I would still personally recommend using ports at this time. pkg(8) works great and I'm sure this will change in the future, but right now, there just isn't enough choice in package options to make things much faster or even much easier than just using ports and compiling things exactly the way you want for your own system. Also, and despite what some people believe, with somewhat modern hardware your electricity bill is not going to triple from compiling ports as opposed to using packages unless your running Ebay out of your basement of course. Once a basic understanding is in place, then please do use poudriere, it's awesome! And besides, [ more mental effort == greater memory retention ] Just my 10¢ :)
 
Last edited by a moderator:
ports-mgmt/portmaster allows a combination of packages, build options, and ports. Depending on if you want to build ports for unavailable packages, ports for dependencies only, or other combinations for a compromise between install speed, options, and native builds. Portmaster can even install poudriere built packages too.

net/svnup is a lightweight way to install sources, and its interface is simple.
 
For someone trying to learn the basics, your suggestion makes sense protocelt. A new user who compiles his own packages from ports will understand third party software installation on FreeBSD at the most basic level and will still be exposed to pkg(7) to manage the resulting packages.
 
I'm sure I'll see some disagreement with this, but there are a few problems here with these approaches in my opinion. A new or relatively new user should at least understand the basics of ports as well as package management and how they relate(such as what the OP seems to be trying to do here) before attempting to use a slightly esoteric or somewhat more advanced approach to managing their system packages. Both devel/svn and ports-mgmt/poudriere are excellent tools to use(I'm using both), but setting up poudriere and using somewhat long or advanced svn commands can sometimes be quite confusing, daunting or even frustrating for a new or relatively new user, especially someone with no prior UNIX/Linux experience. I see great guides all over the Internet for setting things up or managing things in FreeBSD, but not all of them allow the user with some or little experience to understand what it is they are actually doing other then running some foreign commands in sequence to get an(hopefully positive) end result. This is why I would still personally recommend using ports at this time. pkg(8) works great and I'm sure this will change in the future, but right now, there just isn't enough choice in package options to make things much faster or even much easier than just using ports and compiling things exactly the way you want for your own system. Also, and despite what some people believe, with somewhat modern hardware your electricity bill is not going to triple from compiling ports as opposed to using packages unless your running Ebay out of your basement of course. Once a basic understanding is in place, then please do use poudriere, it's awesome! And besides, [ more mental effort == greater memory retention ] Just my 10¢ :)

Bulls eye! I can do any sequence of commands you folks want me to, but what does it mean? I'll stick to using ports for the foreseeable future to help me learn, but I still need to find information about what it is I am doing. If I told some of you folks that on your Cisco router in City A you need to create a prefix list and match on 10.5.0.0/16 gt 24 and then reference it in the 3rd layer in a route-map and use that to set metric = 125 on the redistribution process between OSPF and BGP, would you understand how that changed the routing outcome on another router in City B? And would you know exactly what to do on your own when City D comes online and you need path through City C to be backup?:D

I'll keep looking, and thanks again. If you can quote great sources of illustrative and detailed info on the ports, packages, and their internals/interworkings then please post here, and thanks again in advance for this. :)
 
What about the approach of using pgk to add programs in shorter time. Then running portmaster to upgrade the pieces that need to be. Would this not be the best of both worlds? If I install KDE4 or GNOME3, and then use the app manager to install a program, is it using pkg or ports in the background? Judging by the time it takes, I would say its using pkg and not ports.
 
Last edited by a moderator:
Once you start compiling anything from ports you should disable the official package repository and use either ports or packages built by yourself (using ports-mgmt/poudriere for example). There are too many possibilities for dependency problems when you first take the official binary packages and then recompile bits and pieces using ports. There is no "best of the both worlds" for FreeBSD ports unfortunately.
 
I maintain two FreeBSD machines at home and was using only ports for a few years. Now with the "new, improved" pkg system I thought I'd try packages-only on FreeBSD 10.1-RELEASE. It has worked out very well so far. For desktop machines there are a number of ports-only programs though, so one cannot get rid of ports entirely in that environment.

As for time saved, it does seem much quicker with packages. I'm talking about older Intel i3 8GB level machines though, so those with modern 8 core boxes might have a different experience.
 
You can use packages for certain things like development, programming languages, xorg, and databases, then compile the rest. This works well for me. Compiling certain programs works better than using the repository packages.

Fortunately, using ports and packages has been improved recently. One of the GCC dependencies would get pulled in, then it would compile what seemed like hundreds of programs not essential to FreeBSD, wasting hours of time and breaking half of the time. This seemed to do nothing for performance once compiled. Now GCC on FreeBSD seems to have been cleaned up, and it pulls down 4 dependencies. In my opinion, switching to Clang35 is still better for programs that don't require GCC. Still, it is better to compile (relatively) CPU intensive programs like Firefox, less glitches. Certain mixes of ports and packages may cause dependency issues as mentioned by others, but it's a lot better than before.

ports-mgmt/portmaster seems to only work for uninstalled programs when it is run as portmaster category/port. Otherwise, if the program is already installed, the category isn't needed for a portmaster upgrade. It's good to use the package build-only dependencies options for portmaster.
 
Back
Top