Uploading to Strava from Arch Linux

I’ve had a MBP for work for the last year or so, so had side-stepped the misery of getting GPS data from my Forerunner 305 on to Strava. Now I’m back on Arch full time, and the plugin I was using no longer works; so it was time to find a new approach.

The first thing you will need is a copy of garmintools, which no longer seems to be available in the AUR. If you can get that built and installed, then I refer you to my previous article to get it working.

At that point, you should be able to run “garmin_save_runs”, and all the data on your device will be exported (in the current working directory!). The data is organised by date, so it should be pretty easy to find the track you want.

Unfortunately, the data is exported as a “.gmn” file, which isn’t supported by Strava; so we need to convert it. Next stop is garmin-dev. You can either clone the repo (if you know what git is), or just download the zip. It’s then as simple as pointing the tool at your file, and saving the output:

./gmn2tcx 20160801T151814.gmn > 20160801T151814.tcx

And uploading the tcx file to Strava. Happy trails!

Error building node module in a Vagrant box with NFS

I was trying, and failing, to install node-heapdump:

vagrant@debian7:/vagrant$ npm install heapdump
npm WARN package.json execSync@1.0.1-pre No repository field.
npm http GET https://registry.npmjs.org/heapdump
npm http 304 https://registry.npmjs.org/heapdump

> heapdump@0.2.7 install /vagrant/node_modules/heapdump
> node-gyp rebuild

make: Entering directory `/vagrant/node_modules/heapdump/build'
  CXX(target) Release/obj.target/heapdump/src/heapdump.o
  CXX(target) Release/obj.target/heapdump/src/platform-posix.o
  SOLINK_MODULE(target) Release/obj.target/heapdump.node
flock: ./Release/linker.lock: No locks available
make: *** [Release/obj.target/heapdump.node] Error 71
make: Leaving directory `/vagrant/node_modules/heapdump/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/vagrant/.nvm/v0.10.26/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.2.0-4-686-pae
gyp ERR! command "node" "/home/vagrant/.nvm/v0.10.26/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /vagrant/node_modules/heapdump
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! heapdump@0.2.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the heapdump@0.2.7 install script.
npm ERR! This is most likely a problem with the heapdump package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls heapdump
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.2.0-4-686-pae
npm ERR! command "/home/vagrant/.nvm/v0.10.26/bin/node" "/home/vagrant/.nvm/v0.10.26/bin/npm" "install" "heapdump"
npm ERR! cwd /vagrant
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /vagrant/npm-debug.log
npm ERR! not ok code 0

A github issue suggested that cloning the repo, and running node-gyp rebuild, might give a better error. But that succeeded. Searching for the error message: “flock: ./Release/linker.lock: No locks available”, pointed the finger at the share being mounted using NFS. Unfortunately, after much research and fiddling, the best solution I could come up with was to switch the vagrant share back to a VirtualBox one temporarily.

vagrant@debian7:/vagrant$ npm install heapdump
npm WARN package.json execSync@1.0.1-pre No repository field.
npm http GET https://registry.npmjs.org/heapdump
npm http 304 https://registry.npmjs.org/heapdump

> heapdump@0.2.7 install /vagrant/node_modules/heapdump
> node-gyp rebuild

make: Entering directory `/vagrant/node_modules/heapdump/build'
  CXX(target) Release/obj.target/heapdump/src/heapdump.o
  CXX(target) Release/obj.target/heapdump/src/platform-posix.o
  SOLINK_MODULE(target) Release/obj.target/heapdump.node
  SOLINK_MODULE(target) Release/obj.target/heapdump.node: Finished
  COPY Release/heapdump.node
make: Leaving directory `/vagrant/node_modules/heapdump/build'
heapdump@0.2.7 node_modules/heapdump

Success!

Uploading data from a Garmin Forerunner 305 on Arch Linux

I have a Garmin Forerunner 305 GPS watch, that I use to record running data; which I upload to Strava. I recently had to get this working with Arch, and I wanted to record the steps required; both for posterity, and in case I need to do it again.

To get it working, you need to install garminplugin from the AUR. It has a dependency on garmintools so you need to install that manually as well, as makepkg doesn’t know how to. You then need to rmmod garmin_gps, and blacklist it.

At this point, you can run:

garmin_get_info -v

If you get back a gobbet of xml, then all is well; and you should be able to upload data to Strava or Garmin Connect. If you get a permission error, then you need to add a udev rule. Create a file named /etc/udev/rules.d/51-garmin.rules, and enter in it:

ATTRS{idVendor}=="091e", ATTRS{idProduct}=="0003", MODE="666"

(If you are using a different device, then you’ll need the appropriate vendor or product ids). If you reload the udev config, you should be able to access your device.

UPDATE: this has stopped working for me; I can still get the xml off the watch but the browser plugin doesn’t work (on Strava anyway). I’ll update this if I ever get it working again.