VirtualBox VMs are very helpful for many experiments and sandbox environments. However, you need to know it doesn’t have a hardware clock of its own like the real computer OS. For that reason, sometimes when you run the sudo apt update command, it exits with the error ubuntu apt-get update release file is not valid yet. The reason for this error is your system time is behind the actual time.
To fix this error, you need to update your system time to the current real-world time.
How to fix the error ubuntu apt-get update release file is not valid yet
Run the below command to update your system time to real-world time. You would require an internet connection because the current time strings are fetched from the internet.
Syncing the system date to real-world time
sudo date -s "$(wget --method=HEAD -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f2-7)"
This will set your system time to the Google.com page response header time.
Retrying the apt-get update or apt update
After you set the system time, run update and upgrade commands again and it will work.
sudo apt upgrade
If you have any questions, please feel free to ask.
I have referred to this post to get the best command for the system time update method.
Setting system time and date in sync with the internet time: https://unix.stackexchange.com/questions/79112/how-do-i-set-time-and-date-from-the-internet