Sunday, October 6, 2013

FreeBSD - 9.2 x86

Upgrade time!

FreeBSD 9.2 just came out and last night I felt compelled to upgrade.  Compelled!

Would my software still compile and run?  Did they fix the issue I had in 9.1 where pkg_add -r didn't work for large enough files.  Who knows!?  I would find out.

The netinstall image was available, as they usually are, from I downloaded it forthwith, aimed my VMware Workstation at it and let the adventure begin.

"Select a Guest Operating System" it said. "Other -> FreeBSD"  seemed like a logical choice.  I also changed the 20g hard drive image to 8g (which was enough with 9.1) but accepted the default 256M of memory.  Later, the disk turned out to be IDE.  I wonder if I'd get better performance out of SCSI.  Some day I'll test that, but not today.  I didn't need a Floppy, USB or Sound Card so I removed the emulated versions of those, switched my Network Adapter to Bridged (and to replicate physical network connection state) and set the Maximum resolution of any one monitor  to 800 x 600.



FreeBSD-9.2 - 1. boot screen
Interesting. I don't remember a multi-color bootloader in 9.1. Maybe there was one though and I just don't remember it. I like it.

On the "Distribution Select" screen, games was already checked but I checked doc, ports and src too to get a more complete installation.

I'm using static IP's on my network so I opted out of DHCP autoconfiguration but noticed something quirky when attempting to enter my IP, netmask and gateway.  Hitting return after entering a value in a field takes you to the next screen rather than the next field and hitting tab takes you down to the OK/Cancel buttons rather than the next field too.  I had to use arrows to navigate between the fields.  Unusual.

Ok.  Static IP, no IPV6, let's go.

I selected Guided partitioning and used the Entire Disk.  The default partitioning looked good - a small boot partition and the rest was swap and root.

Pretty soon the installer was downloading sets.  The download was surprisingly fast.  I went to get a glass of soda and the Overall Progress was already at 15% when I came back.

FreeBSD-9.2 - 2. downloading
That said, for whatever reason, set extraction seemed to take a while.  Another reason to test that emulated SCSI drive some time, I guess.

Eventually everything was installed.  On the System Configuration screen, sshd was already checked and I didn't enable moused (mouse on console), ntpd or powerd.

I did create a user and was surprised at how many options there were.  Most OS'es prompt for the login name, full name and password, maybe additional groups.  FreeBSD asks a whole page of questions, all relevant questions, but man... a lot of questions.

A minute or two later I rebooted and got my first login prompt.

FreeBSD-9.2 - 3. first login
Post-Install Tweaks

I logged in and checked to see what was running.  Not much, actually, which was nice.  I usually have to stop a ton of unused processes, but not this time.  Sendmail was running, but after poking around a bit I learned that it was configured for local delivery only.

There was an odd adjkerntz process running but after looking at the man page it seemed wise to leave it running.

I'd created a user for myself but quickly realized that I'd forgotten to add myself to the wheel group.  Oops.  Maybe I should have paid more attention on that long page of options when I created the user to begin with.

I usually install sudo almost immediately after installation.  FreeBSD still doesn't appear to have an equivalent to yum search or apt-cache search but I figured I could probably guess the package name.

pkg_add -r sudo

Yep, not too hard.  The sudoers file was in /usr/local/etc though, not /etc.  I guess this makes sense as the rest of sudo was installed under /usr/local but it took me a minute to find it.  sudoers is in a different place, I never remember that about FreeBSD.

sshd was running already but I installed xauth so X-forwarding would work.

pkg_add -r xauth

I copied my .ssh directory from another machine and was instantly able to ssh into the VM from elsewhere.  No more working on the console.


What kind of web software do we have.  Nothing came in the base install, it seemed, so I installed firefox, lynx and wget.

sudo pkg_add -r firefox lynx wget

firefox pulled in a lot of x-windows stuff (which I expected) but unexpectedly pulled in perl and python too.

On the server side, I installed apache.  Or at least I tried to.  pkg_add of apache, apache2 and httpd all failed.  What's it called again on FreeBSD?  No good way to find out (that I know of) other than ftp'ing in and looking around.

cd cd pub/ports/i386/packages-9.2-release/Latest
dir *apache*

There appeared to be apache22 and apache24 options.

sudo pkg_add -r apache24

The install script gave me this helpful message too:

To run apache www server from startup, add apache24_enable="yes"
in your /etc/rc.conf. Extra options can be found in startup script.

Thanks for that.  I added the enable line, but how do you actually start apache again?  There was no /etc/rc.d/apache*.  "grep -r apache /etc" was unrevealing

Finallly, "pkg_info -L apache24-2.4.6" revealed an init script in /usr/local/etc/rc.d/apache24.  Got it.  Should have remembered that.

The config file was in /usr/local/etc/apache24/conf/httpd.conf.  The DocumentRoot was set to /usr/local/www/apache24/data.

I enable cgi's...

LoadModule cgi_module libexec/apache24/
AddHandler cgi-script .cgi
Options Indexes FollowSymLinks ExecCGI
DirectoryIndex index.html index.cgi

...and started the server

/usr/local/etc/rc.d/apache24 start

I wondered if that would get started at boot time or not.  Does the init process look in /usr/local/etc/rc.d?  I'd find out later.

Do cgi's work?  Sometimes they don't but this time they did.  My little test program worked fine with lynx:

echo "Content-type: text/plain"


What kind of productivity tools were available?  I'd have to ftp in again to find out.  Looks like LibreOffice is available.  Excellent.

sudo pkg_add -r libreoffice

In 9.1, downloading a large package would sometimes cause pkg_add to stall out.  Not this time though.  It took a while but everything was successfully downloaded and installed.

I guess I jumped the gun a bit with that LibreOffice install though.  To actually run LibreOffice, it's generally helpful to have X running first.

Graphical Desktop

What desktops are available?  I had to ftp in again to find out but I was pleasantly surprised.  Gnome 2, KDE, XFCE 4, LXDE and E17 all appeared to be available.  Gnome 3 was missing but it requires hardware acceleration and I'd have installed Mate instead anyway.

Let's try Gnome 2.

sudo pkg_add -r xorg gnome2

This took forever.  I was reading a book while waiting and after several chapters, I just gave up and let it run all night.  The next morning it was installed though and I tried it out.

There were a few things that I didn't remember from my last FreeBSD install but I did remember that X on FreeBSD requires hald and dbus.  They were installed with xorg but not enabled so I added lines to /etc/rc.conf to enable them:


X also requires /proc so I added a line for it to /etc/fstab...

proc /proc procfs rw 0 0

... and then I started everything up.

sudo mount /proc
sudo /usr/local/etc/rc.d/hald start
sudo /usr/local/etc/rc.d/dbus start

To just run gnome from the command line you have to make sure there are no .startxrc or .xsession files in your home directory, create an .xinitrc with:


and run:


I switched back to the console and tried it.  It almost worked.  I got a beautiful desktop but the mouse didn't work.  After some poking around it appeared that hald wasn't running.  Ah, who knows, just reboot.

Upon reboot, hald, dbus and apache all 3 came up.  I guess the init process does look in /usr/local/etc/rc.d.

I tried startx again and the mouse worked fine.  The first terminal I opened died immediately but the next one opened fine.  I've never been able to reproduce that and had no other problems at all.  I have no idea what caused it.

I fired up Firefox and pointed it at my trails site.

FreeBSD-9.2 - 4. firefox
It seemed slow to start but ran well once loaded.

LibreOffice writer seem slow to start as well.

FreeBSD-9.2 - 5. libreoffice

Neither guest nor host were paging.  I thought fs caching might improve things and Firefox did seem to start more quickly the next time but LibreOffice still didn't.  The System Monitor said I was only using about 36m of ram (out of 256) but now using 131m of swap.  Hmm.  Something's going on.  No time to fiddle with that though.

VMware tools.  Could I get them working?

I clicked "Install VMware Tools" in VMware and (as expected) nothing happened.  I had to manually mount cd  but that took a little digging to figure out.  I'm sort-of used to mount attempting to detect the filesystem type and also sort-of-used to the filesystem type being iso9660, but it doesn't and it wasn't.  No problem though, I figured it out:

sudo mount -t cd9660 /dev/cd0 /mnt

Installation was a little tricky though.  It started off easy.

tar xfz /mnt/vmware-freebsd-tools.tar.gz
sudo vmware-tools-distrib/

I accepted the defaults.  At the very end it errored out.  Apparently I needed to install compat6x-i386.  No problem.

sudo pkg_add -r compat6x-i386

I re-ran installer and re-accepted defaults.  This time it got further but I got some semi-confusing messages at the end: "No X install found" "Unable to start services for VMware Tools"

Maybe a reboot would help.

Kind-of.  The messages said to run /usr/local/bin/

I did and it still gave errors regarding memory manager and blocking file system but it appeared to recognize X.  I ran startx and, hey! the cursor automatically moved in and out and I could resize the screen.  Woohoo!  I'll call that success for now

To get a graphical login I append some lines to /etc/rc.conf:


And I'm sure there's some way to start GDM from the console but I just rebooted again.  Upon reboot I got the expected graphical login manager.

FreeBSD-9.2 - 6. gdm

Logging in took a while.  Everything seemed generally sluggish but once it was loaded it was very usable.

It's fun to get the graphical desktop working but in truth, I prefer to run my VM's in text mode.  I usually just ssh into them to test software and there's no need to consume the extra memory.  So I disabled the graphical login...


...and booted back into text mode.


Development is what I'm really up to with these VM's.  I make sure my software compiles and runs on them.  The more platforms and compilers you expose your code to, the more likely it is to compile and run on platforms you don't have access to.  Or something like that.

g++, perl, python and ruby appeared to have been installed already, as were pcre, openssl, apr, curl, libexif, and librsvg2.  For some reason, proj was even installed.  I didn't realize anyone but me ever used it but apparently so.

I did need to install a few languages, database API's and tools so I ftp'ed in to the ftp site again and discovered the names of the packages I needed to install.

sudo pkg_add -r gmake vim php55 tcl86 erlang openjdk7 readline unixODBC mysql56-client postgresql92-client freetds freetds-devel sqlite3 mdbtools p5-Image-ExifTool gdal

freetds-devel is the oddball.  Why a separate devel package?  That's standard on Linux for sure, but not on any of the BSD's.  Odd.

In 9.1 pkg_add had stalled out on erlang and openjdk7 and I had to manually download and install them, but it worked this time.  Woohoo!

I copied over my .cvsrc, and .vimrc files from another VM, tweaked my .profile a little and...  ahh, come on:

E25: GUI cannot be used: Not enabled at compile time

Really?  gvim was compiled without support for the GUI?  I guess so.

I checked out and built all of my code.  No surprises, everything compiled and installed just fine.

Updating the system-wide PATH is always difficult on FreeBSD because the user-specific .profile overrides it entirely so rather than updating /etc/profile, I added /usr/local/firstworks/bin to the PATH and /usr/local/firstworks/lib to the LD_LIBRARY_PATH in my .profile.

sqlrsh worked as expected.

FreeBSD-9.2 - 7. sqlrelay

(I fired up the GUI one last time to get that screen shot)

Running sqlrelay against mysql, postgresql, sqlite, etc. all worked as expected and my test programs worked against it.  All right.  I'll, of course, do more testing later but for now it looks like FreeBSD 9.2 is supported.

Clean Up

Since I'm not running a graphical environment, I disabled hald and dbus in /etc/rc.conf...


...and rebooted.  During the reboot I tuned VMware down to 128M of RAM too.



Or at least almost none.  There were a few quirks but I have yet to install an OS that didn't have any.  Besides, I'm not here to critique the OS, just to explore it and support it if I can.

No comments:

Post a Comment