Moved chrootfs functions to lib