First ensure that the virtual machine is connected to the network, you can use the ping command to check whether the network is connected. Ensure that the service is open when using a NAT network.
If you have previously executed the Apt-get update command but failed, execute the rm-rf/var/lib/apt/lists/partial/* and sudo apt-get clean command, then replace the source, there are many online can try, this Recommend this URL https://launchpad.net/ubuntu/+archivemirrors, with gedit/etc/apt/ The Sources.list command opens the file, the content of the source is modified, and then the Apt-get update is executed.
Remember, make sure that you are connected to the network, and sometimes the network is displayed, but Ping does not pass.
The above method is only for reference, I can use the time, may also have problems.
Workaround for Apt-get update failure in the VM virtual machine in Ubuntu (may be valid)