Tuesday, 25 December 2012

FIX: "Hash sum mismatch" on Linux Mint update

OK, here is the scenario.

I have a Linux Mint machine (maya) that has not been booted for some time.

I started it up and decided to do some housekeeping as a prelude to upgrading it to 'Nadia'

The first thing I did was do an apt-get update which failed with "hash sum mismatch" when updating the Mint list (Sorry, I didn't keep a copy of the full error)

Another machine on my LAN is already on Nadia and it apt-get updates fine.

I use apt-cacher-ng, so I disabled this and tried update again. This worked, which led me to believe there was some corrupt file in the cache somewhere. I spent hours trying to nail this and even did apt-get purge apt-cacher-ng followed by a re-install.

None of this worked.

Eventually something twigged in my brain, and I wondered if there was a compatibility problem with the version of apt on this machine. As I said, it's been some time since I updated.

Here is  what I did;

1) Edited sources.list and commented out the single Mint line, leaving just the ubuntu repositories in place. These were updated from 'precise' to 'quantal'.

2) Did an apt-get update, this worked without errors.

3) Upgrade apt (apt-get install apt) this installed about three new files.

4) Edited sources.list again, removing comment from the Mint line and changed it from 'maya' to 'nadia' while I was there.

5) Another apt-get update and this time there were no errors.

From there everything worked as expected and no more hash sum mismatches!

Sunday, 23 December 2012

HOWTO: Build Your Own NAS

Here is the scenario, you have a Debian/Ubuntu server and you want to share files to other clients on your LAN.

This is a very simple process.

Section 1: Setting up a directory to share

1) Create a group "nfs", this group will define the users who can read and write to the share;

sudo addgroup nfs

2) Add a user to the group;

sudo usermod -a -G nfs brett

3) Create a directory for your shared files. I will create a directory called "store"

sudo mkdir /store

4) Change its group ownership to our "nfs" group

sudo chgrp nfs /store

5) Change permissions to allow the "nfs" group full access (and deny everyone else);

chmod 770 /store

Achievement check: You should be able to create files in /store while logged in as a local user who is a member of the "nfs" group.

Section 2 : Sharing with NFS server

1) Install NFS server;

sudo apt-get install nfs-kernel-server

2) Edit the exports file;

sudo vi /etc/exports

Create a simple read/write share that any network host may connect to. Add this line to the end of the file;

/store *(rw,sync,no_subtree_check,no_root_squash)

3) Restart the NFS server

sudo service nfs-kernel-server restart

Section 3 : Connecting with a client

To complete this section, you will need to be able to ping your server from the client using an IP address or DNS name. If you can't then there is no point continuing. My server name is "nas"

1) On your client, confirm that you can ping your server;

ping nas 
PING nas ( 56(84) bytes of data.
64 bytes from nas ( icmp_req=1 ttl=64 time=3.22 ms

2) Create a directory to mount the share on. We will use a directory called "nasmount" here but you can use anything you like;

sudo mkdir /nasmount

2) Edit your fstab file;

vi /etc/fstab

Add this line to the end , replacing the servername (nas) with the IP or name of your server;

nas:/store /nasmount nfs rw,defaults 0 0

3) Mount the share;

sudo mount /nasmount

4) Verify that the share is mounted using df

df -h
nfs:/nasmount            11G   11G  255M  98% /nasmount

Achievement Check: You should be able to create and delete files in the shared directory from the client*.

* You will need to use a user account on the client with the same UID as the account we set up earlier on the server. In this example the user account was "brett" with a UID of 1000. You can use something like LDAP to centrally manage user accounts across a network if you have a lot of users.

Copy a hard disk between PC's

This is a variation on this post.

I use this when I have a machine that I want to convert to a virtual machine in cases where VMWare Converter is unsuitable. eg FreeBSD


1) Ubuntu LiveCD x 2 or a CD and an ISO image
2) A pre made virtual guest machine with a virtual HDD of sufficient size.
3) A working network connection between the two. You should also note down the ip address of the target machine

Step 1:
Boot both the source machine and the new virtual machine off the LiveCD. Choose "Try Ubuntu without changing my computer"

Step 2:
Partition the virtual hard disk on the target PC using fdisk or gparted. Make sure you use the correct partition type ie: FreeBSD

Step 3: (logged in as root on the virtual machine)
Start the netcat client listening on port 5000 and pipe its output to the virtual hdd (via gunzip)

nc -l -p 5000 | gunzip | dd of=/dev/sda1

Step 4: (logged in as root on the physical machine)
Do a dd of the source drive and pipe its output to nc using port 5000 (via gzip)

dd if=/dev/sda1 | gzip -1 | nc hostip 5000

You can increase the amount of compression done by gzip to a maximum of 9 but if you are using slow CPU's and a fast network then this can actually make the whole transfer slower. Feel free to experiment yourself.

Steam Has Arrived!

Sure, it is still beta, but the beta has just been made open.

To install it simply download the deb package from the above page and install it using dpkg.

sudo dpkg -l steam_latest.deb

You may need to fix up some dependancies

sudo apt-get install -f

If you use a 64 bit distro you may also need to install the 32 bit libraries;

sudo apt-get install ia32-libs

Once you are done, simply double click the Steam icon on your desktop or find it in the Games section of your Applications menu.

Be aware that the first time you run Steam it will need to download the bulk of the application from the Internet (steam_latest.deb simply sets up the repository and acts an installer)

I only have 3 games that work so far but that's a start.

Saturday, 8 December 2012

Google Fu, Finding files

Search google for ubuntu iso files (or anything else);

?intitle:index.of?iso ubuntu