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.
- Hard Links
- 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:
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
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.