HostGator, Linux and The Dukes of Hazzard

doh

If you’re old, like me…let’s say, over 30 years old…you might remember the television show “The Dukes of Hazzard”.  Waylon Jennings, a popular country music singer during the late 70’s and early 80’s sang the theme song.  The lyrics are:

Just the good ol boys, never meaning no harm

Beats all you ever saw, been in trouble with the law

since the day they was born

Many times in IT job settings, you’ll find that you need to become one of ‘the good ole boys’ in order to accomplish your job.  You have to like the things others’ like (or pretend to), you have to laugh at the things others’ laugh at.  In other words, you may have to become all things to all people.  It’s stupid that things are this way…but if you don’t change, you’ll find yourself on the outside looking in.  I’ve always been one to try and strike the right balance between becoming what my coworkers wanted me to become versus what I want to be.  Through the almost 10 years I’ve been blogging here, I’ve both sponsored and at one time hosted Ken Starks (aka Helios) blogging efforts and even his Lobby4Linux initiative…and I still consider him to be a great friend as well as an uncompromising voice in the world of Linux.  Over at his blog, he gave the anonymous experience of one HostGator employee.  You can read her experience over at his blog but here is an excerpt:

But my friend did have trouble answering a question and she dutifully IM’ed her tier two technician for help…. Twice. Then three times. And finally a fourth. She didn’t even get a response from a tier three tech or a supervisor. And I’ve been a tier three technician…I played a lot of online games. Help requests were infrequent. We mostly helped supervisors keep track of call times. She was a nervous wreck…and the customer wasn’t happy. She had to take down the customer’s number and promise to call them back when she found the answer to their question. A callback counted against her in her call stats and bonuses can be earned or lost on customer callbacks. She was close to tears, but nothing like she was when she found out why she being ignored when she asked for help. It seems that there is a little initiation when you go to work in that particular call center. It’s a game of sorts and it all boils down to this.

I’ve experienced things just like this in my career in the world of IT…not to the level above…but in some form or another, I’ve been hindered at performing my job by someone else who wanted to ‘initiate’ me into working where they do…or someone who just didn’t like that I spoke in an accent.  It’ seems rather stupid that someone would want you to become part of their ‘good ole boys’ network before they give you the help you need.  It’s unprofessional and counterproductive.  The only real permanent damage it does happens to the end user.

One can’t get too mad at companies though…they may not even know it is going on.  It starts at the mid-management level.  Managers who enable and allow this sort of behavior on their teams or ignore this sort of behavior are to blame.  Having a workplace that isn’t fun to work at unless you’re a part of the ‘good ole boys’ or that makes the end user suffer just for a laugh isn’t a good workplace.  Turnover will be high.  Ego’s will be allowed to cultivate and grow.  Cliques will form.  Boundaries will be crossed. In the end, your workplace suffers because it becomes hostile to those who refuse to adapt their behavior to jive with the few who behave in this way.  If you’re an IT Manager, take note of the story I linked to above.  Don’t be that guy.  Don’t let your employees set the tone for the work environment.  Make it your mission to set the tone yourself.  Making your work environment an inviting and supporting place to work isn’t hard to do.

Finding Files Modified in the Past Few Days

terminal_icon

It’s said that with age comes distinction and wisdom. If we believe that, then we’re talking about people and not files.  Working with older files doesn’t make you wise beyond your years…one could argue that it makes you a glutton for punishment :).  That doesn’t always have to be the case as we can solve finding and working with older files using the ‘find’ command.

Recently, I was tasked with finding files that had been modified in the past 5 days. I was to copy these files from a SAN Snapshot and move them over to a recover area that anyone could get to (read: Windows File Share).

We were doing this in Linux because the snapshot, which was a NTFS filesystem would only mount in Linux.  It seems that Linux is more forgiving of errors on a hard disk than Windows is when dealing with NTFS.

So, the snapshot was located on a server designated as X.X.X.X below.  I decided to use the find command to locate all files that were modified in the past 5 days.  The find command can be summarized succinctly using the following logic statement:  find where-to-look criteria what-to-do.  Keeping this logic in mind, I used the following command to get what I needed:

find . -mtime 4 -daystart -exec cp -a {} /home/devnet/fileshare\$ on\ X.X.X.X/RECOVER/ \;

Let’s break down what the above command is doing.  First and foremost, the find command when used in conjunction with a period means to search the current directory (where-to-look in logic statement above).  If you need to specify where to search via path, replace the period with the path to the directory you’ll be searching in  Next, I’ve added the following flags (criteria in logic statement above) which I’ll define:

  1. -mtime:  stands for ‘modified time’.  This means I’m searching for only files modified in the past 4 days.
  2. -daystart:  This flag is used to measure time from the beginning of the current day instead of 24 hours ago which is default.  So in the example above, it would find files 4 days from the start of today (which equates to 5 days from midnight versus 4 days from 24 hours ago for my task)
  3. -exec:  specifies that with the results, a new command should be executed.

The {} above is where the results of our find command are passed.  It will do the command after -exec for each result from the find command.

So, we’re copying with the cp -a command and flag, which will copy recursively, preserving file structure and attributes thanks to our -a flag.  That command copies all the files we’ve found using the find command to the path stated next (what-to-do in our logic statement above).  The last symbols \; are the end statement for our -exec flag.  This must always be present for our -exec command…and the exec flag should be the last option given in the find command as well.

It’s important to note above that I mounted the NTFS SAN snapshot using the GUI like I would any NTFS volume on a Linux desktop and that I executed this find command while I was located in the root of the directory I wanted to search on that snapshot.  The server I was copying the files to noted as X.X.X.X above was a Windows File Server on our network that had open permissions for me to copy to.  I used Samba to mount this server in the directory ‘fileshare’ in my home directory.  The RECOVER directory was made by me to house all the files I’ve found so I could keep them separate from any other files in the root of the file server directory.  I had to manually create this folder prior to issuing the command.

There are more than a couple of different ways to do what I did above.  There are also numerous ways to alter the command and adapt it for your needs.  For example, perhaps you want to find all files that are 3 days old and delete them…and you’re not a stickler for the -daystart option.  In this case:

find . -mtime -3 -exec rm -rf {} \;

Maybe you want to copy mp3’s from a directory to a separate location:

find . -name '*.mp3' -exec cp -a {} /path/to/copy/stuff/to \;

There are lots of ways to adapt this to help locate and deal with files.  The command line/shell are always more than powerful enough to help you get what you need.  I hope this helps you and if you have questions or just want to say thanks…please don’t hesitate to let me know in the comments below.

Would You Like a Native Client for Google Drive?

gdrive

If you’re like me, you think that the more native applications that are available to Linux users, the better.  In the case of Google Drive, there isn’t a native synchronization enabled client for Linux.  This is especially sad if you think about how Google got to where it is today…building its entire search infrastructure on the backs of customized Debian servers.  Not to mention that Android…which is powered by Linux…has a native client available in the Google Play store.

Why would we want a native client for Google Drive when we can just use unofficial software to do it or mount it like a command line commando would?  The answer is simple…uniformity and solidarity.  The experience that is already present for Windows and Mac users should be present in Linux as well…instead, Linux continues to be the ‘red headed stepchild’ of the desktop experience.

There are some people who feel this same way and they have started an online petition asking Google to release a native Drive client for Linux.  You can sign the petition here if you’d like to.  As of the writing of this post, there were 15,648 signatures…let’s see if we can push above 20k shall we?  I think online petitions are sometimes silly but Google might not.  Hopefully, we’ll get that native client and uniform experience for Linux desktops everywhere.

Lightweight Command Line Downloading with Aria2

terminal_icon

Sometimes you just want a quick and easy way of downloading  large files.  If you’re like me, you want this with as little of a memory footprint as possible.  Aria2 gives me this ability.  When downloading a torrent for a recent Linux release, I was able to do this with only 5MB of memory being used.  No other download programs can give me this.

What’s nice about aria2 is that you can download the same file from multiple sources (mirrors) and cut your download times with each source.  You can also open multiple pipes to the same download which shortens the time as well.  Let’s take a quick look at what aria2 can do for your downloads.

Downloading with Aria2

For this test I used KDE4 iso’s from OpenSuse.  First, I established a baseline using wget:

wget http://www.gtlib.gatech.edu/pub/opensuse/distribution/12.3-RC2/iso/openSUSE-12.3-KDE-Live-Build0094-x86_64.iso

This took 15 minutes 47 seconds to complete.  The file size is 941MB.  My Internet connection at home has a max download of 10MB and upload of 1MB.

Using aria2, the same file took 10 minutes 32 seconds to complete.  Here is the command I used for this:

aria2c -x2 http://www.gtlib.gatech.edu/pub/opensuse/distribution/12.3-RC2/iso/openSUSE-12.3-KDE-Live-Build0094-x86_64.iso

The -x2 in the above command pipelines the download of the ISO into 2 separate threads.  This speeds things up considerably.  Be wary of using too many threads though because many websites out there will throttle you down in speed should you open more than 3-4 threads.

Aria2 supports more protocols than you can shake a stick at including magnet links, bittorrent, metalink and even ftp.  There are many command line flags and options you can use and you can even call aria2 using JSON-RPC and XML-RPC through the web.  All together, aria2 is scalable, flexible and lightweight…there isn’t much it cannot do.  If you’re looking for a lightweight download utility, aria2 has you covered.

Creating Symlinks – How and Why

As part of your Linux journey, you’ve probably heard of symlinks which are also known as symbolic links.  I figured that since I fixed an error using symbolic links to setup an environment to allow my son to learn program.  I am using something called HacketyHack which can be found here:  http://hackety.com

The problem is that on Ubuntu or Debian, the libssl and libcrypto libraries are out of date.  Hackety Hack’s program requires versions greater than 1.0.0 and 0.9.8 is installed.  The fix is of course a symbolic link.  But how do we do this and more importantly, WHY do we have to do this to fix it?  Let’s go through what they are first.

What is a Symbolic Link?

Look on your computers’ desktop right now.  If you’re like most people, you’ll have many shortcuts to different programs that you access daily.  On my Windows 7 machine at work, I have around 40-50 shortcuts to commonly used tools and places I access to accomplish my job.  Those are, in a nutshell, what symlinks are.  They’re pretty much just advanced shortcuts and with the case I’m going to present today…shortcuts without an icon.  Symlinks redirect a computer to an end location OR make a computer think the end location is where the shortcut is…and since they perform these 2 functions, there are 2 types of them.

  1. Hard Links
  2. Soft Links

Soft Link – When you click on/open a soft link, you’re redirected to the location it is pointing to.  For example, if you click on ‘My Documents’ on your desktop, you’re redirected to a path on the C: drive where your documents are stored.

Hard Link – A hard link makes the computer think that the shortcut is the actual end location.  So, using our ‘My Documents’ example above…the computer would look at the ‘My Documents’ shortcut and it would see it as the actual end location instead of a pointer to the end location.

What Would I Use a Symbolic Link For?

Do you use dropbox or box.net or any other cloud storage system to share files/store files/backup files?  Then a symbolic link might be a good option for you.  Imagine that you setup a folder on your desktop that is named ‘send-to CLOUD’ and when you drag and drop files to that folder, it sends it directly to those cloud storage systems.  This is something that symbolic links can accomplish.

Another case might be if you need files stored in 2 different locations.  Maybe you want to have settings files for an application be redirected to dropbox so that you can access it and use it on another computer.  As you can see, there are many different reasons for using symbolic links.

How Do I Setup a Symbolic Link?

In Linux, you use the command ‘ln’.  To setup a soft link, you use the -s flag like this:

ln -s /usr/lib/library.so.0.9.8 /usr/lib/library.so.1.0.0

So, in the example above, the file library.so.1.0.0 is LINKED or pointed back to the actual file library.so.0.9.8.  To setup a hard link you’d drop the -s flag:

ln /tmp /other/location/tmp

In the above example, your /tmp folder will now appear in 2 locations…both /tmp and the /other/location/tmp.  Please understand that /other/location/tmp has to actually exist <em>before</em> you issue the command.

To remove a symbolic link, just use the ‘rm’ command.  I usually use -rf as flags so that it recursively deletes and forces it to occur without confirmation but it is up to you:

rm /other/location/tmp

How Do I Fix Hackety Hack on Debian?

As promised, the solution to fixing Hackety Hack on Debian.  First, you need to find/locate the libraries that it complains about.  In the first error I received, it was looking for libssl.so.1.0.0.  I use the mlocate package which has the command ‘locate’ to find libssl.so as follows:

devnet@lostlap:~$ locate libcrypto
/lib/libssl.so.0.9.8
/usr/lib/libssl.so.0.9.8

The output tells me that there is a libssl.so.0.9.8 in two locations:  /usr/lib and /lib.  I’ll need to symbolically link both of those with a soft link so that when the program looks for the file libssl.so.1.0.0 it finds it and the link points it back to libssl.so.0.9.8.

sudo ln -s /usr/lib/libssl.so.0.9.8 /usr/lib/libssl.so.1.0.0

 

sudo ln -s /lib/libssl.so.0.9.8 /lib/libssl.so.1.0.0

Now that those to locations are created, we need to follow up with libcrypto which resides in the same two directories as libssl.

sudo ln -s /usr/lib/libcrypto.so.0.9.8 /usr/lib/libcrypto.so.1.0.0

 

sudo ln -s /lib/libcrypto.so.0.9.8 /lib/libcrypto.so.1.0.0

Now that both of those are linked to our actual ssl and crypto libraries, you can try running the file from Hackety Hack again.

For me, this fixed the initial two problems but I still have a failure when the installer does a hard check for OpenSSL 1.0.0 and unfortunately, I don’t have a complete solution for it yet.  So, I suppose I lied a bit with the ‘fix’ for Hackety Hack.  The above information is good though for other programs that might require libraries similar to the ones we linked.

Hopefully, you now have a decent understand of how and why to use symbolic links.

CrunchBang Linux Review

login

I love CrunchBang Linux.  In my opinion, it’s one of the best distributions of Linux for older computers (heck, any computer) that is actively developed.

I pieced together a Gateway M250 laptop a year or so ago (3 bad ones parted out into 1 good one) and loaded it up with max RAM (2GB).  It’s now a handy little 14 inch laptop with a 1.73Ghz single core Centrino processor.  Not bad…but when playing videos or streaming them, it can really struggle.  So keeping the operating system lightweight on it is a definite must.

Enter, CrunchBang.  It’s small and fast.  It’s elegant and slick.  Just look at this screenshot:

Default Desktop

Simple and sleek, CrunchBang gives feelings of order and uniformity while breaking the speed limit signs.  I’d like to take some time to show you why I feel CrunchBang Linux should be the next distribution of Linux you put on your laptop.  Let’s get started…

Login Screen

In the screenshot above we find the login screen that greets you after installing CrunchBang.  It’s very basic and sleek…it gives the impression that CrunchBang has things together.  It’s impressive but you won’t get to the most impressive portion of CrunchBang Linux until you login for the first time after installing.  I’m going to assume that you already have CrunchBang installed and are booting it for the first time in this review since the install is very easy to do.  After the installation, you’ll be greeted by a command line first run wizard (see below):

First Run Wizard

This wizard will take you through a plethora of tasks…including, but not limited to, getting you connected to the internet, installing development tools, installing web server tools, installing software development tools, and of course…updating your install.  You’ll be able to select each that you want to perform or skip each depending on your need/desire.  THIS is how a first run wizard should be.

This wizard is just a simple script but it does more in the first few minutes for new users than any first run wizard I’ve ever seen.  In my opinion, this tool puts CrunchBang head and shoulders above just about any other distribution of Linux out there.  This lightweight approach to things permeates the entire install.

Now that you’ve made it through the first run wizard, we can explore the various applications installed by default.  For a list, please see the CrunchBang wiki entry.  I’ve found that there is a lightweight replacement for everything I’m accustomed to.  You access these applications by right clicking ON the desktop…which is the standard way to do this using the Openbox window manager.

Right ClickAs you can see, there is a well organized menu structure for the applications that are installed and the appearance provides a uniform appearance just like all other areas of the distro do.  The theme is modern and elegant and continues throughout the menu structure.

browsersAre you a Firefox, Opera or Chromium fan?  Doesn’t matter.  Install scripts are provided inside the menu to get you the right browser right away.  Just a small detail that shows the creator of the distro isn’t thinking about only themselves but rather, the standard user.

I recommend CrunchBang Linux for ANYONE out there…regardless of skill level…who wants a lightweight, complete, and polished distribution of Linux with very few hassles.