Xaero.org Tech news, reviews, and whatever else I wanna put here!

5Dec/100

The perfect Open Source laptop

I'm a huge fan of FreeBSD. So much so that all my systems are running the latest version (8.1 as of this writing). Many of my blog posts are about FreeBSD or mention it in some way. So maybe that's why it bothers me to say this:  FreeBSD just isn't well suited for a portable computer. I've fought it for some time and come to the conclusion that Linux just works better on laptops. A few of my gripes:

  • Non-journaled filesystems suck. Using UFS + soft-updates helps but can be tedious on large drives. I think journaling + soft-updates is coming in 9.0 so maybe the level of suck will be less. Nonetheless, having to fsck a drive is an idea whose time has passed.
  • ZFS kicks major butt but really needs a 64-bit CPU plus several gigs of memory, which leaves older laptops like mine out to dry. I can't get it to work as a root filesystem on any of my portable systems. I get a kernel panic on my i386 machines and the boot loader doesn't properly recognize my drives on my lone amd64 laptop.
  • There's no good wireless manager for any of the BSDs. Linux has one called Wicd. It works with anything you throw at it, including WAPs that require an SSL certificate. You can do most of that in FreeBSD but it requires you to edit several config files. Try changing between locations that use different SSIDs or different encryption. Wicd continues to just work without needing to change any configs, even with the built in ncurses interface. Wicd is heavily tied to Linux (it makes use of the Linux proc filesystem) so porting it would basically require a rewrite.
  • For some reason, Xorg seems to be hit or miss, driver-wise. It frequently hard locks on one of my systems with a Radeon but not another with a newer Radeon. I've never seen a lock up using the proprietary Nvidia drivers but the Nouveou drivers don't support 3D acceleration on all cards. I realize that most of the Xorg stuff is the same between BSD and Linux so that begs the question of why I see this on BSD but not Linux?

FreeBSD is rock solid on my desktop machines and ZFS on the root file system is a dream, so it's a bit disheartening that that experience didn't carry over to laptop-land. So, after dealing with the above annoyances I decided to throw my favorite Linux distribution on my laptops: Gentoo.

I wrote about Gentoo some time ago, ironically because I was critical of some things I needed in FreeBSD before I made the switch. Gentoo is unlike every Linux distribution out there (except the Linux From Scratch project) in that you have to build it in order to use it. This can be a serious turn off for folks that just want to install and get on with life, but I find it very intriguing and a great way to understand Linux at a much deeper level. The same idea holds when you want to install software; instead of prepackaged archives, you build it from source. This process is made easier with the Portage software management system, but you can tweak a near limitless amount of things to get exactly the kind of system you want. No bloat, no muss, no fuss.

With Gentoo installed, your next step to laptop bliss is to install Wicd to manage both your wired and your wireless interface (assuming you have one). Wicd is in the base Portage system, and assuming you chose the "desktop" Portage profile, installing Wicd should install a bunch of stuff. If you followed the Gentoo installation documentation, you probably added one or more of your Ethernet interfaces to your init scripts. Delete the net.eth scripts, but leave the net.lo script for the loopback interface. Add wicd to your init scripts by using 'rc-update add wicd default'. This ensures the wicd daemon starts so you can connect to networks.  Since you don't have Xorg installed, you can use the ncurses interface by typing wicd-curses. Check out the man page for wicd for more details.

Next up is getting Xorg installed. This can take a while, but it basically involves specifying your video card type and input method (typically evdev on modern versions of the Linux kernel) in the /etc/make.conf file. Building Xorg will likely take quite a while so now might be a good time to catch up on your bash.org quotes. Make sure you get hald and dbus started and added to your init scripts when the build completes.

With the X server built, we're in the home stretch. The next thing to install is some sort of desktop environment like Gnome or KDE, or my preference, a simple window manager. You are, of course, free to install whatever tickles your fancy but for all my portable systems, nothing, and I mean NOTHING, beats StumpWM for a window manager. StumpWM is a rewrite of the Ratpoison window manager in Common Lisp. Ratpoison is heavily inspired by GNU Screen, so if you're an avid screen user, you'll feel right at home with both Ratpoison and StumpWM. Let me give you a few reasons why I think you should give one of these window managers a try before you go kicking and screaming back to Gnome or KDE.

  • First and foremost, they're keyboard-driven. You're on a laptop, probably with an annoying touch pad or worse, the little pencil eraser pointer-thingy. Why would you inflict that kind of pain on yourself when you'll be far more productive if you could just keep your fingers on the keyboard?
  • Ever fly commercial? Ever get stuck in coach next to someone that doesn't know the meaning of personal space? Good luck using an external mouse when you're crammed in like a sardine at 60,000 feet.
  • If you write code for a living or even just as a hobby (you weirdo :-) ), your brain will appreciate not having to break concentration to reach for a mouse when you need to switch between terminals or editors.
  • They automatically maximize windows for you. You can see everything without needing to get a window sized just right with the mouse. You can, of course resize windows and split them as needed.
  • Pretty much anything you can do on a laptop would be enhanced by a window manager that is keyboard controlled.

With all the above in mind, you'll want to pick either Ratpoison or StumpWM to use. Ratpoison is written in C, uses minuscule amounts of memory, and is easily installed using the 'emerge' command. StumpWM is written in Common Lisp, so you'll need to install that first. If hearing the word Lisp sounds vaguely familiar, it should be. Lots of other open source software is written in Lisp or uses it, such as Emacs and The Gimp. Some closed source software uses Lisp as well.

To get a Lisp interpreter, you'll want to install either the CLISP interpreter or the SBCL interpreter. I highly recommend you install SBCL instead of CLISP. Add the following to your '/etc/portage/package.use' file (you may need to create the /etc/portage directory and the package.use file if they don't exist):

media-libs/gd fontconfig
dev-lisp/sbcl doc

Next, add the following to your '/etc/portage/package.keywords' file:

x11-wm/stumpwm ~x86

Your USE flags in '/etc/make.conf' should look at minimum like the following:

USE="sbcl -qt4 -kde X dbus hal -cups"

This should get you a working install of StumpWM but the version in Portage is pretty old and looks like it hasn't been touched in some time. Plus it doesn't even compile a StumpWM binary for you! Instead, you should use the version in the Git repository. In addition to making the changes above, emerge the following ports like so:

sudo emerge -av cl-clx cl-ppcre autoconf

You may need to install Git in order to grab the StumpWM source. Grab the StumpWM source like so:

git clone git://git.savannah.nongnu.org/stumpwm.git

I generally just keep the StumpWM source in my home directory. It doesn't take much space at all and there are several goodies in there. Go into that directory now and type "autoconf". Once that completes, type "./configure" You should see a lot of messages whizz by. Make sure the output of the configure script shows you're using SBCL. Once that completes, type "make". That should actually compile the StumpWM and Stumpish (Stumpish is a "shell" to StumpWM) binaries for you. Once that completes, you should have a StumpWM binary in your ~/stumpwm folder and a Stumpish binary in your ~/stumpwm/contrib folder. Copy both to /usr/local/bin as root. I tried adding my ~/stumpwm folder to my PATH and running it that way but it just doesn't work right, so installing both to /usr/local/bin is the way to go.

With a fresh copy of StumpWM built, add it to your .xinitrc: "echo 'exec stumpwm' >> ~/.xinitrc" and fire up a startx! You should see a welcome message. If you do, congrats! If not, you may want to try the StumpWM wiki.

Below is my .stumpwmrc file for you to pick apart and customize for your own needs:

;; My key bindings
(in-package stumpwm)
(define-key stumpwm:*top-map* (stumpwm:kbd "F12") "mode-line")
;; switching window
(define-key stumpwm:*top-map* (stumpwm:kbd "M-Up") "pull-hidden-previous")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-Down") "pull-hidden-next")
;; switching frames
(define-key *top-map* (kbd "M-Page_Down") "fnext")
;; switching groups
(define-key stumpwm:*top-map* (stumpwm:kbd "M-Left") "gprev")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-Right") "gnext")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-F1") "gselect 1")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-F2") "gselect 2")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-F3") "gselect 3")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-F4") "gselect 4")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-F5") "gselect 5")
;; splits
(define-key stumpwm:*top-map* (stumpwm:kbd "M-s") "vsplit")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-S") "hsplit")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-q") "only")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-r") "remove")
;; programs
(define-key stumpwm:*top-map* (stumpwm:kbd "M-c") "exec xfce4-terminal")
(define-key stumpwm:*top-map* (stumpwm:kbd "M-F") "exec firefox-2")

;; mouse
(setf *mouse-focus-policy* :sloppy)

;; prefix key
(set-prefix-key (kbd "Pause"))

;; wallpaper
;; (stumpwm:run-shell-command "display -window root '/home/<USER>/backgrounds/someimage.jpg'")
(stumpwm:run-shell-command "fbsetbg -l")

;; ff command
(define-stumpwm-command "firefox" ()
  "Run or switch to firefox."
  (run-or-raise "firefox" '(:class "Firefox")))
(define-key *root-map* (kbd "w") "firefox")

;; Multimedia Keys
(load "/home/<USER>/.stumpwm/multimedia-keys.lisp")

; Brightness Adjust (Fn + Up/Down)
(run-shell-command "xmodmap -e \'keycode 212 = XF86LaunchE'")
(run-shell-command "xmodmap -e \'keycode 101 = XF86LaunchD'")
(define-key stumpwm:*top-map* (stumpwm:kbd "XF86LaunchE") "exec brightness +")
(define-key stumpwm:*top-map* (stumpwm:kbd "XF86LaunchD") "exec brightness -")

;; Load Mode line
;; (load "/home/<USER>/.stumpwm/modeline-config.lisp")
(toggle-mode-line (current-screen) (current-head))

;; show the time in the mode-line
(setf *screen-mode-line-format*
        (list '(:eval (run-shell-command "date '+%R, %F %a'|tr -d [:cntrl:]" t)) " | [^B%n^b] %W"))

;; Modeline Group Scrolling
(setf stumpwm:*mode-line-click-hook*
      (list (lambda (&rest args)
(cond ((eq (second args) 5)
(run-commands "gnext"))
((eq (second args) 4)
(run-commands "gprev"))))))

;; Theming
;; (load "/home/<USER>/.stumpwm/effects.lisp")

;; Male's code for key sequence display
(defun key-press-hook (key key-seq cmd)
  (declare (ignore key))
  (unless (eq *top-map* *resize-map*)
    (let ((*message-window-gravity* :bottom-right))
      (message "Keys sequence: ~A" (print-key-seq (reverse key-seq))))
    (when (stringp cmd)
      ;; Give 'em time to read it.
      (sleep 0))))
(defmacro replace-hook (hook fn)
  `(remove-hook ,hook ,fn)
  `(add-hook ,hook ,fn))
(replace-hook *key-press-hook* 'key-press-hook)

Feel free to use what you can and look around for anything I missed. It'll take a bit of getting used to, but once you do, using a keyboard driven, tiling window manager on your laptop becomes second nature and you wonder how you went without it. For a great video introduction to StumpWM, go here. Enjoy!

17Jul/100

Using two screens in FreeBSD 8 with an Nvidia graphics card

So I finally made the jump to a multiple monitor setup, and boy is it NICE! I've been using a dual screen setup at work for several years and found that it really does boost productivity. I had previously been using a single Apple 23" HD display I bought in 2004 when I bought a PowerMac G5. While I was a little apprehensive at first, it turns out that configuring a dual screen setup in FreeBSD is really quite simple.

First, you'll need to physically set your monitors up, including placing them on your desk and running the power and video cables. For video, you really will want to use at least DVI. VGA just doesn't cut it these days, both in terms of clarity and resolution. Fortunately, just about any display you can buy these days has a DVI connector (most have both VGA and DVI). Don't skimp on monitors either. You do have to look at them for some period of time so you'll want something with a good contrast ratio and response rate. I managed to snag two Samsung SyncMaster 2243 22" LCD monitors for $179 a piece at Microcenter (marked down from $219 a piece). I don't recommend going above this size if you sit close to your screens (and most of us do) because you may end up straining your eyes with very large displays. Also, don't just line the screens up side by side either. You'll want to have a somewhat concave layout so it feels more natural to your eyes and brain. I set my screens so that they meet in the middle of my desk and then a tilt them inward a few inches where they meet. Do this by lightly pushing against the place where the bezels meet with your thumb. You may need to adjust the pitch and tilt of the screens afterward to get the bezels properly lined up. With that done, connect the power and video cables. If you are connecting new screens to your system while you are already in your window manager, I would highly recommend powering down your system. I tried a warm reboot on mine after attaching the screens and was greeted by a kernel crash.

When your system boots, you might be greeted with a clone display (same picture on both monitors) or you may see output on just one screen. I'm no expert on Nvidia graphics cards, so I can't tell you what to expect for a given card. For my setup, I've got a Nvidia GeForce 9500GT. It's a low end card by today's standards for sure, but I don't do much gaming at all, so it meets my needs. Depending upon your setup, you may be greeted by either a display manager (Gnome Display Manager, etc...) or just a login prompt. I prefer to keep it simple and shun a display manager for the comfort of a black screen and a login prompt.

Once logged in, you'll need a shell, so open a terminal if you're in a window manager. Most users of Xorg these days can get by without a configuration file since Xorg is much better at configuring hardware on its own these days. If you have a static Xorg configuration and have your resolution hard coded, you may see nothing but gibberish. You can either reboot into single user mode and move your configuration file to a backup or just reattach your old screen. Personally, I never specify a resolution since Xorg gets it right anyways. If you do not have an Xorg config, su to root and use the following command to generate one:

# Xorg -configure

This should dump a file called xorg.conf.new in root's home directory. Open that file up in your favorite editor. Under the Device section, add the following line:

Option      "TwinView"

Here's what my Device section looks like:

Section "Device"
   Identifier  "Card0"
   Driver      "nvidia"
   VendorName  "nVidia Corporation"
   BoardName   "G96 [GeForce 9500 GT]"
   BusID       "PCI:1:0:0"
   Option      "TwinView"
EndSection

Next, look for the Screen section. Under that will be several subsections named Display that are used for different color depths. In each of these, we need to add the Virtual directive. The parameters will be different depending on your screen resolution. Since my two screens are capable of a resolution of 1680x1050, I simply double my width parameter to 3360 (we want to span the width of the desktop across the two screens, remember?) to get a Virtual directive of "Virtual 3360 1050". Here's what it looks like for 24 bit depth:

SubSection "Display"
        Virtual 3360 1050
        Viewport   0 0
        Depth     24
EndSubSection

With both the TwinView option and the Virtual directive added, copy the configuration over to /etc/X11/ as just xorg.conf. You should be able to restart X or start it up if you're not using a display manager. You should see one gigantic screen! If not, check your settings. You may need to use Xrandr. It gets installed by default with the xorg-apps port. If you don't have the xrandr command, you may need to rebuild that port with the Xrandr option enabled. You can test it out by typing "xrandr" at a terminal prompt. You should see a good amount of output including your two display connectors (probably DVI0 and DVI1 or some variation), as well as the supported resolutions. If you do, try the following command:

% xrandr --output DVI1 --right-of DVI0

If you see a single large desktop, congratulations! You'll want to add the above command to your startup. This is usually at the top of the xinitrc file for non-GDM users or xsessions for GDM users.

Enjoy your added productivity and enormous desktop!

2Mar/1013

Configuring a 6in4 tunnel on the pfSense firewall

If you've read my article on connecting to the IPv6 Internet, you should be familiar with the principles of IPv6 over IPv4 connectivity and have some basic IPv6 knowledge.

I've wanted to use IPv6 with my pfSense firewall for quite some time but it seems that the developers don't want to be bothered supporting it. Fear not! There is a way to get IPv6 connectivity, though it won't work through the GUI.

I won't go into a great amount of detail on configuring your end PCs for IPv6 connectivity except to say that it's generally turned on by default for Linux, you need to add "ipv6_enable" and reboot for FreeBSD, and that you need to add the IPV6 protocol in Windows XP (newer versions have it enabled by default). From that point on, your computer should send out solicitation messages which your pfSense firewall will respond to and you'll get allocated an IPv6 address.

For the remainder of this article, I'm using this article (cached version here) for my template. That article is intended for native IPv6 connectivity, not tunneled connectivity. Also note that you should have configured an IPv6 over IPv4 tunnel. I suggest using a provider such as Hurricane Electric. Lastly, once you have a tunnel configured, you'll want to allow pings from the tunnel's endpoint to your router so it knows your side is up. I enabled this by going to Firewall/Rules and adding a ping rule that allows only the IPv4 tunnel endpoint to ping your firewall's external IP. Use ICMP, then Any ICMP type, then specify the host IP of the remote tunnel endpoint. Don't forget to apply it!

For your pfSense box, you'll want to be running the latest release (1.2.3-RELEASE as of this writing). Be sure to enable SSH from the web gui since you'll need to log into the command line. For your tunnel settings, I'll assume the following addresses:

  • WAN IPv6 IP: 2001:db8:0:1::2
  • WAN IPv4 IP: 192.0.2.2
  • WAN IPv4 Tunnel Destination: 192.0.2.15
  • LAN IPv6 allocation: 2001:db8:0:2::/64

Log into your firewall using the credentials you configured when you first set it up. At the menu, use option 8 to drop to a shell. Next, create the following file:

#!/bin/sh
# IFOUT = outside interface
# IFIN = inside interface
# DFGW = default gateway
IFOUT="gif0"
IFIN="bge0"
DFGW="2001:db8:0:1::1"

####### Configure the stuff

# Configure the interfaces
ifconfig $IFOUT create
ifconfig $IFOUT tunnel 192.0.2.2 192.0.2.15
ifconfig $IFOUT inet6 2001:db8:0:1::2 prefixlen 64
route -n add -inet6 default 2001:db8:0:1::1
ifconfig $IFOUT up

ifconfig $IFIN inet6 alias 2001:db8:0:2::1 prefixlen 64

# Set the default route
route -n add -inet6 default $DFGW

# Configure IPv6 forwarding
sysctl net.inet6.ip6.forwarding=1

# My /etc/rtadvd.conf looks like this
#
# bce1:\
#   :addrs#1:addr="2001:db8:0:2::":prefixlen#64:tc=ether:
#
# Startup rtadvd
/usr/sbin/rtadvd -d -D -c /etc/rtadvd.conf $IFIN

Save this file as 00_config-ipv6-if.sh under /usr/local/etc/rc.d/ so it will automatically be executed upon reboot and change the permissions to 755 so it has permissions to execute. Don't forget to change the inside interface to the name of your interface.

Next we need to configure the pf firewall to allow the tunnel to work. Create a file with the following contents:

#!/bin/sh
#
# IFOUT = outside interface
# IFIN = inside interface
# DFGW = default gateway
IFOUT="gif0"
IFIN="bge0"

####### Configure the stuff

# Configure PF
# pfSense puts it's rules in /tmp/rules.debug for debugging purposes after boot
# We will use these rules, add IPv6 additions, read the config with pfctl and
# disable and enable PF
cat /tmp/rules.debug | sed "/User-defined rules follow/{
p;s/.*/\
pass in quick on $IFIN inet6 from any to any\\
pass out quick on $IFIN inet6 from any to any\\
pass out quick on $IFOUT inet6 from any to any\\
pass quick proto ipv6-icmp from any to any\\
# pass in on $IFOUT inet6 proto tcp from any to any port 22\\
/;}" > /tmp/rules.config-ipv6.txt

# Read the new PF configuration file
pfctl -f /tmp/rules.config-ipv6.txt
pfctl -d; pfctl -e

Save this file as 10_config-ipv6-pf.sh under /usr/local/etc/rc.d/ and chmod it to 755 so it can execute on startup.

Lastly, create /etc/rtadvd.conf and add the following to it:

bge1:\
:addrs#1:addr="2001:db8:0:2::":prefixlen#64:tc=ether:

Save that file. At this point you can either reboot your pfSense box or execute the two scripts. You should have IPv6 connectivity through your tunnel. You can test it using traceroute6 and ping6. Another great test to try is to go to http://ipv6.google.com. If the logo bounces, you have IPv6 connectivity.

Enjoy!

25May/090

A few updates…

No, I didn't fall off a cliff. Been busy with lots of stuff:

  • Passed the CCDP ARCH test and became a CCDP on April 25th!
  • Lots of house remodeling projects
  • Working on my final Cisco test (for now : ), the MPLS exam
  • Various other sundries

On the FreeBSD front, I found an old 250GB SATA drive and installed it in my current rig as the only drive (just to be sure I don't screw something up). Not surprisingly, rebuilding the kernel and world with the latest 7.2 Release is quite snappy as compared to the Thinkpad T40. I was pleased that the Nvidia driver in ports worked without a hitch though it has no 3D acceleration whatsoever. For that you need Nouveau. I went my usual install route: install the minimal FreeBSD distribution, build world and build kernel, build Xorg from ports (including mouse, keyboard, Nvidia driver, and vesa driver for backup) with HAL support, build some sort of window manager (Fluxbox is my current favorite), install a shell (I'm torn between bash and zsh), and install Firefox 3. The entire process took about an hour and a half.

All of my hardware either worked out of the box or worked after a few tweaks but I used the i386 version of FreeBSD, not the AMD64 version. Before I built HAL, I had to use a PS/2 keyboard in order to actually install. Either I missed something or USB hotplug support isn't there out of the box and needs to be added to rc.conf. I was pleasantly surprised to see that my Blackberry was recognized when I plugged it in. It didn't automount or anything but it was neat to see it get recognized. I've yet to get it to work, but there is a ports version of barry available. Barry is a little rough around the edges but I was able to back up my Blackberry Curve 8320 to my Linux box with it.

It seems like FreeBSD is maturing and quite rapidly. Now that VirtualBox is coming for FreeBSD, the only barrier left is either getting a native 64-bit Flash plugin/player or for Gnash to mature rapidly. I tried Gnash on i386 FreeBSD and it works, but only part of the time.

I still watch with a bit of wonder and amazement at the effort that goes into an Open Source operating system and applications. That the developers can get their projects working with little or no support from hardware vendors is nothing short of amazing.

18Apr/091

FreeBSD 7 on a Thinkpad T40 update

Not too long ago I wrote a how-to article on how to get FreeBSD 7.0 working on my IBM Thinkpad T40. Among other things, I omitted a section on getting proper video drivers working. The graphics chip is an ATI RV250 (Mobility 9000). This means the driver you should use is the 'radeon' driver. Use 'pciconf -lv |grep ATI' to see which chip you've got. After toiling a bit with it, I figured out how to get the Open Source ATI drivers working.

Because I want to generally keep my systems pretty current, I recently installed FreeBSD 7.1 on my T40. It's important to know that the FreeBSD project generally breaks up development into three separate releases, namely CURRENT, STABLE, and RELEASE, in order of most bleeding edge to most stable. After building Xorg 1.6.0, I tried to start an X session just to see if I would get the ugly TWM desktop. To my surprise I got just a black screen but that was it. Even more surprising was that the usual "three finger salute" (ctrl + alt + backspace) didn't kill my X session. I then hit 'alt + F2' to log into another vty and manually kill off X. Here's where the fun began. It killed more than X; it locked my entire machine up. I continued futzing with my xorg.conf, kernel modules, and locking my system up for a good hour. I then threw in the towel and wound up asking a friend who's a FreeBSD developer WTF was going on. I learned a few interesting facts:

  • The DRM code in 7.1 was more than 2 years old
  • It is not necessary to manually load or pre-load any kernel modules for video
  • X.org should work well with ATI graphics cards (but the amd64 release may not work) since the ATI driver model has had substantial structural changes to it.

On the first point, there's two ways around the old code: Either download/burn/install the FreeBSD 7.2 release candidate or rebuild world. Since I'm a glutton for punishment, I decided to rebuild world. It's not actually that hard, just time consuming. Use the 'csup' utility to grab the entire CVS source tree from your nearest csup server and follow the directions listed here to rebuild your system using the RELENG_7 tree.

The second point is easy enough. There's no need to add anything to your /boot/loader.conf file in order to get X working. X.org will load any necessary kernel modules when you type 'startx'. As an interesting aside, I actually locked my system up when attempting the unload the radeon.ko kernel module when I had learned that preloading isn't necessary. Doh!

Once you've rebuilt your system and are running 7.2-STABLE, it probably wouldn't be a bad idea to rebuild your installed ports. This isn't necessary per se since X.org should work without even building a config file, but it is a good step, just to make sure everything is up to date. I use the portupgrade utility located in /usr/ports/ports-mgmt/ with the following: portupgrade -aRr. That should upgrade all outdated ports recursively as well as recursively rebuilding dependencies.

I'll expand on the last point a bit. ATI has been much more generous with contributing documentation to the Open Source community than Nvidia. In fact, Nvidia hasn't contributed anything other than a proprietary driver for Linux and FreeBSD, though there's a project called Nouveau which aims to build an Open Source Nvidia driver. Because of this, FreeBSD has an Open Source ATI driver (/usr/ports/x11-drivers/xf86-video-radeonhd and usr/ports/x11-drivers/xf86-video-ati) and using the old proprietary fglrx driver is no longer necessary. There's one hiccup to this though. The driver has to be re-worked every time a new ATI chip comes out. To solve this, ATI is moving towards the same unified driver model Nvidia has used for years and taking it a step further. They now have an Open Source BIOS abstraction layer called ATOMBios. The idea is to make it easier to more rapidly deploy drivers for new graphics cards. Read all about that in this article. Bravo ATI!

By the time you finish reading this, your ports should be up to date and you should be able to use hardware accelerated ATI drivers on your Thinkpad. I'm running XFCE4 on my Thinkpad and it's causing me to reevaluate the old "FreeBSD vs. Linux" question. Maybe I'll spend a little more time working on the other parts that I overlooked in my article.

Enjoy!

9Apr/092

Fun with Sun Solaris 9

I know, I know... why am I using a proprietary Unix after singing the praises of Debian GNU/Linux and dumping Mac OS X? Why the heck not? I love tinkering and experimenting with stuff. Besides, it wasn't terribly difficult to get Linux working on my Sun Ultra 1 Creator.

So why bother with proprietary Sun hardware at all? Because it's CHEAP and loads of fun to tinker with. Since the dot com crash of 2000, there's a plethora of Sun hardware to be found at very reasonable prices. My Ultra 1 Creator listed for $27,000 when it first came out in 1996 but I got it for FREE on Craigslist.

Since I got this machine free off Craigslist, and it did come with all the Solaris media (and then some), I have tinkered with it in several ways. When I first brought it home and booted it up, it had the 64-bit version of Solaris 9 on it. I've never really cared for Solaris (some call it Slowaris) so the first inclination was to install FreeBSD. I got that installed without any problems, including X.org, etc...  Yawn. Now on to Linux. My first inclination was to try Gentoo but I gave up on it since I couldn't get the kernel to compile no matter what I tried.

Next I looked around to see which other Linux distros support UltraSPARC hardware. Since I'm particularly fond of Debian, I naturally jumped in that direction. Getting the current stable (Etch at that time) Debian CD to boot turned out to be a major drag since it would continually freeze when trying to load the SCSI driver, a known bug in the installer. For kicks, I decided to see if a network boot would get me where I wanted to be. Sure enough, after setting up a RARP and TFTP server, the installer went flawlessly when using the Debian "Testing" image.

But even that got boring. So now I decided to get Solaris installed again. Not only that, I want to get the 64-bit kernel booting. It turns out this is more of a challenge than I thought.

To begin, I put the Solaris 9 installation CD in the drive and boot up. If you're wondering why I don't use Solaris 10, that's because it isn't supported on such old hardware. The first hiccup I run into is the screen warning me that a 64-bit OS is installed but that the installer will boot into the 32-bit SunOS kernel. Not a big problem. When I see the "Initializing Memory" screen, I hit Stop + A to drop to an Open Boot PROM screen. At the "ok>" screen, I type "boot cdrom kernel/sparcv9/unix" and hit enter. Sure enough, it boots the 64-bit kernel.

Now for the next hiccup. When the installer starts, you eventually wind up in a small xterm-ish console and it asks you if it can repartition the hard drive so it can place some temporary installer files on the hard disk. Most users of modern operating systems have come to expect that the OS will just ask you if it can erase what's already there and move on. Not so with Solaris. It will warn you that it can't partition enough space from the available free space on the drive. So now what?

I wound up bailing out of the installer with a Control + C and got dropped to a root prompt. Remembering another time I had to use a new disk in Solaris, I entered the format command to start that utility. I formatted the drive, gave it a label and rebooted. This time it worked. However, when I got to the section of the installer where you actually install the Solaris software, my CD drive starting acting up so I couldn't complete the install. I'll come back to it later I suppose. I guess free hardware comes with a price?

18Jan/090

Installing the official Nvidia drivers on a Debian system

Since I'm doing the Linux thing, I'm going to start writing more informational articles describing handy tips that I feel are useful. If you read my last post, you'd know I'm now using a Debian GNU/Linux system that has an Nvidia video card.

Video has always been a bit of a sore spot in the Linux and Unix world. It wasn't until the late 1980's that Unix systems even had a graphical subsystem (XWindows, as it is still known). Even today, the hardest part of bringing up a useable Unix-based system is getting the video adapter to work with XWindows. Today, most systems use a fork called Xorg.

While it would seem that the only video card you can buy will either contain an Nvidia or ATI chip, that's not entirely true. It is interesting (at least to someone like me) that Nvidia graphics cards are more often seen on Linux-based systems and ATI-based cards are more often seen in the BSD world (Free/Net/Open). Probably just a coincidence, but when I read forum posts, that's what I tend to see. Since we're talking about Linux in this article, let's get down to the business of installing some accelerated drivers for our Nvidia-based card.

One of the first places to look is the Nvidia Driver Debian wiki. Per the wiki, there are two ways to install the driver. The first method is the Debian method, which, while it may be easier, it also may be lagging behind driver versions. I chose the second method, which involves downloading the driver binary from Nvidia's website and manually installing it. There are a few caveats, namely that it's possible to screw up the install, not work, or require a reinstall if you upgrade your kernel since the driver compiles a kernel module. I didn't run into any installation problems but I would imagine that I'd have some difficulties if I upgraded my kernel. Nothing terrible to worry about though.

One thing to note is that driver availability for older Nvidia cards (made before 2005) is probably non-existant. So while you can probably get by using the generic VESA driver, you probably will no longer be able to use the latest Nvidia driver and therefore the 3D acceleration. See this section on the Debian Nvidia wiki for more info.

First, download the driver from here: driver download. Do remember that this driver is a propriatary, closed source driver. If that offends you, you should probably stop here. My understanding is that there is an open source Nvidia driver on the way so if you don't need 3D acceleration (obviously you haven't tried Compiz Fusion), this article isn't for you. I'm willing to bit the bullet and install a non-free driver for the sake of fully utilizing my hardware and will certainly move to the open source version when it shows up.

Next, you'll want to download your kernel source. Actually, I got by just getting the header files. Open your favorite terminal and type 'sudo apt-get install linux-headers-2.6-686'. If you don't have the sudo program installed (and you SHOULD), just su to root and issue the apt-get command again without the sudo part. I'm assuming you're running a 2.6 kernel on 686 hardware. Most people should no longer be running an i386 kernel.

Now for the fun part. You might want to write this down or open this article on another machine. To install the driver, you need to fully exit your X session. No, you can't open a terminal session from GDM. I'm particularly lazy, so I just rebooted into single user mode. Either way, you need to completely get out of X and be at a root prompt. Change to the directory where you downloaded the driver and chmod it to 755 if needed. Now run it, ignoring the runlevel error. Accept the license. You may get an error about the version of GCC installed on your system not matching what was used to compile the kernel. Do NOT just ignore this. Exit the installer. In my case, GCC 4.1 was used to compile my kernel so I just did a '#apt-get install gcc-4.1'. Next, you'll want to export the location, so first do a 'which gcc-4.1'. In my case, I did a 'export CC=/usr/bin/gcc-4.1'. Now rerun the installer. You should be good to go from here. The installer will build a custom kernel module, back up and modify your X config, and tell you if things have completed successfully. If that's the case, exit the installer and reboot!

Once I was back up I did a test by running Doom3 and was happily surprised to see it come right up. I have to admit, it's nice to run a system with no proprietary drivers, but I can't complain that Nvidia is gracious enough to provide a driver. After all, they don't have to since the majority of their customers are on a Windows system and developing and testing a Linux driver takes resources from that. So I say kudos to Nvidia for making a solid driver that installs easily and just works!

16Jan/091

The long goodbye…

As anyone who has known me knows, I'm definitely a Mac user. I've used Apple hardware on and off since the Apple II days. The first Mac I actually bought, however, was a G4 tower. Most of the time before that was spent hating Apple and suffering in a Windows world.

This went on until a good friend took the time to show me what his G3 could actually do. Of course, back then, Mac OS 8 was the de facto OS and Mac OS X was still a research project. I initially resisted but started liking what I saw enough to say "I want one!". It was then that I bought my first Macintosh, a 400 Mhz PowerPC G4 PowerMac. It came with 64 MB of RAM, an 2x AGP ATI video card with 16 MB of RAM and a whopping 20 GB hard drive. It also came with the venerable 400 MHz PowerPC 7400 (G4) processor with the AltiVec "Velocity Engine" vector processing unit and 1 MB of backside cache. This CPU smoked any Intel Pentium 3 at the time and was classified by the U.S. Government as a supercomputer since it was capable of at least a Gigaflop of performance. Another nifty component this machine has is a gigabit Ethernet interface. No other PC I can remember at that time (we're talking late 1999, early 2000) had that and most didn't have an Ethernet interface (56k was still the bomb-diggity). Needless to say, for $1599, this was a very nice Macintosh.

I endured many months of ridicule but really enjoyed my G4. One very interesting point was that the Playstation emulator, Connectix Virtual Game Station, actually ran Playstation games on my G4 faster than a Playstation! I continued to love my G4 until I decided it was time to go back to school.

At that point, I got my first Apple notebook, the Powerbook G4 Titanium 867. It basically had double the specs of the PowerMac. I wound up selling my PowerMac to a friend that needed a new machine which I thoroughly regret to this day. I had been running Mac OS X 10.0, then 10.1 on the PowerMac with Mac OS 9 "Classic" alongside it. The PowerBook came with Mac OS X 10.2 "Jaguar" and it was a rather large bump in speed from earlier releases as well as actually having software to use.

Shortly before graduation in 2004 I bought a shiny new PowerMac G5 (Dual 2.0) as well as a 23" Apple flat panel (graduation present to myself of course!). It had easily six to ten times the speed of my notebook and is what I currently still have. Not planning on selling it and making the same mistake twice!

Since that time, a subtle but continuous shift has been going on with the direction Apple has taken its business. Back when Mac OS X debuted, Apple was very gung-ho about it's core business: selling Macs. It also had a miniscule share of the overall PC market, so it was still playing catch up after the success of the iMac line. Development of new hardware and Mac OS X happened at a frenzied pace, as evidenced by all the announcements of cool new technology. This continued to happen until around 2006, when the iPod really started becoming a large part of Apple's revenue. Then the iPhone debuted in 2007. And there was the Apple TV. Suddenly, Apple is no longer a PC maker and is instead a consumer electronics maker. They even dropped "Computer" from their name.

I started noticing many changes to what were Apple's core business: Macs and Mac OS X. Now there's nothing but tie-ins to the iTunes store or some other non-PC product or service. New notebooks now have HDCP built in to appease Hollywood in its neverending quest to make water not wet. Everything Apple does surrounds the iPod line or the iPhone now. People say it's supposed to be a halo effect to get you to buy a Mac but I call bullshit on this one. If Apple can sell an iPhone to someone who just wants to make phone calls, they will. There's no indication at the AT&T store that you should also own a Macintosh to get the best experience. Apple is now the new Sony: a consumer electronics behemoth that does much, but nothing very well in particular. Their OS is now comparable to Windows: a tiny portion of it is engineered to get stuff done and the rest is engineered to get in your way and wrest control of your computer from you. And resist as I could, I just couldn't stay away. Until now.

For the past several months, I've been evaluating more than one Free/Open source operating system for use as a replacement. After lots of time spent on all three, I wound up settling on Debian GNU/Linux. Why? Because Debian is a very mature and actively developed distribution of Linux. I tried Ubuntu for a month and a half and it just feels like it's got more "stuff" than I need. I presume this is for handholding new Linux users. It would appear that I'm not the only one getting a little more than sick of the way Apple treats its power users. Two "A-list" bloggers (gawd I hate that word), Mark Pilgrim and Cory Doctorow, are also former Mac users and for very much the same reasons I am (only they did it 3 years ago).

I've used Linux plenty in the past, first installing Red Hat 5.1 on an old 486 back in the day and even managing to get X windows to bend to my will. Today's Linux distros are nothing like that. Everything just kind of works and the stuff that doesn't isn't so hard to fix. I would place the hardware support in Linux about where Windows 98 was: if it works, it works, but if not, prepare to get dirty. To that end, I built a pretty nice box:

* Intel Quad Core Q6600 CPU

* 2 GB PC-8500 DDR 2 RAM

* 1 TB Seagate SATA hard disk

* Nvidia GeForce 9500 GT video card with 1GB RAM

* Gigabyte EP45-DS3l motherboard

* Logitech wireless mouse, wired keyboard

* Repurposed LaCie Big Disk Extreme 500GB Firewire 800 drive

* PCI express Firewire 800 card

* Dual layer DVD burner

By today's standards, these specs are probably a mid-range Windows Vista machine. Yet, by running Debian, I get spectacular performance, no annoying product tie-ins, and best of all, my operating system does what I want and nothing more (yes, that's you, DRM). In layman's terms, this means I control my computer at all times instead of being forced to prop up an entire industry dedicated to preventing me from doing what I want with the stuff I've got. For those of you with entirely too much time (hey, you've made it this far), read here about what goes into ensuring you can't "pirate" content on Windows Vista.

As a parting note, it was nice to build a PC again after a 4 year hiatus. I got all that hardware for less than the cost of a Mac mini and it's certainly more capable. I was rather shocked at just how cheap and powerful PC hardware has become as of late. Since I didn't have to buy a PC and pay the Windows tax, I also saved more cash. And in these times, that's certaintly a good thing. Next time I'll post a list of what apps I'm using so any Linux enthusiasts out there can compare and contrast.

So long Apple, it was fun while you were a PC company.

12Nov/082

Getting FreeBSD 7.0 running on an IBM Thinkpad T40

I've been experimenting with various operating systems on my Thinkpad and have been trying to get a Unix-like system on there. I've played with Ubuntu but the battery life is abysmal. I can get around 3 hours with Windows XP installed and barely half that with Ubuntu 8.10 installed.

Just for grins, I decided to see how difficult it would be to get FreeBSD 7.0 working on this machine. After I was done, I decided I'd share the knowledge:

Here's how I did it

18Jul/082

Moved to new hardware

So over the past few days, I've moved my websites to new hardware. I got a used Sun Enterprise 420r and decided it was time. Pretty nice box: 4 UltraSPARC II processors at 450Mhz each, 1 Gig of RAM, and 72 GB of drive space. Of course it's running my favorite server operating system - FreeBSD. I considered and even tried to install Solaris 10 but it was being a PITA so I threw my hands up and just downloaded the FreeBSD ISO instead. In the process, I've learned how to move a site and minimize the impact of doing so (not that I have a heavily trafficed site anyways). For the curious, my old hardware was a PIII 800 with 512 MB RAM and 160 GB of drive space. If the day ever comes that I need more space I can always pop in another drive. I don't see that happening soon though.