Wednesday, February 21, 2007

Red Hat Enterprise Linux 5 Beta 2

I recently downloaded the latest beta for RHEL 5 and had a chance to test it out a little. Redhat is moving away from registration keys and is now using "installation numbers" which resemble MS Activation keys. These installation numbers are designed to tie a specific server/installation to a specific Redhat channel to provide a specific set of packages. I can see this as a way to control incoming revenue for Redhat and charge different prices for different channels in much the same way they are doing it now with the AS vs. ES channels.

I was able to test virtualization support included with RHEL 5 which includes Xen 3. The management interface makes it very easy to provision a new virtual machine and monitor resource usage on a host. The one disappointment that I had was that I was not able to use the xm command to get a console to the virtual machine after startup. I could list the running virtual machine and it showed it as "blocked", but it was actually waiting for a graphical login. For some reason there weren't any ttys available for login. I don't have a lot of experience with Xen so I'll have to find a way around this issue.

Anyone out there now the answer to this?

Linux 0.1 Source Available

I was referred here by Digg.com earlier today, but the Linux kernel version 0.1 is available for download from kernel.org:

Download

They say it's around 10,000 lines of code so it wouldn't be as daunting to read through and get familiar with as the latest kernel.

I downloaded the source and took a look at the filesystem code to find the following listing of files:


lu003 linux # pwd
/root/kernel-0.1/linux
lu003 linux # ll fs/
total 108
-rw-r--r-- 1 12041 12005 4735 Sep 17 1991 Makefile
-rw-r--r-- 1 12041 12005 3884 Sep 9 1991 bitmap.c
-rw-r--r-- 1 12041 12005 1786 Sep 13 1991 block_dev.c
-rw-r--r-- 1 12041 12005 6162 Sep 17 1991 buffer.c
-rw-r--r-- 1 12041 12005 1269 Sep 8 1991 char_dev.c
-rw-r--r-- 1 12041 12005 7535 Sep 13 1991 exec.c
-rw-r--r-- 1 12041 12005 1394 Aug 30 1991 fcntl.c
-rw-r--r-- 1 12041 12005 1788 Aug 30 1991 file_dev.c
-rw-r--r-- 1 12041 12005 56 Aug 18 1991 file_table.c
-rw-r--r-- 1 12041 12005 5917 Sep 9 1991 inode.c
-rw-r--r-- 1 12041 12005 935 Aug 30 1991 ioctl.c
-rw-r--r-- 1 12041 12005 14493 Sep 12 1991 namei.c
-rw-r--r-- 1 12041 12005 3846 Sep 8 1991 open.c
-rw-r--r-- 1 12041 12005 1973 Sep 13 1991 pipe.c
-rw-r--r-- 1 12041 12005 2693 Sep 13 1991 read_write.c
-rw-r--r-- 1 12041 12005 1134 Sep 11 1991 stat.c
-rw-r--r-- 1 12041 12005 2421 Sep 17 1991 super.c
-rw-r--r-- 1 12041 12005 1084 Sep 7 1991 truncate.c
-rw-r--r-- 1 12041 12005 4186 Sep 8 1991 tty_ioctl.c
lu003 linux #


That's an incredibly small number of files compared to the current kernel which has many filesystems! Also, look at the dates on these files. I'm considering creating a filesystem of my own so this find is a goldmine and will provide me with some great resources without having to dig through the current code and the numerous filesystems that come with it.

Monday, February 19, 2007

Commodity Hard Disk Drive Failure Analysis

Engadget has an interesting article which details an analysis performed by Google.com on over 100,000 hard drives over a 9 month period. The study behind the article is great as it clears up some common myths in the hard drive world, specifically the effect of temperature on hard disk failure rate. There is a PDF attached to the article with the full study:

Engadget Article

Trouble with Firefox 2.0.0.1 and Macromedia Flashplayer 9

Ever since I upgraded the flashplayer on my Windows XP SP2 laptop to version 9 it has not worked. I found that I had an extension that conflicted with the Flash player (not sure to what extent) and I had to remove that extension to get it to work.

Notice: AdBlock conflicts with Macromedia Flash 9 when using Mozilla Firefox 2.0.0.1 and I removed the appropriate directory in the extensions directory to resolve the issue.

My directory:

C:\Documents and Settings\%username%\Application Data\Mozilla\Firefox\Profiles\.default\extensions

My verification test is to visit http://www.adobe.com/ and watch for the video in the top section of the page. With the adblock extension installed, that video remained blank.

Saturday, February 17, 2007

Gentoo: emerge broken [solved]

Ok, so the gcc missing in the profile error was where the problem was. I ended up restarting the host and things were back to normal on boot-up.

Gentoo: emerge broken continued

Ok, so I have discovered another clue in the puzzle here, when I execute 'emerge --info', I get the following output at the top:

# emerge --info
!!! No gcc found. You probably need to 'source /etc/profile'
!!! to update the environment of this terminal and possibly
!!! other terminals also.

I also see the following in the FEATURES line:

FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"

I had no idea that all features were included if not explicitly excluded, so I added this line to my /etc/make.conf:

FEATURES="-*"

Now I need to hunt down the problem with the missing gcc. I believe that is why portage is failing to update itself. I test this theory by removing the downloaded package and trying to run the same command again:

# rm /usr/portage/distfiles/portage-2.1.2.tar.bz2
# emerge portage -v
Calculating dependencies... done!

>>> Emerging (1 of 1) sys-apps/portage-2.1.2-r9 to /
#

I am not so confident in this theory anymore, as I would have expected portage to be downloaded again, but I am going to continue to resolve the issue with the missing gcc.

Gentoo: emerge broken

The other day I was trying to update one of my servers which was also my local portage mirror when I received the following surprising output:

# emerge portage -pv

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild U ] sys-apps/portage-2.1.2-r9 [2.1.2] USE="-build -doc -epydoc (-selinux)" LINGUAS="-pl" 20 kB

Total: 1 package (1 upgrade), Size of downloads: 20 kB
# emerge portage -v
Calculating dependencies... done!

>>> Emerging (1 of 1) sys-apps/portage-2.1.2-r9 to /
#

So the server was reading the local portage but was unable to install any applications (or upgrade). This is an unusual issue and I have not encountered an issue like this in the 3 years that I have been using Gentoo. To resolve this issue, I am going to attempt to re-install portage from the latest snapshot.

The first step of restoring a corrupt portage install is to download the latest release from distfiles.gentoo.org.

# cd /tmp/ && wget http://distfiles.gentoo.org/distfiles/portage-2.1.2.tar.bz2

Un-tar the package to a safe location out of the way, possibly /tmp/portage_recover (as recommended by the Gentoo Handbook).

# mkdir /tmp/portage_recover && cd /tmp/portage_recover
# mv /tmp/portage-2.1.2.tar.bz2 /tmp/portage_recover
# tar xjf portage-2.1.2.tar.bz2

You will now have a directory structure like the following:

# ll
total 151
-rw-r--r-- 1 portage portage 133926 Jan 14 15:00 ChangeLog
-rw-r--r-- 1 portage portage 1444 Jan 13 13:01 DEVELOPING
-rw-r--r-- 1 portage portage 3934 Jan 14 12:43 NEWS
-rw-r--r-- 1 portage portage 2406 Dec 23 11:05 RELEASE-NOTES
-rw-r--r-- 1 portage portage 1022 Jan 10 22:12 TEST-NOTES
drwxr-xr-x 2 portage portage 2064 Jan 14 15:00 bin
drwxr-xr-x 2 portage portage 752 Oct 16 12:01 cnf
drwxr-xr-x 2 portage portage 368 Jan 13 23:00 man
drwxr-xr-x 4 portage portage 920 Jan 14 15:00 pym
drwxr-xr-x 4 portage portage 144 Aug 1 2006 src
drwxr-xr-x 6 portage portage 224 Jan 14 14:54 tests

Now the trick is to copy the appropriate binaries and scripts from this location to your system.

# cp -R pym bin /usr/lib/portage/

Unfortunately, this does not solve my problem:

# emerge portage -v
Calculating dependencies... done!

>>> Emerging (1 of 1) sys-apps/portage-2.1.2-r9 to /
#

So I am back to the troubleshooting board.

Thursday, February 15, 2007

Creating Virtual IP Addresses on Linux

Virtual IP addresses (or VIPs) allow you to use multiple IPs on a single physical network interface. Creating virtual IP addresses is often done to allow webservers to host multiple SSL encrypted web sites on a single webserver or to allow cluster suites to communicate on a dedicated IP address. This article will cover the two primary means of creating virtual IPs on a Linux host.

ifconfig

The first and most common method employed is to use the Linux command 'ifconfig' to create a VIP in the following manner, assuming that the interface being used is eth1.

# ifconfig eth1:0 192.168.1.28

This command will create a VIP on eth0 with a name of eth1:0 and will look like the following:

eth1:0 Link encap:Ethernet HWaddr 00:14:6C:83:39:92
inet addr:192.168.1.28 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:33442 errors:0 dropped:0 overruns:0 frame:0
TX packets:38225 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20240563 (19.3 Mb) TX bytes:3483829 (3.3 Mb)
Interrupt:18


This command creates an apparent separate device from eth1 with it's own IP address, netmask, and broadcast address. This VIP can now be used to host services and servers, fielding connections to clients or other hosts.

To remove the VIP, simply execute ifconfig on the device with the down command:

# ifconfig eth1:0 down

iproute2

The iproute tool set is tremendously powerful and not often used, even by experienced administrators. The description of the ip command from the man pages describes this suite well:

ip - show / manipulate routing, devices, policy routing and tunnels

While one can easily perform complex tasks on the network stack of any Linux host with this tool, this article will restrict it's coverage to creating VIPs. The command to create a VIP using the ip command is as follows:

# ip addr add 192.168.1.28 dev eth1


Interesting enough, when the previous command is issued, ifconfig does not show anything different. To see the new VIP, one must use the ip command as follows:

ip addr show

When this command is executed, the output will appear like the following:

3: eth1: mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:14:6c:83:39:92 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.10/24 brd 192.168.1.255 scope global eth1
inet 192.168.1.28/32 scope global eth1

This output is similar to that of a more traditional UNIX variant when compared to the output of ifconfig. The VIP created here can now be used for any purpose deemed suitable by the administrator.

To remove the VIP, execute the ip command with the following options:

ip addr del 192.168.1.28/32 dev eth1

Note that the device must be specified when creating and deleting the VIP for it to function properly. Note also that the subnet mask was specified on the deletion command and that this is not required.

Conclusion

Creating VIPs is a very simple task and one that can benefit every system administrator. Once learned, these techniques will be a great asset for common networking tasks.