Friday, January 30, 2015

Fixing repo init to check out Chromium OS code

Building Chromium OS is a little tricky. Although the instructions from the project page are pretty detailed, one bump I ran into was this error when I put in the "repo init ..." command:
fatal: Cannot get
fatal: HTTP error 401

Turns out that there's an issue with in the repo init code that makes it fail if there's anything wrong with your ~/.netrc file. My system didn't even have a .netrc file, which made it hard to know how to fix that problem.

As Mike Frysinger explained on the Chromium OS dev mailing list, it's possible to make your own valid .netrc file by using the cookie values created when you set up your gerrit credentials. The first thing I did was make a copy of the cookies file:
cp ~/.gitcookies ~/.netrc

From here, I went ahead and removed the second line (the cookie for and reformatted the information from: FALSE / TRUE 2147483647 o git-<email address>=1/X_<cookie data>
to look like this:
machine login git-<email address> password 1/X_<cookie data>

When you run the full "repo init ..." command again, it will add a second entry in your .netrc file for with the same cookie value and you'll be ready to run "repo sync".

Be aware that (as of today, January 30, 2014) downloading the whole repository will take about 11GB of disk space. And I'm working in Linux Mint 17, which is based on Ubuntu 14.04.

In any case, I hope this helps someone fix this issue faster than I did. The pieces of the puzzle were a little scattered.