No checksum on Apple iPhone UDIDs

Just found out the hard way that there is no checksum on the UDID of Apple devices (iPhone, iPad, iPod Touch etc.). The UDID is a unique identification for the device, and is used during development to allow pre-release versions of apps to be tested on real hardware before submitting to the App Store. This allows developers to test the app, but allows Apple to ensure the app isn’t generally released without going through their App Store.

For such a long number (a 40 digit hexadecimal string), I would have thought that there would be some form of checksum in there – technology that has been around since I don’t know when and is prevalent in all fields of computing where having correct data is important. Even credit card numbers have a form of checksum built-in to guard against error.

However, alas it seems there is no checksum in the number as I’ve found out that a UDID we were provided had one digit wrong. Wouldn’t normally be a massive issue, but due to circumstance it will be a pain to rebuild and get the app we want to put on the device on it. So if you are getting a UDID from someone in the future, recommend that you ask for a screenshot to be sure.

OS/X Leopard and Samba Permissions

Finally solved a problem that has been causing me much grief. We have a fileserver running CentOS Linux with Samba used to provide file shares to our desktops – a mixture of Windows, Mac and Linux. For some reason the file server was not setting the correct permissions on files copied onto it – using 644 (rw-r–r–) instead of 664 (rw-rw-r–). The consequence of this was that only the person that create the file (or similarly directory) could edit it or move it to another directory (unless they owned that directory). This is something that I’m sure used to work for us, so I was a bit puzzled to hear reports of the problem.

Normally setting either the “force create mode” and “force directory mode” options in the smb.conf configuration file, or using “inherit permissions” ensures that the correct permissions are set. The former option can be set to 664 / 775 respectively and will ensure that files copied onto the server get the right permissions – in particular the group write bit is set allowing any user (who has access to the file) to write it, or for a directory to copy other files into that directory. The latter option ensures that new files inherit the permissions of their parent, so assuming that the system starts with the correct permissions on everything, all new files should continue to have the right permissions.

In the end I decided to upgrade the server as we were running an old version of CentOS and it was beneficial to do it anyway. However, after upgrading and running some tests the problem still persisted. Very frustrating as there are lots of postings of people having similar issues, and they always get resolved by setting the above options.

Finally, I managed to get to the bottom of the issue. It seems that Samba has a feature that allows Unix clients to perform additional operations. OS/X takes advantage of this in Leopard (and now Snow Leopard I imagine) and resets the permissions on the file after it is created. So it doesn’t matter (with the exception of the below) what options you set in smb.conf – any files created from recent Macs will have the wrong permissions. Most of our heavy users of the server use OS/X and so what I thought was an issue prevalent to everyone actually was specific to one operating system.

Looking around the web, I came across a post in the Apple support forums with the solution – set “unix extensions = no” in the global section of smb.conf and restart Samba. One simple line and suddenly everything is back to how it was. Reading around it appears to be an issue that is being resolved – although I imagine it will take a few months before it appears in mainstream releases.

Building mpt-status for CentOS 5.2

At Vexed Digital, we recently migrated a large part of our internal infrastructure from a co-located server to a couple of machines that we lease from our hosting provider. These machines are used for things such as email, our website, FTP etc. and so we have RAID-1 (mirroring) with a hardware controller. Hardware RAID has always worked well for me, but we obviously want to be sure that the underlying physical drives are OK and for that we need to install tools to interrogate the controller for status updates.

Using ‘lspci’ I found that the card in one of the machines is an “LSI Logic / Symbios Logic SAS1064ET PCI-Express Fusion-MPT SAS” controller, but unfortunately could not find any vendor tools for it. Fortunately though, there is an open source tool developed by originally by Matt Braithwaite and now Roberto Nibali which you can find through Freshmeat.

If like us you run CentOS on your machines, you will find that it doesn’t compile straight away. First of all, you will need to install the kernel source which is easy enough to do if you follow the instructions on the CentOS website. Once you’ve done that you will find that you still can’t compile it unless you perform one more step.

First of all, you will need to edit the Makefile and alter the line for CFLAGS to add the ‘include’ directory of your kernel source tree, eg:

CFLAGS          := -Iincl -Wall -W -O2

Here I’ve added the second line “-I${KERNEL_PATH}/include ” so that it can find linux/compiler.h. You are now ready to compile, but make sure that you run ‘make’ with the path to your kernel source tree, eg:

make KERNEL_PATH=/home/ben/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.i686

You should then (almost immediately – it’s not large) get a single binary, mpt-status. Run this and it will tell you in a few lines the key information about the controller, virtual disc and each of the physical discs. It couldn’t find the controller where it expected it when I ran it, but unlike some tools it is actually quite helpful and told me to use the ‘-p’ option to probe the SCSI bus. This told me that the card was on SCSI ID 6, and it suggested the arguments ‘-i 6’ would give me the information I was looking for:

ioc0 vol_id 6 type IM, 2 phy, 231 GB, state OPTIMAL, flags ENABLED
ioc0 phy 1 scsi_id 7 ATA      GB0250C8045      HPG2, 232 GB, state ONLINE, flags NONE
ioc0 phy 0 scsi_id 8 ATA      GB0250C8045      HPG1, 232 GB, state ONLINE, flags NONE

The documents that come with the package give some information on what this means, but in the above case the first line shows that the virtual disc is in an OPTIMAL (ie. good) state and is 231GB with type IM which means mirrored (RAID-1). There are two discs, both are ONLINE (so OK).

Of course the next stage is getting the pertinent information into our nagios system so that we get told when they fail. Note I didn’t say if – drives always fail eventually…it’s just a question of how soon 🙂

MacBook Pro

I’ve never been a great fan of the Mac interface – mainly I just couldn’t get used to the idea of a menu bar at the top of the screen. It worked fine when we had smaller screens – for example with the ‘Compact Mac‘ family – since realistically you had to run each application full screen anyway. The menu bar can be anywhere on the screen and it will always be close by.

It became slightly more annoying as screens got larger, but was still bearable if you had a single screen. It took a bit of work to move the pointe up there, but it wasn’t a major inconvenience. I suspect Apple didn’t change it back then since it had become a trademark of the operating system, and didn’t upset too many people.

One thing Macs have always been good at is second monitors – you just plug them in, and it usually works with little fuss. The first such setup that I used had an A3 monitor attached to a Mac IIci. You could move the menu bar onto the A3 monitor, but it was still all the way up there at the top – so if you were working elsewhere on screen, it was such as chore to get up there!Monitors are still increasing in size, and nothing has really changed – it must be a nightmare if you have 2 30″ cinema displays ;-). Well perhaps not a nightmare given a setup that most people would love to own, but a bit annoying though. I do wonder how long it will be before Apple do something?

Anyway, otherwise the Mac interface has improved over the years to the point where I’m beginning to quite like it. With OS/X having Unix underneath, the Mac has become every developers dream – a nice interface with good software support and a decent operating system underneath. It also has some very nice hardware – the MacBook Pro in particular looking like it was designed by engineers, rather than managers. The only thing missing for me was the ability to run certain Windows programs, as my job quite often requires me to do this.

Well of course Apple changed to using Intel processes, and that barrier has gone. So when an opportunity came up recently to switch, I went out and got a MacBook Pro with VMWare Fusion. So far it’s running nicely –  with my previous laptop, I always had to worry about blocking the air vents since these are usually under the machine and at the side. The MacBook Pro vents air under the screen in a way that means don’t have to worry about such things. And the illuminated keyboard really is the icing on the cake. The interface (OS/X 10.5 aka Leopard) runs very nicely – I know that a number of changes upset die-hard Mac users, but I think they will be appreciated by new converts.

There are a few annoyances – VMWare Fusion won’t allow you to suspend a VM if it’s running from a Bootcamp partition – for good reasons, but it’s still annoying. And a number of applications such as Adium and Skype want to show an icon in the dock, even though under Windows or a Linux based system they don’t (or at least their equivalents don’t in the case of Adium). I’ve fixed it for Adium by following the instructions here, but when I tried it on Skype it stopped logging in! I’m not sure how well it would work for Skype anyway, as a few key functions require that you have access to the full menu bar – sigh.

Flash Player 9 Update on Adobe Labs

It’s been a while since I updated my blog, mainly because I’ve had too much work on and not really much to say. However today I’ve discovered that the current pre-release version of Adobe Flash Player for Linux fixes the bugs that I wrote about previously. Fortunately I’ve managed to run the Windows version under Wine up until now; it’s not ideal, but it works. However it’s always nicer to run the player natively, and also nice to see that Adobe are just as committed to Linux support as other platforms.