Me in IT UNIX/Linux Consultancy is based in Breukelen, The Netherlands and specialized in UNIX and Linux consultancy. Experience with Red Hat Enterprise Linux (Red Hat Certified Architect), Fedora Project, CentOS, OpenBSD and related released Open Source products makes Me in IT UNIX/Linux Consultancy a great partner in implementing, maintaining and upgrading your environment.

Open Source software is an important aspect of any Linux distribution. Me in IT UNIX/Linux Consultancy tries to use Open Source software where possible and tries to share experiences actively. In the articles section you will find many UNIX/Linux adventures shared for others to benefit.

Upgrading Drupal with the least amount of downtime

When you need to upgrade Drupal because the Update Status Module tells you it's required to upgrade, here are the steps to take with minimum downtime:

  1. Backup your files and database. Use tar -cvzf drupal-old.tar.gz /path/to/your/drupal/installation and mysqldump -u USER -pPASSWORD DATABASE > /path/to/where/you/want/to/store/your/database/backup. (Replace the CAPITALS with your username, password and database. I have this step implemented in a cronjob, so do not do this during the upgrade.
  2. Unpack the new Drupal release. I do this next to the directory where my "life" Drupal installation is.
  3. Copy sites/all/themes, sites/all/modules, files/, .htaccess and sites/default/settings.php the the freshly unpacked Drupal release. Depending on what you website contains, this could take a while. The files directory contains all images for example. Sometimes a run a diff for the two settings.php and .htaccess, to check if no major things have been altered in the settings.php. If major things have been changed, copy-paste the required variables.
  4. Set the website off-line.
  5. Make a note of - and disable all third-party/non-drupal modules. This can be quite time consuming, especially for websites that have many modules depending on each other. Making the note can be done before taking the website off-line.
  6. Make a note of the used theme and switch to Garland. You can also take these notes before taking the website off-line.
  7. Move the old directory to something called old. I mostly move it to drupal-x-y where x-y is the release number of that unupgraded Drupal installation.
  8. Switch back to the original theme. Check your note.
  9. Turn on the originally enabled modules. Again, check your note.
  10. Run update.php. Just open your website with update.php at the end. Like this: http://example.com/update.php.
  11. Put your website back online.

Here is a "real" session as done in the terminal. The web based commands are described.

This part is to prepare the upgrade, the (old) website is still available.

[[email protected] client]# ls
drupal-5.6.tar.gz  html  logs
[[email protected] client]# tar -xzf drupal-5.6.tar.gz
[[email protected] client]# mkdir drupal-5.6/sites/all/modules
[[email protected] client]# mkdir drupal-5.6/sites/all/themes
[[email protected] client]# cp -Rip html/sites/all/modules/* drupal-5.6/sites/all/modules/
[[email protected] client]# cp -Rip html/sites/all/themes/* drupal-5.6/sites/all/themes/
[[email protected] client]# cp html/sites/default/settings.php drupal-5.6/sites/default/settings.php
[[email protected] client]# cp -Rip html/.htaccess drupal-5.6/.htaccess
cp: overwrite `drupal-5.6/.htaccess'? y
[[email protected] client]# cp -Rip html/files/ drupal-5.6/

Everything is ready now, so login with your account that has ID 1. and take the website in off-line mode at admin/settings/site-maintenance. Take a note of all third party modules enabled and disable all third party modules. Also take a not of the default theme, switch to the garland theme.

[[email protected] client]# mv html drupal-5.5 && mv drupal-5.6 html

Now enable the modules that were disabled before and switch to the original theme. Run update.php. Check if everything is working and put the website back on-line.

When you are logged out during the process of upgrading, login with mysql and execute these queries.

UPDATE variable SET VALUE='s:1:"0"' WHERE name='site_offline';
DELETE FROM cache WHERE cid = 'variables';

And visit http://example.com/?q=user to login again.

Top 5 stupidest blog responses

Just for the ignorant blog-commenters out there, here is a list of comments that have already been made, and do not require to be used ever again.

  1. First! - Also don't use Second!, Third! and so on.
  2. I want to have one. today! - In response to new gadget reviews. Who would not like to have one? Use storage sanely, prevent these kind of not-helping-comments. There is even a website dedicated to I want to have one.
  3. OMG - It does not help humanity to express your feelings without adding any information. Remember that adding a few bytes in a comment will consume electrical energy as well! Same for WTF, ROTLF, STFU, LOL and other related terms.
  4. Thanks! - Although the author can be proud of such remarks, it does not add any value to a blog. Just like Yes and No will not add much value.
  5. Nothing to add. - Well, then don't add anything please.

One great inspiration of stupid comments is YouTube. People just have enough time there.

HSDPA from T-Mobile on MBP - Mac os X 10.5.1

After some hours of trying I now have a working connection with my Dutch T-Mobile Web 'n' Walk account. The default software and instructions did not work, the Launch2Net for Mac - T-Mobile Edition does not work as is, but there is a trick available to make it work.

  1. Put the SIM that your received with your Web'n'Walk account in a mobile phone, make it not ask for a PIN. On my Nokia this function can be found under Security Settings - PIN code request: off.
  2. Download and install Launch2Net for Mac - T-Mobile Edition.
  3. Login Items screenshotDisable the NML2NDeviceObserver in System Preferences - Accounts - Login Items for your account. This prevents the Launch2net program to be started when you insert your Express Card into your MacBook Pro. N.B. Use the minus sign to remove that specific item, not the check-box.
  4. Screenshot of Network Preferences on Mac OS X 10.5.1Now go to System Preferences - Network. You will find a new "GlobeTrotter HSDPA Modem. Use the Account Name: tmobile, Password: tmobile. Hit Advanced, Vendor: Option, Model: GSM, APN: internet, CID: 1.
  5. Hit connect and you should be connecting with your Option Express Card modem that came with your T-Mobile mobile internet account.

Some difficulties I found;

  • The SIM needs to be in all the way, not partially. Yes, it sounds stupid but I did not insert the SIM far enough.
  • The Launch2Net from nova media did work, but costs € 75,-.
  • The speed varies from moment to moment; It can go up to 50 kilobytes per second to download something, but 10 seconds later it only does 3 kbps.
  • With this work-around you can't check the reception quality.

What is "load" or "load average" on a linux box?

Most people will know how to display the load on a linux box, use "w"(1), "top"(1), "uptime"(1) and likely a few other commands to display the 1, 5 and 15 minute average of the load. Most people will also know that a high load is "bad" and a lower load is "better". But; what does the load imply, what influences load and what load is acceptable?

What does load imply?

There are many interpretations and explanations on what load actually is. Lets take a look at a few statements.

  • Red Hat: The load average is a number that corresponds to the average number of runnable processes on the system.
  • Spagmoid: load average is the average number of processes in the run queue.
  • Wikipedia: In UNIX computing, the system load is a measure of the amount of work that a computer system is doing.
  • Robert de Bock: The number of processes that are waiting for I/O.

What influences load?

The load is caused by a combination of items:

  • Speed of the CPU and CPU utilization.
  • Usage and amount of memory.
  • Disk usage and the speed of those disks.
  • Use and speed of buses, like the PCI network card, the USB disk and others.

In general; a high load indicates that processes are waiting to be processed. The waiting indicates that a bottleneck exists in the system. That bottleneck could be the CPU, the disk, the (slowness or amount of) memory or any other bus. Tools like "iostat"(8), "top"(1) and "sar" and performance monitoring with applications like "mrtg", "munin" will help you find out what the limitations of your hardware is.

What load is acceptable?

This question depends on a few factors:

  1. What is the purpose of the system? If users work on a system, (like a web server) the load could be more critical than when a system is used to process batches of data. (Like mail servers or cluster nodes.)
  2. How many CPU's does your system have? In general you could say that each processor allows a load of 1.00. So a 8 processor machine, could healthily handle a load of 8.00.
  3. What is the nature of the load? You will have to collect more than just a few minutes or even days to see what happens to the load over time. A sudden burst, where the load increases could be acceptable.
  4. What is your budget? Mine is limited, although I see a high load on my machines from time to time, I accept this high load and know that systems do not run optimally.

Load is treated like a magical number, that is used to report to managers about speed of services. I do not agree with that statement. The only reason to monitor load, is to detect sudden changes. Load does not indicate that a system has a problem if there is no baseline determined.

Performance analysis on OpenBSD

You are running OpenBSD and encounter some problems with response time of a machine? Read on. This article is a small list of tools you can use to find out where the problem could be and how to solve it.

A performance problem could be defined as: The response that end-users experiences is slower than expected. I have had many discussion about what a performance problem actually is. For example; database administrators will not consider a load of 1.00 a problem on a machine with one CPU. Most system administrators will consider this is a performance problem. I guess it all depends on the nature of the service.

Okay, be your manager is still at your desk, waiting for you to perform magic, so let's get to it.

  1. Run "top". It will display what processes eat the cpu. When top(1) is running, hit "o" to select a new ordering method and type "cpu" to find the must CPU consuming processes. Other variables instead of cpu are "size" and "res" to find out about memory usage, "time" to see what process has been running for so long and "pri" to find out what the priority was assigned to a process. Focus on cpu, size and res.
  2. Run "systat vm". systat(1) will give you information on activity of the disks and interrupts. The interrupts will tell you what driver is causing the most interrupts. This could tell you that your network card is being utilized a lot for example.
  3. Run "systat ifstat". This will show you the network activity.

From experience, this is the list of problems that I commonly encounter:

  1. Incorrectly configured network settings, mostly /etc/resolv.conf
  2. Not enough memory
  3. Disks being slower than expected.

If you can't figure out what is wrong, adding memory never hurts.

When you would like to go a step further, try ktrace(1). Start it with "ktrace -p PID" where PID is the process number of a suspicious process. ktrace(1) dumps all output in a file ktrace.out, which can grow "really" fast. Use "ktrace -C" to stop the tracing.
kdump(1) is used to read a ktrace(1) file. Use "kdump -f ktrace.out" to read and print the file ktrace.out generated with ktrace(1). The output is enormous, so pipe it through less(1) or grep(1) to make it readable.

What I see often is system administrator using ping(8) to analyze network performance. I think ping is a very bad tool for this purpose, better use time(1) and telnet(1) or some script to check the service that clients are complaining about.

Writing directly to a USB disk in OS X

Disclaimer : This procedure erases all data on the target volume so use the volume relevant to your setup, eg. that of your USB disk. I and my associates at meinit do not take responsibility if you overwrite the wrong volume and lose your music, movies, thesis, world peace plan etc. And there might be an easier way to do this, I await comments.

Today I would like to share a short note on how to write a raw disk image to a USB memory stick in OS X. The raw disk image can, for example, be a bootable filesystem image for a OS installer. In my case Fedora 8's "diskboot.img".

The main problem is that I was used to Linux's way of device naming but under OS X if you wish to write directly to a disk you need to use the "raw" version of the device. For example /dev/disk1 has raw device /dev/rdisk1.

The other issue I encountered is that when I insert the USB memory stick then /dev/disk1 exists but is mounted so I cannot write to it directly. If I eject the disk then the device node also disappears and I can't write to it. So we need to use the "Disk Utility" to properly unmount the volume, this utility is contained in Applications -> Utilities. Start this up, making sure your USB stick is plugged in. Once started you will see a list of storage devices, much like below :

screenshot of Disk Utility

Here you can see the USB storage quite easily. Highlight the partition within your storage media and click "eject". Now the device node still exists and you can use "dd" to write to the disk directly, /dev/disk1 in my case. My command to write to the disk was :

$ sudo dd if=./diskboot.img of=/dev/disk1 bs=8k

Adjust as required. Good luck and happy new year! :-)

Kismac and a D-Link DWL-G122 wireless USB network card.

If you are lucky, you own an Intel MacBook, or even an Intel MacBook Pro. The only disadvantage is that it's difficult to scan and recover passwords for wireless networks secured by WEP using KisMac. You would need extra hardware to do that. I bought a D-Link DWL-G122 H/W Ver: C1 F/W Ver: 3.10 from Expansys in The Netherlands. (It actually came from France.) Costs around € 30,-. Here is how to use it in KisMac.

  1. Don't install any drivers! You will only be using this device in KisMac which provides its own drivers. If you did install it, see at the bottom of this article how to uninstall it.
  2. Download KisMac, the "USB-Drivers" version.
  3. Start KisMac and go to Preferences.
  4. Remove all Capture devices and add "USB device, passive mode". Enable all channels. Enable "use as primary device".
  5. Click "Start Scan". This will scan your area for available networks.
  6. Take note of the channel ("Ch", second column) for the network you would like to focus on. KisMac should be configured to only check that channel, so deselect all, except for the channel your are focused on.
  7. Restart the scan. You will collect packets much faster when using a single channel.

Play with all the other settings and have fun recovering your WEP password.

Uninstalling the D-Link DWL-G122 driver

I know these are not the official steps to uninstall the driver, but following these steps made KisMac work for me again. Be aware, these are the steps that I have followed, they might not work for you, or even break things. Know what you are doing!

  • rm -Rf /System/Library/StartupItems/DWLG122
  • rm -Rf /System/Library/Extensions/RT2500USBWirelessDriver.kext /System/Library/Extensions/RT73USBWirelessDriver.kext
  • rm -Rf /Library/Receipts/D-Link\ DWL-G122.pkg/
  • rm -Rf /Users/*/Library/PreferencePanes/DWL-G122WirelessUtility.prefPane
  • reboot

Optimizing your (drupal) website for Google

SEO is hot! Lets take a look at what you need to do to your (Drupal, or any other) website to be optimized.

If you use Drupal, keep these guidelines in mind:

  1. Don't worry. Drupal does quite well on SEO tricks. (Estimated importance: 30%)
  2. Focus on Site Information. (admin/settings/site-information) Make sure everything there is correct, and reflects exactly what you want to do with your website. (Estimated importance: 10%)
  3. Focus on good content. Good content will attract the visitors you are searching for. A blog or article section helps here. (Estimated importance: 40%)
  4. Optionally: Use URL-paths to make pretty URLs like /articles instead of /node/123. URL paths are part of the Drupal core. (Estimated importance: 10%)
  5. Optionally: Use the Drupal Google Sitemap module and Google Webmaster tools to let Google know what is on your website when you add content to your website. (Estimated importance: 1%)
  6. Optionally: Use the Drupal Nodewords module to enable the use of meta tags. (Estimated importance: 1%)
  7. Check Xinu Returns. This will help you filtering out common mistakes. (Estimated importance: 8%)

Always keep these basics in mind:

  1. Use text to display text, not images.
  2. Navigation should be simple.
  3. Send all traffic to one domain.

After hours of researching this topic myself I have concluded that Drupal does not require you to focus on SEO much. Instead, spend your precious hours writing good content. Focus on what visitors can find at your website, not on how to please Google.

Using multiple domains with Drupal

If you have multiple domains, all going to the same website, you can redirect traffic to your 'primary' or 'default' domain instead of serving the same content on all domains. Google measures your websites authority over the number of links to you website, if you have several domains, some using www. some not, then that authority is spread across all those (sub-)domains.
Another reason to use 301 redirects is that google maps uses a key, that is dependant of the url of the client. Not using this trick, would result in error-popups about an error in your API key on your visitors computer.

So; use 301 redirect to send all visitors to one default domain. Here is how to set it up, it should work for any website, but I have tested it on drupal

Open the .htaccess file that comes with drupal. (Be aware each update of Drupal will overwrite that file!) You will find these lines somewhere:

<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Read what is described and add a few lines. You can use regular expressions to tell the Rewrite Engine what to match.

  RewriteCond %{HTTP_HOST} ^www\.meinit\.nl$ [NC]
  RewriteRule ^(.*)$ http://meinit.nl/$1 [L,R=301]

  RewriteCond %{HTTP_HOST} ^www\.meinit\.eu$ [NC]
  RewriteRule ^(.*)$ http://meinit.nl/$1 [L,R=301]

  RewriteCond %{HTTP_HOST} ^www\.meinit\.com$ [NC]
  RewriteRule ^(.*)$ http://meinit.nl/$1 [L,R=301]

  RewriteCond %{HTTP_HOST} ^www.drupal\.nl$ [NC]
  RewriteRule ^(.*)$ http://meinit.nl/$1 [L,R=301]

  RewriteCond %{HTTP_HOST} ^www.robertdebock\.nl$ [NC]
  RewriteRule ^(.*)$ http://meinit.nl/$1 [L,R=301]

  RewriteCond %{HTTP_HOST} ^meinit\.eu$ [NC]
  RewriteRule ^(.*)$ http://meinit.nl/$1 [L,R=301]

  RewriteCond %{HTTP_HOST} ^meinit\.com$ [NC]
  RewriteRule ^(.*)$ http://meinit.nl/$1 [L,R=301]

  RewriteCond %{HTTP_HOST} ^drupal\.nl$ [NC]
  RewriteRule ^(.*)$ http://meinit.nl/$1 [L,R=301]

  RewriteCond %{HTTP_HOST} ^robertdebock\.nl$ [NC]
  RewriteRule ^(.*)$ http://meinit.nl/$1 [L,R=301]

As you can see, this single website can be accessed using the domains:

The approach described above is very simple, you could also use regular expressions to make one RewriteCond line, but to keep it readable when adding a domain, or upgrading Drupal, I have chosen to split each domain into a new line. You could also introduce loops that redirect from "a" to "b" to "a", etc.

Ergonomic keyboards reviewed

On a daily basis I use ergonomic keyboards, as "straight" keyboards make my wrists go painful. If you are in pain, read this article.

Years ago I started out with straight keyboards, and realized an ergonomic keyboard could improve my typing speed. For me the reason for slowly switching to ergonomic keyboards, was related to typing speed, not RSI, (repetitive strain injury) or pain in the wrists, shoulders, arms or fingers.

Microsoft Natural keyboardLikely the most used is the Microsoft Natural Keyboard Elite. This is a PS2 model, which is largely deprecated by now. Microsoft still sells USB versions with fancy multimedia keys. This keyboard however has helped me for years, was cheap and durable. As it is still quite common in office environments, try using this keyboard instead of straight types. It only takes a day or so to get used to it.

Logitech Comfort keyboardThere are some similar keyboards like Logitech Comfort Laser and possibly other. I have not tried them all, but since their design is quite similar, I assume that the experience is almost the same.

Kinesis Advantage KeyboardMy latest (and best, but most expensive) keyboard is the Kinesis Advantage keyboard. As you can see, this is a different type of keyboard. The hollow cups that capture the keys help to get your hands in the correct position. You use this keyboard as a QUERTY type keyboard, the only difference are the "special" keys: back space, space, delete, home, end, ctrl, alt, enter, page up and page down. You control these special keys with your thumbs.
This keyboard does require some getting used to, but it's well worth it. After a week, and some hours of training (comes with the keyboard) you are able to type at acceptable speed again.
Keys are (re-)programmable, which means you can copy keys to another location. As I use Linux the most, I have copied the alt key over the windows key. The keyboard comes with a few physical keys that you can replace, like ctrl, alt, windows and those type of keys.
There is a two-port USB hub integrated. You could connect mice and touch pads.
The angle between the two keypads could have been a little bigger. Sometimes it feels like the hollow cups are a bit too straight. Another thing, the top row of keys (esc, f1, f2, etc) is some sort of sticky rubber. Especially when using the escape key often, I accidentally hit f1. These keys are not positioned optimally, but I have accepted this con.

Datahand keyboardAnother keyboard is the Datahand. This keyboard is the most expensive of all listed keyboards, and looks so alien that it shocks potential buyers like me. I have one colleague though that uses it and is very happy with it. This keyboards also drives the pointer/mouse on the screen. Likely if you suffer the worst type of pains/RSI, this keyboards could safe your job.

About Consultancy Articles Contact




References Red Hat Certified Architect By Robert de Bock Robert de Bock
Curriculum Vitae By Fred Clausen +31 6 14 39 58 72
By Nelson Manning [email protected]
Syndicate content