FIRST:
Using a live cd.
Boot the Ubuntu Live CD, choose "try without installing" and then establish an internet connection.
Press CTRL + ALT + T to open a terminal.
Assuming Ubuntu is on /dev/sda7
, run the following commands:
sudo mount /dev/sda7 /mnt
cd /mnt
sudo mkdir -p /mnt/boot/efi
sudo mount /dev/sda1 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
echo 'nameserver 208.67.222.222' | tee /etc/resolv.conf
echo 'nameserver 208.67.220.220' | tee -a /etc/resolv.conf
apt-get update
apt-get -f install
apt-get dist-upgrade
Click here for more info.
NEXT
Proceed with the following instructions if you still cannot update.
If you can ping 8.8.8.8 but you get a cannot resolve error when you run apt-get update
, run the following commands.
The following commands will first make a copy of your /etc/apt/sources.list
file. Then, switch the URLs to IP addresses allowing you to finish the update and then when a successful update is done, switch the old backup copy with the new one (note: this skips the security updates so be sure to do those later).
Run these commands after you chroot into your partition:
sudo cp /etc/apt/sources.list /etc/apt/sourceslist
sudo sed -i 's|http.*archive.canonical.com|http://91.189.92.191|g' /etc/apt/sources.list
sudo sed -i 's|http.*archive.ubuntu.com|http://91.189.91.26|g' /etc/apt/sources.list
sudo sed -i 's/^.*security.*$//g' /etc/apt/sources.list
sudo apt-get update
sudo apt-get -f install
sudo apt-get dist-upgrade
At this point pleas post any errors. If there are no errors, continue:
sudo mv /etc/apt/sourceslist /etc/apt/sources.list
Exit the chroot environment and run the following command to reboot:
sudo reboot
ALSO
To manually create this file run the following command (again, in the chroot environment of course):
sudo nano /etc/apt/sources.list
Here is an example of the lines that should be in the file.
deb http://91.189.91.26/ubuntu/ xenial main restricted universe multiverse
deb http://91.189.91.26/ubuntu/ xenial-updates main restricted universe multiverse
deb http://91.189.91.26/ubuntu/ xenial-backports main restricted universe multiverse
deb http://91.189.92.191/ubuntu xenial partner
Press CTRL + o and then press ENTER to save the file. Press CTRL + x to exit nano.
The following is a copy of /etc/apt/sources.list
provided for reference with all of the repositories enabled:
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner