Friday, March 20, 2009

The OS War and why opinions do not matter

So many things to do and so little time to blog. The last few months have been a fun roller coaster ride in the OS world. I had the opportunity to become a power user in OpenSUSE, CentOS, FreeBSD just to name a few. I use the words "power user" in a very humble way since one never stops learning new features. Here is a brief overview of what struck me in each one of those Operating Systems. I will include what I consider strong/weak points of each and what in the end are just options on a diverse software ecosystem that is constantly expanding.
  • OpenSUSE
Yast is great central tool to tweak and configure servers and I just wish all distro's come with it. Webmin and the other range of web interfaces do the job of basic configurations but I would not want to do root work over the web on production servers. Yast happens to the only thing I liked about *SUSE that would make me switch from Ubuntu to it. Theme wise I do not see which one is worse, Ubuntu's brown or OpenSUSE green. I personally do not like either one of those colors for a Desktop.
  • CentOS
CentOS brings the same features and benefits that RedHat offers at an affordable price $0. It offers the Linux community a secure/stable distro such as RedHat at a price one cannot afford to pass. Makes it a great distro for a data center or where one must run Linux and make sure the OS is patched decreasing cost adding value. The drawback is that you are running a kernel from a few months/years ago but contains some features that are backported from current kernel. On the other side, I have never been thrilled with RPMs and prefer the Debian package format.
  • FreeBSD
Fact, FreeBSD and its port collection is wonderful. It is so good that my future servers are based on it. So easy to use, stable and with so many packages available makes it for the perfect server. Aside from the fact that is a very secure OS and have a extensive software collection it is easy to install and offers in my opinion the best file system available today, ZFS. I strongly feel that FreeBSD could one day become the best server OS while Linux the perfect Desktop OS but only time will tell. Development of FreeBSD is a bit slower compared to Linux perhaps due to the smaller community behind it.
With that said, these are my opinions and I strongly believe there is no such thing as "The Perfect Distro/OS" as one release does certain things better than the other. In the end System Administrators are more concerned with system stability/uptime, data security, customer satisfaction and last easy to use and manage. It is hard and perhaps idiotic to put my 2 cents to a subject that has gone thorough a lot of heated discussions over the pass years and never reaches a conclusive winner. The winner is perhaps the people that are empowered by having the freedom to choose on what to use.

Thursday, June 19, 2008

Quad Cores gone wild

Interesting to see how computing power has gone up in the past few years - not that this is something I just discovered but here is a nice comparison.

I had an old PC (AMD Athlon 64 3500+) that handled about 200 megaflops on the Linpack benchmark test, then ran the same test on an Intel Pentium D 3.0Ghz (different hardware) and got 740 megaflops. I have upgraded the Pentium D machine and kept the same hardware except for the CPU. The new machine, an Intel Core 2 Quad Q6700 2.66 GHz, scored a whopping 1310 megaflops on the Linpack test. All these test result done without any overclocking or additional cooling besides the heat sink fans. I have also compared my results by calculating the value of Pi to 5000 places and finding the primer numbers using the Sieve of Erastosthenes. Here is the raw output of my results:

Intel Pentium D 3.0Ghz
albert@ubuntu-desktop:~/Desktop/bin/bench$ ./pi.sh 5000
Please wait, calculating Pi to 5000 places ...
real 0m46.251s
user 0m46.011s
sys 0m0.140s

albert@ubuntu-desktop:~/Desktop/bin/bench$ java Linpack
Problem size: 500
Mflop/s: 555.188 Time: 0.15 secs (0.151 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 776.235 Time: 0.11 secs (0.108 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 670.667 Time: 0.13 secs (0.125 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 681.572 Time: 0.12 secs (0.123 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 649.871 Time: 0.13 secs (0.129 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 762.121 Time: 0.11 secs (0.11 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 676.075 Time: 0.12 secs (0.124 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 620.988 Time: 0.14 secs (0.135 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 654.948 Time: 0.13 secs (0.128 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 741.888 Time: 0.11 secs (0.113 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16

albert@ubuntu-desktop:~/Desktop/bin/bench$ java Sieve
Running Sieve benchmark.
This will take about 10 seconds.
84827 iterations in 10.0 seconds
Sieve score = 8483


Intel Core 2 Quad Q6700 2.66 GHz
albert@ubuntu-desktop:~/Desktop/bin/bench$ ./pi.sh 5000
Please wait, calculating Pi to 5000 places ...

real 0m31.277s
user 0m31.214s
sys 0m0.052s

albert@ubuntu-desktop:~/Desktop/bin/bench$ java Linpack
Problem size: 500
Mflop/s: 1022.358 Time: 0.08 secs (0.082 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 1251.244 Time: 0.07 secs (0.067 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 1270.202 Time: 0.07 secs (0.066 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 1270.202 Time: 0.07 secs (0.066 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 1270.202 Time: 0.07 secs (0.066 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 1289.744 Time: 0.07 secs (0.065 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 1270.202 Time: 0.07 secs (0.066 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 1289.744 Time: 0.07 secs (0.065 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 1289.744 Time: 0.07 secs (0.065 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16
Mflop/s: 1309.896 Time: 0.06 secs (0.064 sec) Norm Res: 5.68 Precision: 2.220446049250313E-16

albert@ubuntu-desktop:~/Desktop/bin/bench$ java Sieve
Running Sieve benchmark.
This will take about 10 seconds.
163433 iterations in 10.0 seconds
Sieve score = 16343

Friday, May 2, 2008

Computer Science Degree

School is over. I must confess that I am proud of my Computer Science degree as it marks a good accomplishment in my professional career. I get to call myself a "Professional" even though I've worked as one for some time. A degree certainly prepares you better for the challenges to come and develops your problem solving skills. With that said, I do not consider having a degree makes an individual stand over another but I do believe it is important to have one.

The question now is, Master degree? Is it really worth it and in which field? I guess for the love of learning it is worth it but then one does not need an institution to learn.

Saturday, October 20, 2007

Upgrade Ubuntu from an ISO image

Here is a tip I ended using on a machine that didn't have a CD drive and no connection to the internet. It already had Ubuntu installed and needed to upgrade to the next release. First you need to download the Ubuntu Alternate CD image (text base install) ubuntu-7.10-alternate-i386.iso
  1. Mount the downloaded ISO image in the CD drive mounting point by typing the following:
    sudo mount -t iso9660 ubuntu-7.10-alternate-i386.iso /cdrom -o loop
  2. Run the upgrading application found on the CD.
    gksu "sh /cdrom/cdromupgrade"
  3. The machine will now upgrade and eventually reboot. You may now remove the CD entry to the image found in the file: /etc/apt/sources.list
You might want to keep the image for software sources and mount it anytime you wish to install new software.

Saturday, September 22, 2007

Ubuntu Gutsy world

I have decided to upgrade my main desktop to the development version of Gutsy Gibbon. I tend to do my Linux upgrades a month ahead of the release day in order to avoid the slow downloads and also to help testing. But lets face it, we all like to be the first ones playing with a new toy.

The upgrade pulled back about 900 MB of data and 2 hours later I was running Ubuntu Gutsy. The only issue I noticed was that the kernel didn't get upgraded to the latest one in Gutsy which is 2.6.22. I still was running 2.6.20 because the package "linux-generic" was not installed. Such package is needed in order to pull the latest version of the kernel. Aside from this issue I have not had any other problems considering that this is still in development. From the screenshot in the left you will notice that I have installed a new GNOME theme and icon set. I am just not a fan of Ubuntu's defaults.

Tuesday, September 4, 2007

Samsung Q1 Ultra


New toy! Comes preloaded with Windows Vista, boots and runs a bit slow. Battery life is great since I got the extended battery on it. Keyboard keys should be a bit more spaced out unless you have baby fingers. Comes with 2 USB ports, front and back camera, external monitor output and a few other goodies.

It is actually my first tablet PC and I am starting to get used to the stylus. Handwritting recognition works Ok but I would not bother using it for more than 20 words.

I would say that this is more for internet browsing, game playing maybe even as an electronic book. I guess it's too early for me to tell but I sure like it so far.

Thursday, August 23, 2007

How to install Ubuntu from a USB flash drive

The title says it all and this is how I did it. Make sure your machine can boot from a USB device and that you have a pen drive that is at least 1 GB in size. This installation refers to a Feisty install but you can apply the same concept to Gutsy or Gutsy++. Be careful with the commands you type as one wrong digit can format your hard drive erasing all its data. I am not responsible for any damage you do to your machine. If you have never formated a computer or installed and Operating System, ask for help before going forward.

I woud say not to copy paste the commands as this can lead to errors on your side.

Insert the pen drive in the USB slot and wait until Ubuntu mounts it.

You must get the location where the USB drive mounts and this is the most critical step. Type the following and notice the mounting point where the USB drive is located:
df -hT


This command should give you all the drives that are available. In my case my USB drive mounting point shows up like this along with the other drives:

/dev/sdb1 vfat 957M 704M 254M 74% /media/disk

From now on I will refer to my mounting point as: /dev/sdb1 in your case you will need to change this to the one you obtained from the df -hT command.

Install the following two packages: syslinux mtools
sudo aptitude install syslinux mtools

Next we need to download the kernel that is going to boot the pen drive. Change the feisty part below to the release that you will be installing. Keep in mind that this is a i386 machine and you need to change accordingly. http://archive.ubuntu.com/ubuntu/dists/feisty/main/installer-i386/current/images/hd-media/

Download these two files:
vmlinuz
initrd.gz

Next download the Alternate CD iso image from the Ubuntu download page. Keep in mind that this installation only worked for the Alternate CD. I tried doing a regular Desktop install but the process failed on me.
In this case my iso file name is: ubuntu-7.04-alternate-i386.iso

Unmount the flash drive by typing:
sudo umount /dev/sdb1

Now lets partition the pen drive with this command:
cfdisk /dev/sdb

/dev/sdb is the actual mounting point I mentioned above. Notice that you do not need the number 1 at end. Using the incorrect mounting point will erase your hard drive. Be Careful.
Keep in mind that we are going to erase all the data in the flash drive.

Do the following while in the cfdisk partitioning program:
  1. Erase any existing partition and then create a new "Primary Partition."
  2. Press "t" to select the partition type. Enter "0B" for a FAT32 partition.
  3. Make the partition bootable.
  4. Write the partition changes and exit the cfdisk program.
Now we are going to format the new partition created above. Once again change the /dev/sdb1 accordingly to your mounting point for the pen drive. The following command is going to format partition number 1 to a FAT32:
mkdosfs -F32 -v /dev/sdb1

Note that if the above command failed you need to make sure the USB drive is unmounted.

Install the boot loader in the flash drive first partition:
syslinux /dev/sdb1

Mount the flash drive and copy to it the files downloaded above:
vmlinuz
initrd.gz
ubuntu-7.04-alternate-i386.iso

Create a new file in the pen drive with the following 2 lines:
default vmlinuz
append initrd=initrd.gz ramdisk_size=700000 root=/dev/ram rw

Save the file with this name: syslinux.cfg

Your pen drive should now have 5 files in the same place:
initrd.gz
ldlinux.sys
syslinux.cfg
ubuntu-7.04-alternate-i386.iso
vmlinuz

We are done. Now you will need to go into your computer's BIOS during boot. Select that you wish to boot from the USB device first instead of going to the Hard Drive or CD-ROM.

Sunday, July 22, 2007

Script to do encryption of files and directories

I have been working on a script that encrypts and decrypts files and directories in Linux. I could have used GnuPG but I wanted to try a different method that does not need to generate a public and private key. In the long run gpg offers a stronger encryption method that using openssl. The script generates a .des3 file that is first compressed and then encrypted.

#!/bin/bash

function getpass() {
stty -echo
echo -n "$2"
read pw
stty echo
echo
eval "$1=$pw"
}

function usage() {
echo "crypt - encryptor and decrytor utility."
echo -e "\tcrypt e [Directory or File to be encrypted]"
echo -e "\tcrypt d [File to be decripted]"
exit 1
}

if [ "$1" = "e" ]; then
if [ ! -e "$2" ]; then
echo "Error: An invalid file or directory name to encrypt was given."
usage
fi
getpass pass "Enter the password: "
getpass passconfirm "Re-enter the password: "
if [ "$pass" != "$passconfirm" ]; then
echo "Error: Passwords did not match."
usage
fi

tar -czpf - "$2" | openssl des3 -salt -k "$pass" | dd of="`basename "$2"`.des3" > /dev/null 2>&1
exit 0
fi

if [ "$1" = "d" ]; then
if [ ! -f "$2" ]; then
echo "Error: An invalid file to decrypt was given."
usage
fi
getpass pass "Enter the password to decrypt the file: "
tmpfile="/tmp/`echo \"$2\" | sed 's/\.des3$//'`.tar.gz"
openssl des3 -d -salt -k "$pass" -in "$2" -out "$tmpfile" > /dev/null 2>&1
if [ "$?" -eq 1 ]; then
echo "Error: invalid password was given."
rm -f "$tmpfile"
exit 1
fi
tar xzpf "$tmpfile"
rm -f "$tmpfile"
exit 0
fi

usage
# end of script