If you mount the guest additions and see a warning about missing kernel headers, and the additions don’t seem to work, and then after trying to launch the guest additions CD again you get VERR_PDM_MEDIA_LOCKED error and everything starts going downhill from there – this is the solution that worked for me:
1. Reinstall Ubuntu
2. Before installing the guest additions:
sudo apt-get update sudo apt-get install build-essential linux-headers-`uname -r` dkms
3. Now launch the guest additions CD