refactor become_root and move the removal of the cd repo in an extra test