[COOK-2458] Update package cache on install failure and retry

Fix to update the aptitude package cache and retry when an apt-get
install fails.