Move all the apt configuration to the start of the process.
Upgrade all existing apt packages during the initial apt setup.
After upgrading apt packages, reboot into the new kernel (and confirm it's running).