FreeBSD or Linux

FreeBSD or Linux (Ubuntu/RHEL)? This is a very old question. It’s like asking iPhone or Android. There is no short answer. It all depends on your situation. To make things easier, I am going to break it down into six simple questions to help you making decision.

My Background
I have been a FreeBSD user since 2003. My usage on FreeBSD mainly on service-oriented stuffs such as web farm, database clusters and file system etc. In short, I mainly use my FreeBSD system via command line. In 2009, I jumped into Linux world (Ubuntu/RHEL) because of my job. As an advanced user on both Operating Systems (FreeBSD and Ubuntu/RHEL Linux), here is my guide on these two systems.

There is only one FreeBSD, but there are many different variants of Linux. The Linux I mention below refers to two popular distributions: RHEL and Ubuntu.

FreeBSD vs Linux: Q.1 How do you describe yourself?

I am a very demanding person. I like to control everything I manage. –> FreeBSD
I don’t care about how a system is run. I am okay as long as it just works. –> Linux / Ubuntu / RHEL

Comment:
FreeBSD gives you freedom to control every single thing. One of its coolest feature is the port tree. You can build every application from source using port tree. In Linux world, you usually install applications from pre-built/pre-compiled package (yum, apt-get etc), which may not be exactly what you need.

Example:
In RHEL and Ubuntu, HTTP load balancer module does not come with Apache by default. You will need to compile Apache from source. What about in FreeBSD? All you need is to check a box (pretty much like shopping cart) and you are done.

FreeBSD vs Linux: Q.2 Do you prefer Ferrari or Hyundai?

Ferrari / BMW / SLR Camera –> FreeBSD
Toyota / Hyundai / Point and Shoot Camera / Phone Camera –> Linux / Ubuntu / RHEL

Comment:
The technology uses by FreeBSD such as kernel, file system, architecture etc are way better and more advanced than Linux. It’s like comparing Ferrari and Hyundai (And no, I am not kidding).

Example 1:
I need to run some extreme applications (e.g., DNA Sequence Alignment) which use all available threads and memory. The default settings of memory management in Linux is very poor. Every time I run my application, the system becomes not usable to other users. However, FreeBSD does not have this server problem. In fact, FreeBSD is smart enough not to cause the system to freeze. Of course you can tweak the memory management settings in Linux, or even run the command along with the nice command. However, these settings are just not available out of the box, and most of the time, you learn these tricks after your system has problem.

Example 2:
I installed FreeBSD 11 and RHEL 7 on two identical computers respectively. Both use default settings and enable similar services, such as enabling the SSH server and disable booting to X-Windows (RHEL). I used these two machines for exact the same purposes: SSH tunneling, with exact the same work load (evenly distributed). After using them for a month, I checked the memory usage. With FreeBSD, the available memory is about 800MB (out of 1GB), while there are only 200MB left (out of 1GB) on RHEL. Yes, Linux (at least with RHEL 7) consumes lots of memory.

Example 3:
FreeBSD comes with ZFS (The next generation file system) by default. Although it has been ported to Linux world, it is definitely unstable. We’ve tried to use it in a production environment. One thing that we’ve learned is that the ZFS may stop working after upgrading to a newer Linux kernel. I’ve received countless of email alert about missing the files (ZFS is not working, of course the files are gone) in the middle of the night. I ended up disable the auto update and disable the reboot after the update. Sounds familiar? That’s a feature in Windows, and for some odd reasons, this feature is available in Linux, a server.

Example 4:
LVM+RAID is an the most advanced storage method in Linux world. Unfortunately it does not do what it promises, i.e., you may lose your data if a hard drive is failure, even if you follow its directions to detach your failed hard drive correctly. Not to mention that the data will get corrupted if the power is down (which has been taken care of in ZFS, available in FreeBSD).

That’s why I prefer ZFS over LVM+RAID here: Building a Super Large and Reliable File Server with Mixed Size of Harddisks. It solves my problem (yes, even the power is failed during writing to the disk, my data is still safe!)

FreeBSD vs Linux: Q.3 Do you have lots of free time?

Yes: FreeBSD
No: Linux / Ubuntu / RHEL

Comment:
Making a production-ready system using FreeBSD can take you days to weeks if you are not an experienced FreeBSD user, while everything works out of the box in Linux. Sometimes, the new upgrade from the port tree can drive you nut, such as package conflicts etc. However, working with Linux is a leisure thing.

Example:
Installing Apache + MySQL + PHP from FreeBSD port (compiling the source) can take at least half day on a computer with a dual core CPU (AMD Athlon 64 X2 Dual Core Processor 4600+), while it takes less than 30 minutes on Linux. That’s because you need to compile the code from source in FreeBSD, while you simply download the packages and extract them in Linux. The time difference is huge.

FreeBSD vs Linux: Q.4 Do you prefer simplicity or complexity?

Adding sugar into water –> FreeBSD
Taking sugar away from soda–> Linux / Ubuntu / RHEL

Comment:
FreeBSD is a very very simple system. Think of it as a bare-bone system that comes with no junk. By default, it comes with no graphic user interface, no unnecessary application. It likes a pure distilled water.

In Ubuntu / RHEL, everything is configured and ready to use. It comes with very attractive, beautiful graphical user interface. Everything just works out of the box, no tuning or tweaking is required. However, it also comes with lots of junk such as Ubuntu One (For Ubuntu Cloud service), SELinux (A program developed by Red Hat where many people don’t use it), etc. It makes your system very bulky and increase the computation resource consumption.

FreeBSD vs Linux: Q.5 Are you going to use the computer as desktop?

Yes: Linux / Ubuntu / RHEL
No: FreeBSD

Comment:
Setting up a desktop-ready system on FreeBSD can take a long time. Main reason is the drivers availability. A lot of hardware such as graphic cards, audio cards or webcams are not supported in FreeBSD natively. If you want to get them working as good as on Windows / Ubuntu, you will need to get the driver first (if available), build it (which may gives error during compiling the codes), and recompile the kernel to make it supports the new driver, which can take few days if you are not experienced with FreeBSD and debugging driver.

On the other side, the Linux driver community is very strong and well developed. Usually they develop drivers for most popular hardware.

Example:

#1: My Logitech Orbit MP webcam (Pan / Tilt / Zoom) is not working on FreeBSD but works like a charm on Linux.

#2: Some vendors such as Highpoint may stop developing drivers for their products for newest version of FreeBSD.

FreeBSD vs Linux: Q.6 Do you need to blame someone when something goes wrong?

Yes: Linux / Ubuntu / RHEL
No: FreeBSD

Comment:

When something goes wrong, you can blame Linux and you can’t blame FreeBSD.

FreeBSD is a community driven operating system, while some Linux distributions such as Ubuntu and RHEL are backed by commercial vendors. In the world of FreeBSD, it is not uncommon that some unskilled developers introduce bugs, troubles to the rest of the world. Yes, we know it is free, so we can’t complaint about it. However, as an IT administrator, you will need to use your judgement to judge whether those new stuffs are safe to use or not. In short, that will increase your workload. It’s more like Windows update. How many people actually read the change log before hitting the update button?

In Linux (e.g., RHEL), that’s a whole different story. Every patches, new updates have been screened by the vendor before hitting to public. So you can trust them in some degree. And the key thing is, you can blame them when something goes wrong.

Conclusion

In short, use FreeBSD for your personal purpose while Linux for your work. Be the top 5%, not the bottom 95%.

Our sponsors:

Recently I decide to jump into the pool of using diskless Ubuntu. Basically the client computer downloads the necessary files from the Ubuntu server every time during the boot. To keep things simple and easy, Ubuntu does that by using TFTP. So the first step is to set up a TFTP server on the server. For those who haven’t heard of TFTP, it is similar to FTP, except that it has no security feature, and the function is extremely limited. Anyway, here is how to set up a TFTP server on Ubuntu 11.10:

Installing TFTP sounds easy. However, I’ve heard that many people experienced many issues during the installation, such as Error code 2: Access violation issue. That’s why I create this tutorial. If you follow exact the same steps, you will not experience any problem.

First, let’s install all the necessary packages:

sudo apt-get install xinetd tftpd tftp -y

Next, we need to create a configuration file:

sudo nano /etc/xinetd.d/tftp

Put the following content into the file.



service tftp
{
   protocol = udp
   port = 69
   socket_type = dgram
   wait = yes
   user = nobody
   server = /usr/sbin/in.tftpd
   server_args = var/lib/tftpboot -s
   disable = no
}

In the server_args, I have var/lib/tftpboot, which represents the location of the tftp root, i.e., /var/lib/tftpboot. Notice that I skip the root /.

Now let’s change the ownership of the directory:



sudo mkdir /var/lib/tftpboot
sudo chown -R nobody:nobody /var/lib/tftpboot
sudo chmod -R 777 /var/lib/tftpboot

and start the TFTP service:

sudo service xinetd stop
sudo service xinetd start

Verify the TFTP is running correctly or not:

netstat -na | grep LIST | grep 69

You should see something like this:

tcp        0      0 0.0.0.0:69              0.0.0.0:*     LISTEN

Test: Upload a file to TFTP Server

Now let’s test the TFTP server by logging into the server first:

tftp localhost

and upload a file:

tftp> put myfile.jpg
Sent 56733279 bytes in 5.7 seconds

Quit:

q

Make sure that file has been uploaded:

ls -l /var/lib/tftpboot

Test: Download a file from TFTP Server

Now, let’s go to a different directory and download the file we just upload.

cd some_other_directory

and log in to the tftp server again:

tftp localhost

and get the file:

tftp> get myfile.jpg
Received 56733279 bytes in 5.7 seconds

You are done.

Troubleshooting (e.g., Error code 2: Access violation)

If you see a message like: Error code 2: Access violation

Make sure that you:
– Follow the exact procedure in this tutorial
– Make sure that the tftp is started with -s flag.
– Check the permission of the directory, i.e., 777
– After you’ve made any changes to the TFTP configuration, make sure that you stop and start the inet service again.
– Don’t forget to quit tftp before retrying the command.

That’s it!

Enjoy TFTP.

–Derrick

Our sponsors:

Ubuntu was out today, and I could not wait to try out the new features. However I am in the office now and I have no physical access to my Ubuntu box in my kitchen, so using the graphic interface is not an option to me. I searched online and I couldn’t find any tutorial about upgrading the Ubuntu via command line. So I decided to try my own:

First, make sure that your Ubuntu box is up-to-date:

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y

Then, do some preparation work:

sudo apt-get install update-manager-core

Make sure that:

sudo nano /etc/update-manager/release-upgrades
Prompt=normal

Next, we are ready to start the journey:

sudo do-release-upgrade -d

Notice that Ubuntu will complain if you do it via SSH. I don’t care, so I choose “YES”.

Later, it will ask you whether you want to remove the old packages and install the new one. Of course the answer is Yes.

Depending on your CPU and internet connection speed. It can range from 30 minutes to few hours. After everything is done, make sure that you upgrade the system again:

sudo apt-get update -y
sudo apt-get dist-upgrade -y

That’s it! Have fun with Ubuntu 11.10!

–Derrick

Our sponsors:

Recently, I found that my dmesg log are filled of junk. Or I should say it contains lots of errors and complains that I already fix. However, I don’t want to reboot the machine to get rid of these error messages. How can I do it? The solution is very simple.

For FreeBSD and other BSD members, run the following:

sudo sysctl kern.msgbuf_clear=1

For Fedora / Ubuntu Linux, run the following instead:

sudo dmesg -c

Easy?

–Derrick

Our sponsors:

If you think your Ubuntu box is slow. You may want to give Xubuntu a try.

I have a Ubuntu box on a relative old (5+ years) laptop (HP dv1000, Pentium Celerom M + 512MB ram). I mainly use it for lightweight activity such as office and web browsing. Recently, I put this laptop in my kitchen, which required connecting to an external monitor. I found that when I am in graphics mode, the overall system was getting slow.

After some investigations, I have the following conclusions:

  1. The native resolution of the laptop graphic card is 1024×900. Since I connected it to an external monitor (1680×1050), it required more CPU and memory from the system. (It is an integrated graphic card, and it does not have any memory on its own.)
  2. The Ubuntu uses Gnome desktop, which uses more resources and it is not optimized for low-end machine.
 

So I have few options –

  1. Go back to Windows (Guess what, a clean Windows XP runs even much faster than Ubuntu)
  2. Install other high performance system such as FreeBSD
  3. Stick with Ubuntu, but uses a different window manager.
 

I do not prefer the first option because I like to keep a distance from Microsoft product. For the second option, I normally prefer using FreeBSD as a server rather than desktop because of the hardware driver issues. Therefore, I decide to go with the third option. That will minimize the change and impact.

Ubuntu comes with two other siblings, Xbuntu and Kbuntu. Basically, these three systems share the same core, but with different themes, i.e., window manager:

  1. Ubuntu: Gnome
  2. Xubuntu: Xfce
  3. Kubuntu: KDE
 

I have tried these three window managers before. Here are their rankings in terms of fanciness, beauty, and resource consumption:

KDE > Gnome > Xfce

So I decide to give Xubuntu a try. After installing Xubuntu, I found that the overall system is a lot faster and smoother. I know that I’ve made a good decision.

FYI, if you need even more speed, consider to install Window Maker. It is even faster than Xfce!

–Derrick

Our sponsors:

Recently, I decided to turn my HP m7557c computer (motherboard: A8M2N-LA / NodusM-GL8E) to an Unix server. The nightmare began. After trying nearly 10 different operating systems and distributions, I found that only very few of them worked with A8M2N-LA / NodusM-GL8E. I think it is worth to share my experience with this beast – an experiment result that took more than 100 hours.

I have not failed. I've just found 10,000 ways that won't work.
-- Thomas A. Edison
The following operating system are listed in alphabetically:

Fedora 13
Status: No
Comment: Installation went well, but the system was very unstable due to kernel panic. This mother board may not compatible with the newer Linux kernel.

FreeBSD 7.3
Status: No
Comment: Does not support USB keyword, i.e., can’t start the installation.

FreeBSD 8.1
Status: Yes
Comment: Stable, however the harddrives are very unstable. Sometimes the system complains about the harddrive. See the full story here.

FreeBSD 8.2
Status: Yes
Comment: Very stable. No problem found so far.

OS X 10.4
Status: No
Comment: Installation failed.

OS X 10.5.8
Status: No
Comment: Installation completed, but very unstable. The system reboots itself.

OS X 10.6
Status: No
Comment: Installation failed

Ubuntu 9.10
Status: Yes, stable.

Ubuntu 10.04
Status: No
Comment: If install directly from the disk, the system will not boot. The only possible way is to upgrade from an earlier version. See Ubuntu 10.04 – Can’t boot / Can’t install for details.

Ubuntu 10.10
Status: No
Comment: Cannot even load the installation disk.

Hope my experience is helpful to you.

–Derrick

Our sponsors:

Historically, Ubuntu focuses on the user experience such as beautiful graphical user interface, while Fedora focuses on performance. In the other words, the kernel in Fedora distribution is more up-to-dated.

I just upgraded by Ubuntu 10.04 to 10.10 (released on October 10, 2010), I found that the Linux Kernel in Ubuntu is more advanced than Fedora. I am surprised!

#cat /etc/lsb-release && uname -a

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"
Linux 2.6.35-22-generic #33-Ubuntu SMP Sun Sep 19 20:34:50 UTC 2010 i686 GNU/Linux

and for Fedora 13:

#cat /etc/redhat-release && uname -a
Fedora release 13 (Goddard)
Fedora release 13 (Goddard)
Linux 2.6.34.7-56.fc13.x86_64 #1 SMP Wed Sep 15 03:36:55 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

Our sponsors:

Since Ubuntu 10.04 is out officially, I like to give it a try on my media server.

FYI, here is the specification of my media server:

Athlon 64 X2 4600
Chipset: GeForce 6150 LE
Motherboard: Asus A8M2N-LA
Harddrive format: IDE

Note that this is a 2006 model and the system was installed on an IDE drive. That may be the reason why the new Ubuntu 10.04 doesn’t like. Anyway, I tried to install Ubuntu 10.04 using three different methods. Here is the detail:

Trial 1 – Fresh install with Ubuntu 64-bit Desktop installation

Won’t even get into the installation menu.
After selecting to boot from CD, the system was stuck in the blank screen. It couldn’t even go further to the installation welcome menu. So I moved to the the next option.

Trial 2 – Fresh install with Ubuntu 64-bit Alternate installation

Better – But can’t reboot.
The installation went very smooth without a single problem. However, after the installation was completed, it couldn’t boot to the Ubuntu system.

Trial 3 – Upgrade from Ubuntu 9.10 64-bit Desktop installation

Works!
This time, I performed a fresh install using Ubuntu 9.10 64-bit Desktop first. The installation went very smooth. After the installation, I did the following in order:

  1. Updated the hardware driver such as graphic and audio.
  2. Updated the the package information:

    sudo apt-get update -y
  3. Upgraded the system to the latest kernel:
    sudo apt-get dist-upgrade -y
  4. Reboot
  5. Now the Ubuntu 9.10 should be ready to move on the next version.

Next, go to System -> Admin -> Software Update

It will give prompt you that a new version of Ubuntu is available. Click that, follow the instructions and you are done!

Note: I’ve tried upgrading the Ubuntu from command line but it failed. Probably there are some differences between the GUI upgrade and the command line upgrade tool.

Enjoy your new Ubuntu, it is really cool!

What about upgrading from Ubuntu 9.04?

I haven’t tried upgrading from Ubuntu 9.04 to Ubuntu 10.04 before, so I cannot comment. However – I tried upgrading from 9.04 to 9.10 and it failed (from command line and GUI). The system could not boot after the upgrade. FYI, here is the specification of my machine:

Mac G3 400MHz
Harddrive format: IDE

It could be the reason of a different architecture (It is a Power PC instead of i386/amd64). Since it is a 10 yrs old machine, I didn’t spend too much effort to investigate.
By the way, I also tried to install Fedora 12 on this machine and it gives the same problem, i.e., Installation goes fine but the system could not boot.

Our sponsors:

If you cannot decide whether you should go with FreeBSD or Ubuntu (or Linux), check out this article: FreeBSD or Linux in 6 Simple Questions

Recently I am working on building a web farm which is formed by three ancient time computers (The sum of their ages is older than me). Therefore, I need to pick an operating system to make them running efficient enough. Basically here are my criterias:

  • It must be secure. (Sorry, Microsoft Windows, I tried installing Windows Server and the OS got infected by virus in 20 minutes after connecting to Web.)
  • It must be stable and require no reboot. (I have a very good experience with FreeBSD. My longest record of uptime is 6 months so far.)
  • It must be efficient and effective on performance.

So after trying different operating systems, I ran down to three choices: FreeBSD 8, Ubuntu 10 and OS X.

And I finally go with FreeBSD 8. Before I talked about why I kick the Ubuntu and OS X away, let me discuss what methodology I used.

First Test: Extreme Computation

I write a program to calculate the value of pi using Monte-Carlo simulations. For those who are not familiar with this simulation method, basically it try to repeat a calculation for n times and try to determine the value of pi based on the results of calculations. This calculation will use all available CPU resources.

Here is the result from a computer: Pentium II 400MHz + 160MB

  • FreeBSD 8.1 ~ 5 seconds
  • FreeBSD 4.11~ 10 seconds
  • Ubuntu 10.04 ~ 8 seconds
  • OS X 10.3.9 ~ 11 seconds

The result is very obvious, FreeBSD 8.1 is the best candidate in this test. However, the result of my program only gives a very small portion of the picture. So I decide to run another test:

Second Test: Apache Benchmark

No test is better than the real world test drive. Since my primary purpose is for web server, so I decide to test the performance on how Apache perform on different operating systems. My test is pretty simple, I basically ask the Apache Benchmark client to download a page from the test server. The page does three things:

  1. Display a picture
  2. Insert a record into MySQL database
  3. Retrieve the current count from MySQL database

This way I can test the overall performance on how the system handles the file I/O, database I/O and computations.

So the result is pretty interesting (1000 total requests and 100 concurrent requests)

  • FreeBSD 8.1 ~ 200 requests/sec, no failure
  • FreeBSD 4.11~ 150 requests/sec, approx. 20% failure.
  • Ubuntu 10.04 ~ 180 requests/sec, no failure
  • OS X 10.3.9 ~ 160 requests/sec, approx. 50% failure.

I am not surprised with the result because FreeBSD 8 really does a very good job in kernel optimization. Since kernel is the heart(or brain) of all computations, an OS with good kernel is expected to give good results always.

So, I finally pick FreeBSD 8 as the core OS of my web farm, and I am loving it.

Our sponsors: