Tuesday, July 3, 2012

Using oclHashcat-0.09 on Ubuntu 10.04

If you're a beta tester for oclHashcat-plus 0.09, you may have noticed that it doesn't work on older versions of Ubuntu.  You'll probably get a glibc version error - something along the lines of:

./oclHashcat-plus64.bin: /lib/libc.so.6: version `GLIBC_2.14' not found (required by ./oclHashcat-plus64.bin)

The bad news is that Ubuntu 10.04 uses an older version of GLIBC.  The good news is that this shouldn't stop you from being able to use 0.09 on 10.04!  The trick is Linux chroot support - you create a 12.04 in a chroot, bind the right stuff in, and run oclHashcat.


Warning: This involves doing ugly, somewhat questionable things to your system.  If it breaks something, it's your fault.  It's less likely to break something than upgrading to 12.04 right now, though...

For the rest of this post, I'm assuming you're on Ubuntu 10.04, or another Ubuntu instance too old for 0.09.

This is based on directions from https://help.ubuntu.com/community/BasicChroot

Step one: Install the needed utilities to create the chroot jail.

sudo apt-get install dchroot debootstrap

The next step is to figure out where you want to put your shiny new Ubuntu 12.04 install.  For this blog, I'll be assuming /ubuntu_12_04 - adjust if needed.

First, create the directory.

sudo mkdir /ubuntu_12_04

Next, edit /etc/schroot/schroot.conf (you'll have to be root) - add the following section.  Be sure to put your username in.

[lucid] 
description=Ubuntu Precise 
location=/ubuntu_12_04 
priority=3 
users=<your username>
groups=sbuild 
root-groups=root

I'm on a 64-bit system, so I'm going to be building an amd64 image.  If you're on 32-bit, use i386 for the arch flag instead of amd64.

Create the chroot base install:
sudo debootstrap --variant=buildd --arch amd64 precise /ubuntu_12_04 http://us.archive.ubuntu.com/ubuntu/

This will run for a while, downloading the base packages.  Grab yourself a coffee.  Or, more likely, a whiskey.

Once done, you'll need to bind a few directories for everything to work.
sudo mount -o bind /proc /ubuntu_12_04/proc
sudo mount -o bind /dev /ubuntu_12_04/dev
sudo mount -o bind /tmp /ubuntu_12_04/tmp 
sudo cp /etc/resolv.conf /ubuntu_12_04/etc/resolv.conf

Time to enter the new environment!

sudo chroot /ubuntu_12_04/

Now you should have a root prompt in what looks an awful lot like an Ubuntu 12.04 install!

cat /etc/issue
Ubuntu 12.04 LTS \n \l

You should also have network connectivity allowing you to:
apt-get update

Next, we need X11 installed to handle AMD driver installation.  We'll also need a few other utilities.

apt-get install -y x11-common xserver-common xserver-xorg-core wget vim debhelper build-essential

The next step is to get the AMD drivers.  You can download them as normal with wget, or download them in your browser & copy them into the instance.  I'll use wget for the 12.6 drivers:

cd /tmp
wget http://www2.ati.com/drivers/linux/amd-driver-installer-12-6-x86.x86_64.run
chmod 755 amd-driver-installer-12-6-x86.x86_64.run
./amd-driver-installer-12-6-x86.x86_64.run --force

Errors will happen - you don't have a kernel header set to install the driver, but that's OK - we don't actually need to install the kernel driver, because our bound /dev takes care of that.

Now, you can pull oclHashcat 0.09 from your preferred source.  You'll want to unzip it on your host machine, and copy it in.

On your host box (NOT inside the chroot):
7z x oclHashcat-plus-0.09.7z
sudo cp -r oclHashcat-plus-0.09 /ubuntu_12_04/

Back inside the chroot, you can cd to /oclHashcat-plus-0.09 - you should have a full hashcat install!

And, now, oclHashcat should run!

nVidia is a bit of an ugly hack, but... so is running Ubuntu 12.04 in a chroot.  The installer will refuse to run properly.

Download the nVidia installer.  Run it with the -x flag -

sh NVIDIA-Linux-x86_64-295.20 -x
cd NVIDIA-Linux-x86_64-295.20

Manually copy a few libraries into place and symlink them.  You'll need to use the proper filenames here.

cp libcuda.so.295.20 /usr/lib
ln -s /usr/lib/libcuda.so.295.20 /usr/lib/libcuda.so
ln -s /usr/lib/libcuda.so.295.20 /usr/lib/libcuda.so.1
cp libnvidia-ml.so.295.20 /usr/lib
ln -s /usr/lib/libnvidia-ml.so.295.20 /usr/lib/libnvidia-ml.so.1

Finally, there's an ugly, and perhaps slightly risky bind you need to do to let it find the modules.dep file it needs:

On the host system:
sudo mount -o bind /lib/modules /ubuntu_12_04/lib/modules 

Alternately, you could probably copy the modules from the current running kernel into the right directory.  I didn't say it was pretty!

And... now, you should be able to run cudaHashcat-plus64.bin properly!

Hope this helps those of us who are waiting for 12.04 to stabilize a bit...

Update: To use this with 12.04 and Catalyst 13.1, /tmp needs to be bound to the chroot.  I've updated the instructions with this.  Thanks to f0cker on #hashcat for the updates!

1 comment: