15 Sep 2009

Broken Ubuntu Karmic: How To apt-get upgrade Using The LiveCD

If your Ubuntu installation (or any other linux distribution that has a liveCD) is broken and can’t boot because of a faulty update, you can try to update your installation after booting from the LiveCD.

Start a terminal and use these commands (/dev/sda2 might need to be changed to match your configuration, you can use fdisk to figure out which partition is your main one):

sudo mkdir /media/karmic  
sudo mount /dev/sda2 /media/karmic  
sudo mount -o bind /proc /media/karmic/proc  
sudo mount -o bind /dev /media/karmic/dev/  
sudo cp  /etc/resolv.conf /media/karmic/etc/resolv.conf  
sudo chroot /media/karmic apt-get update  
sudo chroot /media/karmic apt-get upgrade  
sudo chroot /media/karmic apt-get dist-upgrade