Cannot open map file firmware.map: Permission denied

I’ve just installed platformio on a new system (ubuntu 16.04) using the python3 easy install script. When I try and compile a project it fails during the linking process with a permission error. Am I missing a step?

$ pio run
....
....
/home/xxx/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: cannot open map file firmware.map: Permission denied                                                                                                      
collect2: error: ld returned 1 exit status                                                                                                  
*** [.pio/build/xxxx/firmware.elf] Error 1        

Looks like you did everything from root. Remove /home/xxx/.platformio and never use root with PlatformIO.