Dedicated to my late brave, beautiful and silly mummy, Debra Ross. I love you mumster.

Skip navigation

Haruhi Suzumiya dancing on FreeBSD?

Today was pretty amazing. Why? I ate a small mango after brushing my teeth and was not bothered by the nauseating spearmint infused citrus flavour.

Actually something big did happen for me today and it’s something that I’ve been wanting to do for ages. I installed FreeBSD on several PCs and without looking at any of the documentation for the first time. I’m dangerous!

The BSD Beastie   haruhisign.gif

In a manner similar to how DarkMirror in Singapore talks about learning Japanese, my knowledge of FreeBSD didn’t consciously happen, it evolved and eventually clicked. Like most people starting out in the FOSS world after living on Mac OS X and… heaven forbid… Windows, I was somewhat confused by the more intricate details of compiling kernels with optimisation flags and updating port trees with CVS; but after a week of informal study I pulled my old 200MHz Pentium MMX machine out and installed FreeBSD without looking at any documentation. Without realising it until after I finished, the process of installing and configuring has become second nature.

I really am impressed with the quality of the BSDs and the open source community’s efforts. Xorg + KDE 3.5 or Xfce 4.2 on a FreeBSD 6.1 box with the correct optimisations works flawlessly even on hardware that would struggle with Windows 98! Suddenly all the old machines that litter my expat family’s house have uses. Heck I’m even looking at my old Amiga in a funny way now…

I feel such an overwhelming sense of power now than I did before in a way that proprietary operating systems never really allow. Open source rocks! If I don’t like my X window manager, my desktop environment, my CLI text editor, my shell, my file browsers, my titlebar widgets or even my daemon services that manage SQL or the web, I can just change them or swap them for something else. A company doesn’t dictate what software has to be installed, I do. And if something doesn’t exist or I need to do something mundane, a quick keyboard lashing session later I’ve got Perl doing it for me.

The BSD Beastie   haruhisign.gif

Now I could have continued my exploration of Linux or just continued to hack away at Mac OS X, but I really do appreciate the strict conventions that the BSDs follow and the unwritten mantra that “if something works it’s good” should actually be “if it’s good it will work”. FreeBSD, NetBSD (and from what I can tell from my currently limited experience, OpenBSD) are elegant, fast, very well documented and extremely robust.

It’s got to the stage now where I’m even considering dual booting my MacBook Pro with FreeBSD and Mac OS X just to be able to use this stuff more and more in my day to day life.

For posterity (and because I think they’re cool) I’ve posted some screenshots of some of the boxes I have happily running now. You can see the Mac OS X influence in my thinking with both the KDE and Xfce panels set up to look like the Dock and the permanent menu bar ;).

Here’s Haruhi happily living in KDE 3.5/FreeBSD on my old HP box, (with the cursor unfortunately positioned on her face!!):

Haruhi on KDE + FreeBSD

And here she is again in Xfce/FreeBSD on my 200MHz (with MMX… wow!) 1997 Sim Lim Square box:

Haruhi on Xfce + FreeBSD

I’ve also configured an old 133MHz Pentium box I picked up for peanuts to run as a dedicated firewall and local intranet webserver to serve up the Schade family wiki, kinda like a digital refrigerator door! Of course I couldn’t put Haruhi on this because I don’t want or need X on this machine. Ah well, can’t win them all!

My next weekend project is to create a Perl script to download portsnap updates so they’re residing on a local hard drive, then configure portsnap on each machine to look up the local server instead of retrieving the same image from the interent four times! Unless anyone knows of a port that already does something similar to this?

The SOS Stack!

FreeBSD 6.1 Error on Parallels 3036

The BSD BeastieWith my ongoing efforts to learn about BSD (as opposed to Linux) and adapt it for use as a low cost workstation OS (which I have been very impressed with so far!), I’ve been using Parallels Desktop on my MacBook Pro to test various releases, including the flag, the DragonFly and the Pufferfish which as far as I can tell so far work flawlessly and just as fast as they do on a regular PC, which I guess is largely what the latest Intel macs are ;).

Been having some issues running FreeBSD 6.1 and the FreeBSD 6.2 release candidates though which is a real bummer :(. Upon booting FreeBSD from either a full CD ISO image, from the Boot ISO image or even from the hard disk (virtual machines I had set up in the 1970 build of Parallels previously) I receive the same string of errors:

FreeBSD 6.1 Error on Parallels 3036

Again this seems to be isolated to the FreeBSD (and the FreeBSD based PC-BSD distro) 6.x series on the Parallels 3036 Beta build. The official 1970 release still works fine.

Fortunately after a few minutes looking around the Parallels Forum many others have had the same problem, so it’s not just my machine stuffing up. Then again, had the error been on my machine I could have fixed it I guess.

Parallels Forum postings:

Hope Parallels addresses this issues ASAP; in the meantime I’ll have to stick with build 1970. Bummer :(

Useful NetBSD / *NIX Commands For Newbies

NetBSD

  • chsh
    change your shell
  • nano -Sw .profile
    change your own settings (substitute nano with your favourite text editor
  • passwd
    changes current user’s password
  • echo $SHELL
    prints your running shell
  • mount -t cd9660 -o ro /dev/cd0a [directory]
    mounts most internal optical drives
  • mount -t msdos /dev/fd0a /mnt
    mounts an dos formatted disk
  • umount [directory]
    unmount volume
  • eject /dev/cd0a
    makes a cupholder accessible

SIOCSIFMEDIA: Invalid Argument

Does the error SIOCSIFMEDIA: Invalid Argument look familiar when installing NetBSD 3.1? I got this error when I reached the FTP stage of the installation shown on "Figure 3.24" in the NetBSD Manual:

NetBSD Install FTP

If you just hit return it will give you an error. The trick is to type manual instead of accepting the default value which causes the error.

A couple of the folks on Nabble go into more detail if you continue to have errors. Now if only I didn’t have a crappy DSL connection so as to prevent the dreaded - stalled - message while downloading from the mirror ;).

NetBSD 3.1 Released

NetBSDActually it was released on the 04th of this month, but I thought I should post anyway!

NetBSD has always been my favourite BSD release because of it’s simple text based installer, it’s clean and uncluttered design, the fact I can download the whole thing in just over 200MB, and that it runs on anything… including toasters ;).

From the official press release:

The NetBSD release engineering team has announced that the NetBSD 3.1 and 3.0.2 releases are now available. NetBSD 3.1 contains many bugfixes, security updates, new drivers and new features like support for Xen3 DomU

I run NetBSD on my retro c.1997 Pentium MMX machine, works like a champ.

A Closer Look At Apple’s Universal Binaries

Universal Binary

I think the idea behind Apple’s / NeXT’s concept of a Universal Binary is a great idea. With the different system architectures available for Apple computers these days (32-bit and 64-bit PowerPCs, 32-bit and 64-bit Intels) it makes sense to be able to package up specific code for each processor into one bundle so you don’t have to choose between four different program downloads tailored for each processor.

How Universal Binaries Work

From what I can surmise [given I'm mostly a scripting language programmer cough!], a Universal Binary is a Mac OS X application that has had its code compiled multiple times to run natively on multiple processors, such as the PowerPC and the newer Intel chips. When an application is executed, Mac OS X checks the application’s header (if it is not a Universal Binary on a compatible platform it kicks Rosetta into action and runs it in emulation mode), then runs the appropriate code for your processor architecture.

The beautiful thing is to the end user, it just looks and runs like any other program, regardless of the platform their using.

It then goes without saying that applications that have multiple compiled code parts will be larger, but not necessary double in size. Most programs use resources, such as HTML files, images, text and so forth, that would be shared among the two different programs within the application. And because only one of the compiled parts is loaded into memory, there generally isn’t any performance hit.

Checking Universal Application Binaries

I think also from a developers standpoint Universal Binaries are a very elegant solution. I didn’t know this until recently, but if you want to check what processors are natively supported by a program, you can use the file command in your Terminal. For example, to check what processors BASH natively supports, you can type:

file /bin/bash

And if you’re running a later version of Mac OS X Tiger it should show:

/bin/bash: Mach-O universal binary with 2 architectures
/bin/bash (for architecture i386): Mach-O executable i386
/bin/bash (for architecture ppc): Mach-O executable ppc

So we have a program here compiled to run natively on 32-bit PowerPC’s (such as the G3 and G4) and i386 processors (such as the first generation Intel Core Duo). Had this program not been Universal (such as Photoshop CS2 or Office 2004), it would have shown only ppc.

Removing Processor Code from Applications

As mentioned above though, the downside to having an application with many different compiled parts for different processors is that they can be larger. Some might argue that it also doesn’t make sense to have code that wasn’t compiled for their machine to be sitting there taking up hard disk space.

If you want to remove unnecessary processor support from a Universal Binary, you can use the lipo command… aptly short for liposuction.

To keep just Intel code:
lipo -thin i386 -output output_file input_file

To keep just PowerPC code:
lipo -thin ppc -output output_file input_file

Be VERY careful though when removing processor support from applications though. If PowerPC programs use resources from a universal program, removing the PowerPC code will break support and crash the application using the resource. Some programs will even refuse to run if they believe they have been tampered with.

Alteratively a somewhat safer way to remove code is to use TrimTheFat, a graphical program that has a built in blacklist of programs that it will refuse the compact because of known problems after lipo’ing. I’d still be very careful though.

References

Getting PHP Working on Mac OS X


Ruben the Perl Programmer: I resent that remark

I consider myself a more experienced Perl programmer, though I do need PHP to run some of the programs I download. Mac OS X comes bundled with PHP, but it needs to be enabled in Apache before you can run PHP programs on your websever. Dang.

From the always useful DevArticles.com:

Using the Terminal.app, Start the Terminal.app located in the “/Applications/Utilities/” directory, then change the directory to the “httpd” directory using the following command:

cd /etc/httpd

Next step is to use “root” privileges, start up the text editor named “Pico” and edit the “httpd.conf” file.

Use the following command in the Terminal.app:

sudo pico httpd.conf

Type the root password and you are ready to go.

Locate the 4 lines:

#LoadModule php4_module
#AddModule mod_php4.c
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps

Use your arrow keys to navigate the document and remove only the pound signs “#”. The best way to navigate is to use the DOWN arrow key and stay to the left Side of the document. To remove the pound sign, hit the right arrow to the right Of the sign and then hit the DELETE key.

Warning: Only remove the pound signs!! Keep the lines of code where they are and do not relocate them!! You have been warned!

The changed lines should look like this:

LoadModule php4_module
AddModule mod_php4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Modem Versus WinModem

An interesting physical comparison between a traditional modem card and a more recent winmodem which uses the hardware in the host computer through software instead of dedicated components. Of course the earlier winmodems were; funnily enough; designed for the Microsoft Windows operating system, so its understandable why Linux drivers etc took so long to come to fruition. Mmm…. fruition.

I can’t say I miss the good ol’ modem all that much anymore, thank you WiFi :D.

WinModem and Regular Modem Comparison

Technorati Tags  , , , , ,