Library Persistent ID in iTunes 10.0

Apple must have realized of what we are doing by messing about with the Persistent ID and have introduced some changes in iTunes 10.0 to prevent this.

Among other changes (including an arguably worse application icon) they must have added some extra checking of the Library ID stored in the binary file of the iTunes Library (Tunes Library.itl on Windows). It now contains some CRC or similar mechanism, which is used to verify that the Persistent ID stored in the file is actually the one generated when the library was created. This explains why if you change just the bytes that contain the ID, iTunes detects that the ID has been tampered and is capable of SILENTLY restoring the previous ID.

I did not have time to check where else in the binary file iTunes checks if the Persistent ID is what it claims to be… but I found a quick and dirty way to overcome this new security measure.
iTunes has a feature that allows rebuilding the binary version of the library in case it gets corrupted… and guess what, it does so by reading the data in the XML version.

So all that you have to do is edit the XML library, corrupt the binary version, and start iTunes … Et voilà! iTunes rebuilds a perfect 10.0 library for you using your new Persistent ID.

iTunes DB Cloner is a free Windows utility that does all this for you.

iTunes DB Cloner 0.9.1.0

I would love to think that Apple will leave this feature in future releases. You can imagine the disaster it would be if your library gets corrupted by normal usage (i.e.: The computer unexpectedly powers off in the middle of an update) and you lost months of work classifying music :)

But who knows, Apple is becoming the figure of the Big Brother (IBM) they depicted in their 1984 commercial, so I would not hope this to last too long.

In the meantime, let’s enjoy some freedom to manage our iPhones in our different computers.

Installation of Mac OS X Snow Leopard on the Asus Eee PC 1101HA/1201HA

Installing Apple’s operating system Mac OS X on a standard PC is no longer a secret.

The OSx86 scene has gone a long path providing help and support, in a way that no company is prepared (or willing) to do.

Legalities aside, the time has come when it is possible to run Mac OS X on more powerful hardware than those sold by Apple.

The purpose of this post is to help other users to overcome the problems that arise while trying to install this OS on one of the coolest netbooks out there now, the 11-inch Asus Eee PC 1101HA… (which happens to be the one I own ;-)).
The hardware is exactly the same as for the 12-inch 1201HA, so everything here is applicable to this model too.

The beauty of all this, apart from the challenge itself, is the price of these nice netbooks (around 340€ in Europe!).

There are thousands of really great articles and howtos on how to undertake the installation of Mac OS X on a PC, so I won’t reinvent the wheel here.

I personally find very complete the guide written by Prasys on his blog: Installing Snow Leo (retail) for OSx86.

I claim absolutely no merit on this, apart from spending an indecent amount of hours in front of my netbook, relentlessly rebooting and trying all sort of combinations, until I found the right combination of things for these relatively undocumented machines.

What makes the installation on the 1101HA different?

The main showstoppers here are two:

  • The video adapter, the relatively new Intel Graphics Media Accelerator 500 (GMA500).
  • The IDE chipset that comes with it (Intel SCH Family).

For the video card, the applause goes to user ryuu123 at InsanelyMac, who provided the VAIOPEnabler kernel extension, that allows Mac OS X to use the framebuffer mode of the GMA500.

Once you’ve got the graphic installer of Snow Leopard booting successfully thanks to VAIOPenabler, the next issue most people encounter is that no internal hard disks get detected. I’m positively sure that you can get the 1101HA’s SATA disk recognized by tweaking some other driver, like the AppleIntelPIISATA.kext, but I’ve ran into many problems using it.

Eventually, I found a kext that actually did its job very well. I would love to thank the guy who made AppleGenericPCATA.kext but unfortunately, I have no idea where I got this kext from for I was trying different extensions compulsively for months and I’ve totally forgot where I got this one from :(.

What’s working?

In short, not much (yet). Hopefully, YOU will also be capable of helping the OSx86 community to improve the hardware support for this hardware.

Video Intel GMA500 OK – In framebuffer mode
Audio High Definition Audio compatible OK – Using VoodooHDA. Quite buggy and so far I’m still getting some noise.
SATA Hard Disk Intel SCH Family OK. I have got the feeling that the kext I’m using is not the most appropriate. Disks gets recognized as IDE ATA, but otherwise, performance seems to be fine.
Webcam USB UVC 1.3M OK
Built-in SD card reader N/A OK – It does works out of the box, without needing extra extensions. It actually works as another USB storage device.
Bluetooth N/A ?? – I haven’t test this yet. I believe it gets recognized and would work fine using the appropiate kext. I’m not too much into bluetooth.

What does not work.

These does not work for me at the moment of this writing. Particularly, I read that the WLAN chip is rather new and still totally unsupported. But hey, don’t give up. It was also said that OSX would NEVER work on our 1101HAs or any other netbook with a GMA500 chip, and here we are :).

LAN Atheros AR8132 NO
WLAN Atheros AR9285 NO

My girlfriend bought me a D-Link WA-110 Wifi USB stick, for just 12€ on sales that works nicely in Mac OS X, thanks to which, I’m now writing this post from my OSX Asus. There are many other inexpensive USB WiFi adapters.

Requirements

  • An Asus Eee PC 1101HA netbook ;-)
  • Snow Leopard Retail DVD. BUY IT!. Get your own retail DVD for just 29€, at any store. It is still illegal to install Mac OS X on a non Apple machine, but at least you won’t be stealing. Mac OS X is an excellent operating system, with a top-notch user interface. And honestly, with this price, you really want to play fair. The Snow Leopard disks bundled with Apple computers will not do, since they are specially trimmed for an specific combination of hardware.
  • 1 USB memory of 8GB (at least). I like to use 2 separate pendrives. One for the Snow Leopard Install DVD and another one just for the boot files (less than 5MB). Note that you can also use the SD reader of your Asus netbook. However you can also fit the boot files and Snow Leopard files in the same USB stick.
  • This package 1101HA SL Boot (1.67MB). I’ve packed the following things:
    • Chameleon Boot Loader RC2 NBI. For reasons unknown, the standard Chameleon distribution does not provide the native 1366×768 resolution, rendering the system to just 1024×768. This is the only one I’ve found to work well, but you may be able to get it working with other versions.
    • DSDT.aml Don’t worry if you know nothing about this. In a nutshell is a file that Chameleon uses to patch on-the-fly the Asus BIOS, correcting some stuff so Mac OS X can boot properly.
    • com.apple.Boot.plist to enable verbose logging at boot time as well as 32-bit mode by default.
    • smbios.plist to emulate a MacBook Air machine.
    • My cocktail of different kernel extensions :) Again, these might not be the most adequate, but they worked for me. I thank you for all your suggestions and improvements.
      • ACPIPS2Nub.kext
      • AppleACPIBatteryManager.kext
      • AppleGenericPCATA.kext
      • ApplePS2Controller.kext
      • AppleSMBIOS.kext
      • fakesmc.kext
      • NullCPUPowerManagement.kext
      • OSXRestart.kext
      • PlatformUUID.kext
      • VAIOPEnabler.kext
      • VoodooHDA.kext
    • A patched version of OSInstall.mpkg, the Snow Leopard installer, for disks partitioned the old style (with a Master Boot Record)This will allow you to install Mac OS X and Windows easily on different partitions, otherwise you’ll have to partition you hard disk in GUID format from Disk Utility, as required by Snow Leopard, before being able to select it as a target drive.
  • Highly recommended

  • A working Mac OS X installation. It can either be an original Apple computer, or another hackintosh. This is just for dumping the Snow Leopard DVD into the USB memory, and preparing the USB boot drive.
  • Alternatively, if you are a bit creative, you could find different methods to do this task. I finally ended up booting my Macbook Pro, but if you don’t own a Mac, you could get anywhere with a handy linux distribution with HFS+ support. I would recommend RIP (Rescue Is Possible) linux distro, less than 100MB in size, and bootable from a pendrive.

Hands on

Right, enough talking. Let’s jump straight into the funny part. I have tried to simplify things as much as possible. I TAKE ABSOLUTELY NO RESPONSIBILITY IF THIS DOES NOT WORK FOR YOU.

However, it did work fine for me, and if you are not completely new to the OSx86 scene, you will realise the hardest part is getting all the extra extensions and config files together. Once you have read a bit about all this (elsewhere) and figure out how to put things together, you should get everything working straight away.

For simplicity, this post does not cover partitioning your hard disk, or setting up the dual boot.

Preparation

  1. Format a USB drive as HFS+ (I’d recommend using NOT journaled HFS+).
  2. Dump the Snow Leopard DVD into a USB drive, formatted as HFS+. The easiest way is to do it from Mac OS X using Disk Utility. Check online how to do this, for example, at Prasys’s howto.
  3. Copy the contents of my package into another HFS+ pendrive, or even the same USB drive used for Snow Leopard Installation files.
  4. Make the boot pendrive bootable. Once you’ve copied the files, you just need to make the USB stick bootable by installing Chameleon boot loader onto it. I have included a simple but effective script to do this. Check the file at Chameleon-2-NBI/install.sh. Edit it, review it’s values, and execute it.
  5. Boot your netbook from USB using the boot contents of above, and you should get right into the graphical installation window.
  6. Once you have completed the installation process, you still need to make OSX bootable directly from the hard disk, without the booting pendrive. The easiest thing is to boot again using your boot pendrive, but this time, press TAB or another key as soon as you see the Chameleon logo, so you can select which device to boot. In this case, you want to select the hard disk’s partition that you choose to install Mac OS X.
  7. Now that you are totally logged on Mac OS X, open Terminal to get a comand line that we’ll use to install Chameleon on your hard disk. You can just use the same Chameleon-2-NBI/install.sh script, but editing its values to point accordingly to your hard disk instead of the USB drive.
  8. Copy the Extra extensions (the same ones included in my package that you used for booting the installation) to your Mac OS partition so they are present as well when you boot directly from your hard disk. This is nothing new, and you should also be able to find details on this in any Snow Leopard guide for standard PCs.

… and this is it! If you’ve reached to this point, you should now be able to boot Snow Leopard directly from the hard disk. There are some simple guides to make Mac OS X and Windows to coexist (a.k.a Dual Boot); but the point is that you’ve now got SL on your 1101HA and can read further information targeted to mainstream PCs.

Links & resources

As said, the beauty of the OSx86 scene is the broad and excellent support from all the community members around the globe, from the savvy geeks to the most recent newcomers that throw themselves into forums to share knowledge and experiences. We can’t thank them all enough.

Here are some really good links you’ll need if you need to learn more. Remember this is still very experimental, so be really patient, take your time to get things working, and read a lot :) Apart from this, there’s no other secret or magic.

How to retrieve the iTunes Persistent ID from your iPhone

What if there is no way to recover your last iTunes Persistent ID from your PC/Mac? i.e. You have formatted your computer, have no longer access to it, or even worse, it’s been stolen.

In order to avoid erasing your iPhone/iPodTouch and starting all over again, there is still a chance to retrieve this magic ID, so you can then use it to make your computer’s iTunes library to match it.

Since a couple of guys have already asked about this, I though it might be of some help to describe how to do this.

I am aware that this method may seem fairly discouraging to most users, but I would also add that it’s not as complex at it may seem at first sight.

First of all, you will need to have access to your iPhone’s operating system (i.e. be able to browse through its files). The only way I know so far is to have the iPhone jailbroken. If you don’t know yet what this is,  iClarified has probably the best tutorials I have seen about this.

If you already have your iPhone jailbroken read on.

The idea is to get the iTunes Persistent ID directly from the very same file where it is stored inside your iPhone. This file is binary (and there is no XML equivalent pair as in the PC/Mac version of the iTunes library). The persistent ID is stored here, in a very similar way as Andrew found out for the PC/Mac versions of the library.

The Persistent ID is 8 byte long and spans exactly from byte 37-44. Bear in mind that the iPhone platform is little-endian, while PC and Intel Macs are big-endian. This means that the bytes are stored in a different order on the iPhone and on the computer (either PC or Intel Mac).

Probably I may be getting a bit too technical, so the best way to illustrate this method is to actually describe a sample process to read this ID.

I have chosen a very simple approach where you only need to log on your iPhone via ssh and type a couple of commands.

Get network access from your computer to your iPhone

1) Make sure your iPhone is jailbroken and has the SSH package installed. If not, you can use Cydia or Installer to get it on your device.
2) Connect your iPhone to the same Wi-Fi network your computer has access to. In the example below, my WiFi network is named LUCERO.

wifi1

3) Take note of the IP address of your device. This can be easily retrieved by touching the blue > sign at the right of your WLAN’s name. A new screen with some connection’s details appear. In the screenshot below, the IP address of the iPhone is 192.168.1.101.

wifi2

4) I will highly recommend to turn off momentarily the Auto-Lock feature of the phone, since the SSH connection will be guillotined if the iPhone enters in standby mode (blank screen). Go to Settings, General, Auto-Lock and select Never. You can turn this option on again once you are done reading the ID.

autolock-off

5) Connect via ssh to your phone, using the IP address you have written before (192.168.1.101 in my example). MacOS has a nice SSH client built in, and you only need to type ssh and the address in a command line window (i.e: ssh 192.168.1.101). On Windows, I would recommend downloading and installing putty, a really nice and free ssh protocol client.

putty

6) Once you have your ssh connected to your iPhone you will be prompted to enter a user and a password. User is “root” and password is “alpine” (without the quotes!).

login as: root
root@192.168.1.101's password:
localhost:~ root#

View the contents of the iTunes database file

7) Don’t take my word for it and locate the actual location of the iTunes library file on your iPhone.

localhost:~ root# find / -name iTunesDB
/private/var/mobile/Media/iTunes_Control/iTunes/iTunesDB
localhost:~ root#

8 ) This is the file that contains your lost Persistent ID. You can choose to view its contents as you want, but I think good old vi editor is an easy choice for this purpose. Don’t worry about what you may have heard about the toughness of this editor. We are only going to use it very briefly, so you don’t need to be a unix geek.

vi /private/var/mobile/Media/iTunes_Control/iTunes/iTunesDB

If the above command fails, you need to install the vi package (again, use Cydia or Installer).
The result is an scrambled window with some funny characters. Remember iTunesDB is a binary file, so we need to turn on the hexadecimal editor mode of vi.
Press [escape] to enter in the command mode and type

:%!xxd

Now the window should look like this:

vi-hex

9) Now take note of the bytes 37 to 44 and write them somewhere or copy them to a text file. In the screenshot below, these bytes are  2e94 2b95 87f2 8cde.

10) Hurray you are a genius and have extracted the Persistent ID! The hardest part is now done. Give yourself a kiss and keep on reading. We are almost there.

Re-write the Persistent ID value in the appropriate (byte) order

10) Now write these value again in reverse order (remember the big endianness of the PC/Intel Macs); bearing in mind that a byte is shown as 2 hexadecimal characters, so you have to take them in pairs. I would also remove any white space in between so you can copy and paste the result in iTunes DB Cloner. Lost? Don’t worry, check the sample value: 2e94 2b95 87f2 8cde converted to big endian is DE8CF287952B942E.

Update your computer’s iTunes library to match the Persistent ID on your device

11) Now use this value in iTunes DB Cloner to alter your PC’s iTunes library, so it matches the persistent ID already stored in your iPhone. If you are using a Mac, update the value following Andrew’s instructions.

itdbc-update

12) You can now logoff from your iPhone’s unix shell. Type q! in your vi window. and then logout or press CONTROL+D to end your terminal session. Remember to turn on again the Auto-Lock feature to some value or your iPhone will remain on if you don’t send it to sleep manually by pressing the power button.

… and that’s all folks. Hope it was of some help to those of you as desperate to save your iTunes library as to have read all this.

This post was written in bit of a hurry, so I might have not been clear enough. Any comments or requests for clarifications will be welcomed.

iPhone FAQ

Updated: This is from when I had an iPhone “2G” with firmware 1.1.4. I guess that this error is long fixed now in current versions. I just keep this here for my records.

Quick solutions to annoying problems I found with my iPhone. Note that it needs to be jailbroken in order for you to logon into it by ssh.

1.- Mail application crashes (starts, shows white screen for a couple of seconds and then goes back to the home screen).
You have probably wrong file permissions for the directory /private/var/mobile. Use any method of your choice to reset them to user mobile, group mobile. If you can get a command shell easily (install Term vt100 for instance); issue this:

chown -R mobile:mobile /private/var/mobile
2.- I can’t login as root using Term vt100 or similar terminal emulation apps.
Password is either dottie or alpine. If you keep receiving that the password is incorrect, check connecting to the iPhone from another computer in the same WiFi with user root and one of the 2 possible passwords. If you can logon from outside the phone, this is probably due by wrong file attributes in the executable terminal app.

Check file properties for your installed app executable.

# ls -al /Applications/Term-vt100.app
total 296
drwxr-xr-x 2 root admin 238 Apr 20 02:58 .
drwxrwxr-x 49 root admin 1666 Apr 20 03:10 ..
-rw-r--r-- 1 root admin 5131 Apr 20 02:58 Default.png
-rw-r--r-- 1 root admin 633 Apr 20 02:58 Info.plist
-rw-r-xr-x 1 root admin 97976 Apr 20 02:58 Term-vt100
-rw-r--r-- 1 root admin 2514 Apr 20 02:58 icon.png
-rw-r--r-- 1 root admin 34673 Apr 20 02:58 pie.png

The executable program should be su-rooted.

chmod +s /Applications/Term-vt100.app/Term-vt100

Upload your own iPhone ringtones

3iphones.png

How come that I have a $299 state-of-the-art mobile phone and can’t do simply things available in $80 Nokias?

I have a pretty capacious MP3 player and can not select any of its thousands songs as a ringtone!?

Of course, Apple provides a method por uploading new ringtones to the iPhone, but most of them either involves money or are quite discouraging.

I finally found my own way to upload any song as a ringtone. Nothing big, I just took a look to iPhone’s internal folders.

You need to be able to upload files to your iPhone by some means (Samba, SCP, etc).

  1. Edit your ringtone with your sound editing tool of preference and store it in a format like mp3.
  2. Convert the audio file to AAC. I use iTunes to convert files from MP3 to AAC (.m4a). For this to be possible make sure you have iTunes set to import files with AAC Encoder.
  3. Add your ringtone mp3 to iTunes Library. Right click on it and select “Convert Selection to AAC”. When the process finishes, check the generated file under your iTunes folder (somewhere like C:\Documents and Settings\<your user name>\My Music\iTunes\iTunes Music\).
  4. Copy your converted AAC file into the Library\Ringtone folder under your iPhone root directory.
  5. Rename its extension from .m4a to .m4r.

The next time you try to change the ringtone, your uploaded file will appear in the list.

Hello world!

Welcome to my blog. I’m not a big fan of blogs myself, but though it was about time to start my own and perhaps use it for dropping small little notes. We’ll see.

For communication purposes, please allow me to express myself in my not so good English.

( Yes, you guess it right, this is the default title in my new blog software)