Category Archives: Uncategorized

Fixing a corrupt TCX file – The easy way

Anyone who has a Garmin cycle computer for any length of time seems to experience this, and it is a pain to fix.

Some Background

The TCX files are stored on the Garmin device in the History folder and are simply an xml file which logs data when needed assuming you use the smart recording. The problem is that occasionally, it doesn’t write all the data correctly or drops some data leaving you with a corrupt file. This used to happen whenever the device crashed, although they seem to have fixed that. Now the mapping functions just get to 100% and then sit there.

Fixing it – the hard way

The first time it happened, I simply broke open the TCX file and edited the xml to make it parse correctly. It did allow it to be imported into SportTracks although with some amount of data loss. Further attempts did show that the data loss is because it isn’t actually in the file.

If you are going for this approach watch out. VIM syntax highlighting is really slow. I did come across firstobject XML Editor (which is free) and can parse and reorganise the xml to let you find the line with the problem. Honestly Garmin, line 2 position 2014798 is quite hard to get to!

Since the data isn’t always in the TCX file, it can’t really be recovered properly. Yesterday for instance, it dropped over the laps up the hill we were climbing, pretty much loosing the only important section of the ride.

Fixing it – the easy way

Since I did need the data from yesterday, some more Google time was spent to try get things back. With lots of tests, I found a way that has restored the TCX back giving near perfect data. Simple and free too.

First, go into the menu, select training -> Courses -> Create New
Select the file that has the problem. Give it a name and hit mode again. It’ll save the file to the device

Copy this GPX to your computer. Go online and grab a copy of TCX Convertor. (I’d recommend donating if it works and you can)

Open the file in TCX Convertor, then with the export menu, export it as a TCX file choosing the option for history. This will regenerate the broken TCX file and save it out for you letting you import it into SportTracks or Garmins software. And best of all, all the points will return.

Why Garmins device can’t do this I don’t know. It stores the ride data somewhere else other than the TCX files and can create the course even when the TCX is missing huge sections. Either way, I’m glad I’ve found this and I hope it helps.

Windows Hyper-V VM Failed To Start

So today while trying to reboot a server in Hyper-V I came across a lovely little problem. The machine shut down fine. I changed the network settings to give it a static mac address. Hit start and wam. VM failed to start.

A quick check showed that there was enough memory available. There should have been since I just shut down the machine anyway. The event log gave nothing useful. An error code of 0xC0000142 got nothing useful in Google (at time of writing). and the error in Hyper-V gave a more details of Vm failed to start then the machine ID. Way to go Microsoft on that error message.

Anyway after getting nowhere on google for about 10 minutes, I tried to restart the machine and it just started. Nothing changed either. Since this VM isn’t in production yet, the outage didn’t really matter, but 10 minutes is a hell of a long time for “something” to happen in the background so you can restart a VM. Hopefully R2 will fix these issues.