Open Source Software and Linux: September, 2008 archives

Open Source Software and Linux:

September, 2008

Sep 30 2008   1:12AM GMT

Using tune2fs to tune your ext3 file system



Posted by: John Little
linux file system, ext3, ext2, journaling file system, dumpe2fs, tune2fs

Linux has the capability to use a large number of file systems. Generally you will find the ext3 file system on the Red Hat style operating system as the default.

The ext3 file system is a journaling file system. Journaling is process by which a file system logs changes to the file system during disk writing so that a corruption causing event such as a power outage will allow the data to be reconstructed so that the writes can be cleanly written to the disk.

Thetune2fs command is used to tune the ext3 file system. You can set parameters such as maximum mount count and different behaviors when an error is detected by the kernel on the file system.

The maximum mount count for an ext3 file system is set to 20 by default. To set the mount count to 0, which is useful when using the Red Hat Cluster Manager, you would issue the following command:

tune2fs -c 0 /dev/hda1

The file system has three error modes when the kernel detects an error on the file system. These are:

>continue Continues normally
>remount-ro Remounts the file system read-only ready to fsck
>panic Causes the kernel to panic which stops the system. This is not recommended unless you are a system tester.

An ext3 file has a reserved percentage setting. This is space that is only available to the root user. The root user can also associate this space with a system group. This is done with the -g option:

tune2fs -g admins /dev/hda2

To check your file system parameters use the dumpe2fs command:

[root@centos5-lt ~]# dumpe2fs -h /dev/mapper/laptop-root
dumpe2fs 1.39 (29-May-2006)
Filesystem volume name:
Last mounted on:
Filesystem UUID: c5167029-83e6-488a-98fa-400cc7932191
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 5124480
Block count: 5120000
Reserved block count: 256000
Free blocks: 637276
Free inodes: 4805027
snip

You can read about setting many more parameters for your ext3 file system by reviewing the man page “man tune2fs”.

j-j

Sep 25 2008   1:49AM GMT

Top, PowerTOP and mod_top - three powerful monitoring tools



Posted by: John Little
power management, top-cpu, linux top, mod_top, powertop, open source monitoring. linux monitoring, apache monitoring, linux power management, linux apache mysql php LAMP

Anyone who has used or administered Linux for any length of time has used the open source application Top. Now there are at least two others to help monitor different areas of your Linux machine. The are PowerTOP and mod_top.

Top is the application that provides information on the applications that are using the most CPU or memory. It shows the nice level of the application which really comes in handy if it is an application that you want to use but want it to have a lower priority. Beagle was one such application that I found on my machine at one time. Top is generally installed by default on most distributions.

Now in addition to Top for the operating system there is mod_top. mod_top is a module that works with the LAMP stack. mod_top monitors LAMP applications that are using PHP 4.4 and 5.x applications. The user interface is modeled after the standart Top applicaton mentioned above. mod_top can help locate application bottleneck and an applications using high memory.

mod_top is quite simple to install. Simply download and unpack the source, type make, create a symlink and add a line to your php.ini file.

The other Top application that is very useful is PowerTOP. This top is designed to help you find applications that are misbehaving when your computer should be on idle. PowerTOP combine information from various kernel and userspace sources so that you can see which applications are consuming power when they shouldn’t be.

The PowerTOP website states that PowerTOP has four basic goals:

PowerTOP has these four basic goals:

* Show how well your system is using the various hardware power-saving features
* Show you the culprit software components that are preventing optimal usage of your hardware power savings
* Help Linux developers test their application and achieve optimal behavior
* Provide you with tuning suggestions to achieve low power consumption

To build the application just type make and then run the program…

tar -zxf powertop-1.9.tar.gz
cd powertop-1.9
make
make install
powertop

There you have it! At least three versions of the Linux Top applicaton to help you monitor, troubleshoot and keep your machines running in top condition. Enjoy!

-j


Sep 22 2008   7:56PM GMT

Tux Paint - Not just for kids!



Posted by: John Little
tux paint, paint, ms paint, microsoft paint, linux paint, paint program, tux, paint application

Have you ever used the open source application Tux Paint? Tux Paint bills itself as “Tux Paint is free computer art software for children” or “Tux Paint is Open Source Drawing Software for children”. While that may be the market the Tux Paint developer’s are targeting don’t be fooled into thinking that this is an application that only children will enjoy.

My daughter started using this software when she was five (she just turned 8). Within a couple of months she had over 200 original drawings saved on my hard drive. Some of these I still use as my desktop background on occasion. It’s not that they are that good, but like all parents I like to have something around that reminds me of the joy of my children.

I also firmly believe that this helped her develop in many ways. She has excellent hand eye coordination, since she was using a notebook with a touchpad and keyboard. The application has a text box. Using this she learned how to spell her name and a few other words. She now makes drawings at school that are colorful, well drawn, detailed and tell you exactly what was on her mind when she drew the picture. For instance we recently adopted a dog. He is very well trained except that he likes to chase our cat that we’ve had for several years. She came home from school the other day with a picture of this that included the grass in the yard, the blue sky, the sun and of course the dog, with it’s mouth wide open chasing the cat.

Along with all of that I found that watching her draw all of this with Tux Paint was quite enjoyable. Enjoyable enough that I started drawing with it myself. I’m no artist and don’t even really mix colors well let alone draw shapes and sizes. Because of the many different tools that Tux Paint provides I found that even I could draw something reasonable. - at least by the standards I set for myself :-) Looking at some of the drawings on the Tux Paint Gallery I get the feeling that I am not the only adult who likes to draw with this excellent application.

Start Page for Tux Paint
start-page

Coloring book page from Tux Paint
Tux Paint coloring book page

Using stamps from Tux Paint - You can even add your own!
Tux Paint Stamps

Tux Paint provides a plethora of tools to use to get exactly the drawing that you want. Not only do you get the standard assortment of brushes to use but you can create your own, make them change shape depending on which direction that they are used but you can even animate them! Tux Paint provides sound effects when tools are selected and used. They have rubber stamps, line tools and text tools. My favorite though are the Magic tools. With these tools you can make ripples in the water, make clumps of grass, make part of your drawing look like a cartoon or even draw bricks.. On almost all of these it is possible to add depth to your drawing since they can be drawn in different shapes and sizes.

So go on have some fun with your kids! Have some fun for yourself! Tux Paint is a truly enjoyable open source application that you and your family will love to use!

-j


Sep 19 2008   7:47PM GMT

Convert your dpkg, rpm, tgz and slp applications to another package with alien



Posted by: John Little
Linux, solaris, sun, debian, slackware, sun solaris, red hat, convert, centos, alien, RPM, deb, package conversion, linux package conversion

alien is software that allows you to convert an rpm package to dpkg or vice versa. It can also convert a .tgz package to the rpm or dpkg format allowing you to use software that has been packaged for a different package manager on your machine.

The latest version release is 8.72. The author of the software states that even though the version number is high alien should be considered experimental software and should not be used to convert or replace important system packages. That said alien has been in use many years and converted many packages.

The CentOS repositories don’t show an alien package. Apparently this seems to be a debian thing. Never fear though, alien to the rescue before ever installing the package!

First obtain the source package, unpack it and cd into that directory:

wget http://ftp.de.debian.org/debian/pool/mai…
tar xzvf alien_8.72.tar.gz
cd alien

Don’t install it! We get to have that fun here in a couple of steps. Now get the alien*deb package and download it into the source directory which you just unpacked. Once that is done we’ll convert the deb package to rpm and install it.

wget http://http.us.debian.org/debian/pool/ma…
./alien.pl -r alien_8.72_all.deb
alien-8.72-2.noarch.rpm generated
ls
Alien alien_8.72_all.deb alien.lsm.in alien.spec debian GPL Makefile.PL README
alien-8.72-2.noarch.rpm
rpm -ivh alien-8.72-2.noarch.rpm
Preparing… ########################################### [100%]
1:alien ########################################### [100%]
which alien
/usr/bin/alien

There you have it! You now have alien and can convert your favorite rpm packages to deb or deb packages to rpm. Enjoy!

-j


Sep 17 2008   12:34PM GMT

TheBrain visualization mind mapping software



Posted by: John Little
knowledgebase, thebrain, brain software, mind map, mindmap, mind mapping, visual knowledge, mindmapping

TheBrain is highly visualized mind mapping software. I tried out this software using the PersonalBrain. The PersonalBrain is a free version of TheBrain software available for personal use. TheBrain software is cross platform and available for Linux, Windows and Mac.

Webster’s dictionary defines a mind map as

a diagram used to represent ideas or information branching from a central key word or idea and used as an aid in study, organization, problem solving, decision making, and writing

Reference:

“mind map.” Webster’s New Millenniumâ„¢ Dictionary of English, Preview Edition (v 0.9.7). Lexico Publishing Group, LLC. 14 Sep. 2008.

This first thing that I noticed about TheBrain is the visualization of the mind map. The graphics for this application are outstanding.
theBrain-virtualMachines

The 2nd thing that I noticed is the ease of use of this powerful software. To start you create a new brain by clicking on File=>New Brain and naming it. Once you have your brain started right click on it to create a Parent and Children for the subject of the your brain.

TheBrain software is animated. Once you have the Parent(s) and Children of your brain created you can click on any one of these to bring it into focus. This will expand all associations with that particular part of you brain.

TheBrain goes even further in making your ideas and concepts into an integrated knowledge base. You can attach supporting documents and links to web pages to any thought or process in your brain.

TheBrain is an excellent tool for collaboration between individuals and groups. Your brain can be exported as a static html page. If you have a web server you can export it complete with it’s xml files for the complete animated package. You can also zip it and send to colleagues.

The developers of TheBrain software provide many tools for making TheBrain as useful as possible to you. In addition to the typical forums every Friday they have a free Getting Started webinar from 10am to 11am PDT.

TheBrain software does an excellent job of putting the information together described in Webster’s definition of a mind map. It has won several awards including one of KMWorld’s 100 Companies that Matter in Knowledge Management for its 6th year.

So go put your thoughts together with your new visual brain. You’ll be glad you did!

-j


Sep 15 2008   8:28PM GMT

VIM Shortcuts



Posted by: John Little
windows, Linux, vim, editor, vi, text editor

I like the VIM text editor. Yes, VIM took some getting used to. Yes, VIM requires that you use a keyboard although there is now a graphical VIM for Windows and Linux which is pretty cool as well.

I am writing this so that maybe you will begin to like the VIM editor. Once you get used to the keyboard it becomes quick and easy to edit your text files. You may even get to avoid Carpel Tunnel Syndrome.

Ok so let’s get to it shall we?

Saving a file
To close a file without saving type ctrl +q. To save a file type ctrl + w. To save and close a file type ctrl + wq or ZZ (yes those are caps).

Ok, all of that was straight forward and anyone who has used VIM knows these things.

Let’s try a few more.

To open a file at a given line number type vim + <line number> . To open a file at the first instance of a word type vim +/<word to find> .

Ok let’s do some work inside of a file.

Basics
To undo text that you have entered type u and to undo all changes to a line type U. Typing :e! will revert back to the last saved copy of a file if you really mess up. To create a new line below the cursor type o and to create a line above the cursor type O. For searching a string use /<string to find> to search to the right of the cursor and ?<string to find> to the left of the cursor.

Deleting text
To delete a line place the cursor on the line and type dd. To delete several lines type <number of lines to delete>dd. For instance 3dd would delete the line where the cursor is and the next two lines. To delete all text from the cursor to the end of the line type D. For deleting all the text from the beginning of the line to the cursor type d. To delete all of the lines from the cursor to the end of the screen type dL and to delete all text from the cursor to the end of the file type dG. To delete all of the text from the cursor to the beginning of the file use d1G. If you want to delete all text from the cursor position to a given line number type d#$ where # is the line number of the specified line.

Changing text
If you want to change a word move the cursor to the beginning of the word and type cw. Note that the cursor will only remove up to any special character, punctuation or space. If you want to change the current sentence type cs. To change the current line type c$ or C. Note that preceding the command here with a number, as in most VIM commands, will change that number of words, sentences or lines.

Copying and pasting
To copy a line or lines type yy on the line with the cursor. To copy several lines from the location of the cursor down type <number of lines to copy>yy. For instance 5yy would copy the line where the cursor is and the next 4 lines. To paste those lines below the cursor type p and P to paste them above the cursor.

Ok now let’s have some fun!
How about finding and replacing a word or group of words in a file? Easy and fast. Let’s say we want to replace the word module with the words kernel module. At the VIM prompt type:
:%s/module/kernel module/
That would replace the first instance of module with kernel module. But what if you want to replace all instances? Simply add a g at the end of the line:
:%s/module/kernel module/g
If you want confirmation each time before the replace add a c to the end of the above:
:%s/module/kernel module/gc

How about opening another file from which you want to copy something into your current file? This is quite a simple operation and with VIM’s tab completion, which works much the same as bash tab completion, it is really a snap. Ok let’s say we have two files, a sample file in /home/jslittl/sample.txt and a config file in /etc/myapp/app.conf.

Let’s open the application file:
vim /etc/myapp/app.conf
Now open the sample file. Remember we have tab completion so you can use that. In the file that you just opened type:
:split /home/jsl<tab>/samp<tab>
Now the sample file is open and your cursor is in the sample file. Move the cursor to the line that you want to copy and type:
yy
and then:
ctrl w
to move into the app.conf file. Move the cursor to the line above where you want to paste and type;
p
Easy stuff huh?

The real beauty of an application like VIM starts to shine when you telnet or ssh into a remote machine and have to edit a configuration or ini file.

I hope that you picked up a pointer or two from this that will help make your work quicker and easier. I know I became more efficient when I learned some of these shortcuts.

-j


Sep 13 2008   8:46PM GMT

Netbooks, Notebooks, Windows and Linux



Posted by: John Little
windows, Linux, notebook, netbook

Most of us have heard of the Netbook. You know, the small 7″ screen Linux powered EeePC from ASUS. Of course Dell, Acer and MSI have joined in the fray. That’s fine. Competition is a good thing.

For one reason or another, probably because ASUS did not set reasonable expectations about what a netbook is capable of, or more to the point what it is not, they had a 35% return rate according to some sources. You see people bought the netbook with the idea in mind that it was a cheap notebook. They bought it wanting to hook up printers, cameras and other devices to their shiny new cheap computer. They were disappointed. Things happen.

What really gripes me though are articles like this one. This writer alludes to the idea that the problem was not the lack of capabilities of the the netbook, but instead that it was because the netbook had Linux installed as the operating system. He then goes on to extol the virtues that the netbook will have when the manufacturers begin to install Windows XP and Windows Vista Home.

Now don’t misunderstand me. I think people should have choice. If someone wants to use Windows that is their choice. I can and do use and administer both. It’s just that my preference is to use Linux because I find it easier use as a workstation and in many cases as a server. But when I read an article like the one mentioned above, that among other things, states that the netbook is an underpowered computer, and then goes on to say that it will zing with a bloated operating system like Windows Vista, I have to question the validity and purpose of such an article.

It seems to me the article was written, at least in part, to take a shot at Linux. Maybe, maybe not. I don’t know. What do you think?

-j


Sep 13 2008   12:26AM GMT

Grub and boot errors



Posted by: John Little
Linux, red hat, centos, grub, /root, grub.conf, menu.lst, vmlinuz, initrd

If you’ve administered or customized Linux long enough you’ve no doubt created a situation at some point where, during the boot process, that GRUB throws an error. We’re going to discuss some of these situations below along with ways to work through them.

If a file name or partition in the GRUB configuration file is incorrect GRUB won’t be able to find critical files such as the Linux kernel. For instance if the root directive points to something other than the /boot directory GRUB will throw one of the following errors:

Error 17: Cannot mount selected partition
Error 27: Unrecognized command
Error while parsing number
Cannot mount selected partition

If the GRUB configuration file is completely missing you will see the following:

grub>

If you find yourself at this prompt you can find a list of available commands by hitting the tab key.

The first thing that you are going to want to do in any of these cases is check and make sure that your root directive is correct. To do this, at the grub prompt, use the find command to locate the GRUB configuration file. Your search would begin something like this:

grub> find (hd0,0)/grub/grub.conf

where hd0,0 is the 1st hard disk and the 1st partition on the hard disk. Repeat the process using the various partitions on the 1st disk (hd0,1 hd0,2) and so on until you find the configuration file. If the partition is not found you will get an error:

Error 15: File not found

Once you have found the GRUB configuration file check it’s location against what the boot loader is showing. You can check the contents of the file by using the cat command:

grub> cat (hd0,0)/grub/grub.conf

Another way to find the same information is to locate the stage1 boot loader file:

grub> find /grub/stage1

You will see output specifying the /boot partition:

(hd0,0)

Perhaps the most simple way to get this information is to simply type root at the prompt:

grub>root
(hd0,0) : Filesystem type is ext2fs, partition type 0×83

Command completion also works from the GRUB command line. If you don’t remember the name of the kernel file type kernel / and press the tab key. This will show you the available files in the boot directory. The same holds true for the initrd file.

To sum all of this up and get your machine booted, at the GRUB configuration file type c for the GRUB command line. You should be at the grub> prompt.

Start by issuing the root directive as described above. This will set up your /boot partition. Now setup your kernel command line as described above. Remember that you can use command completion as this is a long line. At the prompt type:

grub> kernel /vmli (hit the tab key to complete the vmlinuz line).

You will also need the root=/your/root/partition directive on this line for Linux to boot. Last setup the third line by typing initrd which specifies the initial RAM disk.

grub> initrd /init (hit the tab key to complete the initrd line)

Now enter boot at the command prompt and your Linux machine should boot if you have the correct parameters.

Of course you could possibly prevent all of this by keeping a backup copy of the GRUB configuration file in the root’s home directory at /root.

-j


Sep 11 2008   12:36AM GMT

Troubleshooot your Linux boot process with GRUB



Posted by: John Little
Linux, /boot, grub, /root, grub.conf, menu.lst

Red Hat and subsequently Fedora and CentOS use the the GRUB (Grand Unified Boot Loader) to initialize the kernel and boot into Linux. I’m going to look at some of the common error messages possible when booting Linux and how to edit the GRUB boot loader to test and fix the errors.

GRUB has 6 basic editing commands:

b=boot the currently listed operating system
d=delete the current line
e=edit the current line
a=append a parameter to GRUB
o=create an empty line underneath the current line
O=create an empty line above the current line

These are the commands with which I will initially be working to access the grub configuration file.

After you boot to the GRUB menu screen highlight the line the Linux version that you want to edit. I like to use e so that I can choose which line that I want to edit.

On Red Hat and it’s derivatives you will usually see three lines at this point:

root
kernel
initrd

While any of the three could need editing to pass a parameter to the kernel you will want to use the kernel line. Highlight this line and press e to edit. Move to the end of the line to add a parameter. The kernel has many parameters that you can add here. I will use some of the more commonly used.

Booting into a different runlevel is probably one of the most common tasks of a Linux administrator. The Red Hat kernel has 7 parameters that you can use to boot to the runlevel that you want. These are 1, single (or s), emergency, 2, 3, 4, or 5. If you add single or s to the end of this line you will boot into single user mode. If you boot into runlevel 0 or 6 you will either halt or reboot your machine.

Another common area that not only administrators but users as well find themselves requiring is the VGA setting. Occasionally on updating a video driver or for various other reasons your machine may continue booting but only showing a black screen without any output. A possible way to overcome this so that you can see the output and at least get to runlevel 3 is vga=ask.

Some other commonly used parameters are selinux=[0|1] where 0 disables selinux, acpi=[force|off|noirq|ht|strict] and mem=n[KMG].

The ACPI option controls parameters that the Advanced Configuration and Power Interface (ACPI) subsystem can use. This is the main option for the Advanced Configuration and Power Interface (ACPI). The values are:
force: Force ACPI to be enabled. Can be used to override the kernel configuration option that disabled it.
off: Disable ACPI. Can be used to override the kernel configuration option that enabled it.
noirq: Prevent ACPI from being used for IRQ routing.
ht: Run only enough of the ACPI layer to enable HyperThreading on processors that are capable of it.
strict: Make the ACPI layer be less tolerant of platforms that are not fully compliant with the ACPI specification.

The mem option forces a certain amount of memory used by the kernel. When
used with the memmap= option, physical address space collisions can be avoided. Without the memmap= option, this option could cause PCI devices to be placed at addresses that belong to unused RAM. n specifies the amount of memory to force and is measured in units of kilobytes (K), megabytes (M), or gigabytes (G).

That covers some basics kernel parameters, how to access and edit them. You will find these most useful generally on a new install or after adding new hardware that is either not detected or acting properly.

If you want to see more on the various kernel options and parameters install the kernel-doc package. The documentation can then be found under /usr/share/doc/kernel-doc-2.6.18/Documentation on recent Red Hat and CentOS versions.

Next post I’ll get into some of the error messages that are common when you Linux machine refuses to boot.

-j


Sep 9 2008   6:00PM GMT

Why I like TinyMe Linux



Posted by: John Little
Linux, notebook, operating system, tinyme, notebook computer

TinyMe Linux is the Operating System of choice if you have an older pc or notebook that you want to use. I have one of those and I have put it to good use with TinyMe.

My wife likes to have a notebook computer in the kitchen. This way she can look at recipes, check mail, check on her Longaberger sales or whatever else she wants to do while cooking. The kids look up the weather before going outside to get on the bus or some other information that they quickly want to know. TinyMe to the rescue!

I read an evaluation of TinyMe in an article long since forgotten. The writer of the article did an excellent job of comparing several of the smaller footprint Linux distributions. After reading through the article and looking at all that TinyMe provided I decided that this was the way to go. I have never looked back.

The notebook computer that I am referring to has a 1Ghz Intel processor, 256Mb of ram and a 30Gb hard drive. I used 1Gb of swap to cover the reduced amount of ram.

The download size is a whopping 200Mb :-) in size so it easily fits on a CD. Even better the default install uses a whopping 792Mb in disk space.

The default applications that ship with TinyMe should satisfy about anyone for general computer use. The Opera web browser is the default along with Abiword word processor, Audacious audio player, TightVNC, Python and Perl. Flash is the only app that I needed to install to meet the requirements of my wife. This is handled quickly and easily with the Synaptic package manager.

Given that the minimum requirements of TinyMe are a Pentium processor and 64Mb of ram TinyMe really flies with my 1Ghz cpu and 256Mb of ram.

If you are wanting to put that old notebook or pc to use you should really give TinyMe a look. You’ll be impressed!

-j