FreeBSD Challenge: Day 04 of 30

I had a ton of fun today getting acquainted with FreeBSD.  While I am still installing my common set of software I use daily, I learned many valuable lessons, and why FreeBSD has to be so stable.   Hint: its not just because compiling ports sometimes takes eons.  All Joking aside, it was a great day, and very profitable.  Read on for more!

Adventures in Package Management

my new desktop

There’s a storm a-comin’

Gather round you people.  It’s time for a story of BSD, of might and magic, and frustration.  Today, I pretty much got the common tasks of installation, updating, and upgrading down, albeit with a few hiccups along the way.  If there is one piece of advice I must give a new user of FreeBSD it is this question:

“Would you like a side of Ports or Binaries with your BSD salad sir?”

Allow me to elaborate.  Sure, veterans of BSD can argue technical reasons on how they can coexist, and I’m sure I will learn along the way some methods that do work in that respect, but as a new user, try your hardest to make this decision early.  Not only will this result in less frustration and headache early on, but make you much more in tune with your system going forward.  Mixing and matching management types is never a fun thing anyway.  In summary, I personally found this:

Using the Ports system:

Pros:

  • Stable
  • Works as advertised when you get the hang of it
  • Updated and fresh software
  • Full control of the software installation process

Cons:

  • Can be quite slow to compile programs on lower end CPU types (as I found out in VirtualBox testing)
  • You must maintain your packages in a structured manor.  This is further helped by utilities such as portmaster and portsnap
  • When you encounter errors, you must do some digging to get down to the root cause

Using Binaries

Pros:

  • Easy, plain English searching, installing, and maintenance of binary packages
  • Many tools available for the job
  • Confidence that package will install needed dependencies without too much of a fuss

Cons:

  • I’ve found binary packages to be a little old in comparison to things in the Ports tree
  • When things do not install correctly, output on the issue is not always transparent (due to lack of verbose output vs. compiling)
  • Availability of binaries over the same set of applications available in Ports.

The decision

I found very early on, when I attempted to install VLC through ports, that my local perl installation installed by pkg_add (could also be through pkgng as well), was on conflict with the version VLC wanted through ports.  I took a step back and tried to think of what I did way in the beginning.  I had first added packages with ‘pkg_add -r’ and tried a port or two, then converted over to pkgng with ‘pkg2ng’.  In hindsight, that may have been the wrong thing to do.  This most certainly contributed to my package conflicts, now that I landed on using the Ports system exclusively.

So what do you do?

I visited many web pages, seeked IRC help on the #freebsd channel on irc.freenode.net, among other things.  Here are some helpful troubleshooting tips I did come across that worked for me:

  • Did the package fail with a stop message?
  • Did you try removing configuration options with ‘make rmconfig-recursive’ and installing again?
  • Have you cleaned the build directory you are in?
  • Did you try removing the directory you are in and fetching the list of ports?

These of course, are just some of the things you can do to elevate your problem.  Two such tools that made this headache a bit easier for me was portsnap and portmaster.  Portsnap will fetch the latest ports tree from the available FTP mirror, and make life grand.  It will also make upgrading your system relatively painless.  You can then use portmaster to do all your dirty work.

Wrangling portsnap and portmaster

On first run, I had to fetch, extract, and update.  This three staged “super attack” will pull the ports tree from the internet, extract all the contents, and update your local ports tree on  your system.  If you were a new user like me and inadvertently deleted a ports folder (in my case ‘multimedia/vlc’), this process can remedy such a thing.  Once you have extracted and updated your ports tree on the first run, you only need to run the “fetch” and “update” commands from now on to keep things fresh.


mkdir /usr/ports
portsnap fetch
portsnap extract
portsnap update

You can also combine portsnap commands for a one-two punch:

portsnap fetch update

Once I had the VLC directory back and intact, I was able to install to a certain point.  Ports complained that I needed some newer packages as well as dependencies.  So in this case, what do you do?  I found the simplest way was to run the following:


portsnap fetch
portsnap update
portmaster -b -d -y -a --no-confirm

I am sure there are some better ways to do this, and will be told as such, but for now that is what worked fine for me.  The exciting part about Unix and Linux is always finding great ways to do amazing things.  Also word to the wise, plan according on disk space if you are going to use the Ports system.  Yes you can do clean up regularly (using ‘make install clean’ is a good habit), but you will be expanding some decent space if you are compiling the programs yourself. Generally, the process of maintaining comes down to 4 things:

  1. Fetch the latest ports tree
  2. Update the locate ports tree on your system
  3. Update your installed ports using portmaster or your preferred tool
  4. When possible, upgrade your system with freebsd-update

Other Thoughts

There are a few other things I wanted to mention.  When you experience issues compiling a package, using a debugger/analyser such as gnomelogalyzer from “www.freebsd.org/gnome/gnomelogalyzer.sh”, will definitely help you pin down trouble areas when you hit a snag.  If you do get a package conflict and need to update the existing package, running ‘make deinstall && make install clean’ will reinstall that package and get it up to date.  There may have been a few other things, but it was quite a busy day for me.

That’s all for today.  Until tomorrow…

Huge thank you to TJ of @bsdnow for additional help!  You can reach him on twitter using the handle @blakkheim

-mikeyd

freebsd

[ Back To Index ]

Advertisements

About professorkaos64

www.libregeek.org

Posted on 20131210, in Distro Test Drive, Distros and tagged , , , , , . Bookmark the permalink. 4 Comments.

  1. If you think that ports and packages are confusing in FreeBSD you might take a look at OpenBSD as a comparison.

    http://www.openbsd.org/faq/faq15.html

    OpenBSD have one integrated system for binary packages and compiled packages. Even if you choose to use ports, the binary package is always created as part of the process and it is the binary package that finally gets installed. So there are very few instances where there is an advantage to use a port instead of a package. From the FAQ:

    “IMPORTANT NOTE: The ports tree is meant for advanced users. Everyone is encouraged to use the pre-compiled binary packages.”

    I have used OpenBSD packages on server and desktops for many years and very, very seldom I have any problems with dependencies, upgrades or similar.

    OpenBSD is also a very attractive OS for desktop use.

    http://distrowatch.com/weekly.php?issue=20131118#feature

    You shouldn’t need 30 days to setup a OpenBSD desktop. Rather an hour.

    See e.g. this guide.
    http://callfortesting.org/gnome3/ (gnome 3)
    or
    Section: “Install gnome on OpenBSD 5.2” (my site)
    http://www.lounge.se/wiki2/show/GnomeInstallOnSolo

    Nice challange you have taken on !

    • professorkaos64

      I wanted the challenge of FreeBSD, and had knowledge of PC-BSD and OpenBSD. In the end, I may stick with OpenBSD or PC-BSD on my new laptop I am getting (as my MBP just* died). Thanks for the advice!

    • professorkaos64

      Also it is not so much a “30 days to setup” challenge, rather a use case for 30 days on how well I can use it to adapt my normal daily routine, as a desktop alternative other than Arch Linux.

  1. Pingback: FreeBSD Challenge | The Linux Cauldron

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s