Virtualmin error while installing on Ubuntu 10.4

While I am very comfortable using Linux via a command line shell, I think all of us can admit that occasionally we need to look up a command or two due to non-regular use. Because time is short, and can be expensive when we have tons to do, I usually install Virtualmin (which also installs Webmin) on most of my servers. It is simply easier to login and get things done quickly.

Well, as I was setting up a new server at my hosting provider today and installing Virtualmin I ran into a little problem. The server was a fresh install, and Virtualmin would not install on my fresh load of Ubuntu 10.4 (which is a supported OS by Virtualmin). Instead I received the error:

... No apport report written because the error message indicates its a followup error from a previous failure
 
pkg: dependency problems prevent configuration of virtualmin-base:
virtualmin-base depends on dovecot-common; however:
Package dovecot-common is not configured yet.
virtualmin-base depends on dovecot-imapd; however:
Package dovecot-imapd is not configured yet.
virtualmin-base depends on dovecot-pop3d; however:
Package dovecot-pop3d is not configured yet.
dpkg: error processing virtualmin-base (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
dovecot-common
dovecot-imapd
dovecot-pop3d
virtualmin-base
 
FATAL - 2011-09-01 00:07:13 - Fatal Error Occurred: Something went wrong during installation: 0
FATAL - 2011-09-01 00:07:13 - Cannot continue installation.
FATAL - 2011-09-01 00:07:14 - Attempting to remove virtualmin repository configuration, so the installation can be
FATAL - 2011-09-01 00:07:14 - re-attempted after any problems have been resolved.
FATAL - 2011-09-01 00:07:14 - Removing temporary directory and files.
FATAL - 2011-09-01 00:07:14 - If you are unsure of what went wrong, you may wish to review the log
FATAL - 2011-09-01 00:07:14 - in /root/virtualmin-install.log

Well, after some Google searching I determined that the problem may be related to a bad hostname set on the server. This was a little confusing because the install also detected this at the beginning and asked me what I would like the hostname set to. However, it appears that providing the hostname did not make a difference because Virtualmin was not able to set it.

I first tested the hostname to see if this was the problem by doing:

$ hostname -f

Sure enough, it warned that the hostname was a problem. So here is how I fixed things:

First, I had to set the hostname on the server (I use sudo, but you could be logged in as root or change to superuser with su.):

# sudo vi /etc/hostname

In vi you would edit the hostname to be a fully qualified domain name (FDQN) and saving. (click “i” to enter insert mode, then “esc” to stop, and hit “ZZ” to save and close. Note: these are capital “ZZ”.)

Second, this requires a restart of the hostname service to apply the change. (Note: you can use ‘restart’ instead of stop and start.)

# sudo /etc/init.d/hostname stop
# sudo /etc/init.d/hostname start

Third, I had to then update my hosts file to also reflect the change. (click “i” to enter insert mode, then “esc” to stop, and hit “ZZ” to save and close. Note: these are capital “ZZ”.)

# sudo vi /etc/hosts

IMPORTANT: If you do not include the “shortname” after the hostname applications will still not consider this a FDQN.

Example of what should be in the hosts file when you are done:

127.0.0.1     myhome.domain.com myhome

After doing these three steps I was able to successfully install Virtualmin with no issues.

Tether Android to Ubuntu for free Internet

A couple of weeks ago I was without Internet (thanks to AT&T), and was forced to go to Starbucks to check email and commit work I had done. While I like going to Starbucks, it was not the best working situation for someone who works from home.

Since I have an Android (HTC Evo) I thought about USB tethering the device to my laptop and Internet sharing, but Sprint hits you with a $29.95/month fee to use that option.  Since I am completely able to work locally without a connection to the Internet, I decided to tough it out and wait until AT&T figured out their mess and got me turned back on.

Fast forward a couple of weeks later… (yes, I am back on the net)

I found some neat applications for my phone that enable someone to bypass the tethering options that Sprint charges for.  One popular application is PdaNet, but it is limited to Windows and Mac. (For those who are still limited by those two platforms, give PdaNet a try.)  Another application I stumbled across called EasyTether has Linux support, so I gave it a try. (I am actually writting this blog post while using it)

The application for the Droid was available on the Droid Market Place, and their website has the Ubuntu file available for the PC connection. http://mobile-stream.com/easytether/drivers.html

I installed the “Lite” version from the Droid Market Place (FREE!!! but limits you to non-SSL pages, unless you pay the $9.99 for the full version) The application walks you through the couple of simple steps needed to use it, and even gives you the address above to get your Windows/Mac/Ubuntu/Fedora up and running.

Once I installed the DEB file on my laptop, after downloading it, all I had to do was connect my phone to USB and open the connection via command line.

The command to link up is:

easytether connect

Now the next time I am without Internet I am ready. 🙂

Empty file contents at command line on Linux system

As is often the case I needed to accomplish something, so I tinkered until I figure it out. I had a web site that I recently moved from a PHP 5.2 to 5.3 enabled server. It became a problem when I realized my error logs had filled up with 600 MB of deprecated function messages, and after fixing the issues I wanted to clear out the logs.

While there are a few methods of doing this, I wanted to keep it simple. Here is the command I used:

> filename.log

The greater than symbol is the command which pipes nothing to the file, thus clearing it. This cleared up the file quickly, and left the permissions and filename in place.

Setting larger terminal size when launching

Have you ever noticed that when opening a terminal screen in Linux it is very small? Who can work like that? AND in order to do anything I need to drag the corner of the window to make it larger, which is time consuming and drives me crazy because I am opening and closing my terminal screens many times each day.

So, here is a screenshot of how small the terminal screen is when initially launched:

Tiny terminal window on launch

The fix is very simple.  Right click on the launcher for terminal and select “Properties”.  When that dialog opens you are going to edit the Command to set the geometry of the window to be BIGGER.  I personally like my terminal to be 175×50, you can vary the size as you wish.

So, here is the new Command: (175 is the width and 50 is the height)

gnome-terminal --geometry 175x50

Now when my terminal screen opens it is much better:

Bigger Terminal Size

Enjoy!

Installing mhash on RHEL 4 and PHP 4.3.9

Recently I had a customer that was receiving errors from an Authorize.Net web submit form in their shopping cart. The error simply stated:

“The gateway no longer supports the requested method of integration.”

While doing some digging I found that they were using a very old web submit method that Authorize.Net no longer supported. There were two ways to fix the problem:

  1. Change to AIM method of submission, which required an SSL certificate that the client did not have.
  2. Change to SIM method of submission, which required either PHP 5.1.2 installed to use the hash_hmac function, or for PHP 4.3.9 it required that mhash be installed on the server.

Since the client did not want to spend the extra cash for the SSL certificate, and I could not install PHP 5.1.2 because I had too many other clients on the server that were not ready for the upgrade, I decided to do some searching for a way to install mhash.

It turned out that the Red Hat repositories did not carry php-mhash for RHEL 4, so this meant I needed to look in other areas. After reading many different blog and BB postings saying that it required an install, then a recompile of PHP I started to get a little worried. I did not look forward to recompiling PHP.

Finally I found some posts that brought a ray of hope. There are RPMs available to install php-mhash without the PHP recompile, but it required that libmhash be installed first. Here are the steps I followed:

  • I went to http://dag.wieers.com/packages/libmhash/ and downloaded the newest version of libmhash for my server.
  • Then I installed using the following to satisfy dependencies of mhash:
    rpm -iv libmhash-0.9.1-1.rhel3.dag.i386.rpm
  • Next I downloaded the php-mhash by using:
    wget ftp://rpmfind.net/linux/sourceforge/p/ph/phprpms/php-mhash-4.3.2-19.ent.2.i386.rpm
  • I followed that by installing it using:
    rpm -iv php-mhash-4.3.2-19.ent.2.i386.rpm

After following those steps I created a phpinfo script to see that everything went well:

<?php
phpinfo();
?>

I could now plainly see that mhash was installed perfectly, and with further tests I confirmed it was working.