Local Tech Repair: Repairing Broken Packages Ubuntu - Livecd

Friday, June 24, 2011

Repairing Broken Packages Ubuntu - Livecd

Sometimes you accidentally have power loss during and update or you accidentally turn the computer off during an install (or in my cause my little girl likes the blue button). well how do you fix a broken update that won't let your ubuntu start. Well I will help you try a method of fixing that.
The first thing you will need is an Ubuntu Live cd. This comes in handy especially if you can't boot ubuntu to try to fix the problem so I suggest always having it on hand if you only have one computer. Once you have that just boot to the live cd. Once your in the live cd you will want to open up terminal and type sudo -i if it is not already in root.

from root you will want to type:
cat /etc/fstab

this will give you the information about the system something that will look like this.
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda1
UUID=0ad11260-eafc-40cb-a20d-4801bfdae453 /               ext4    defaults,errors=remount-ro 0       1
# swap was on /dev/sda2 during installation
UUID=60331c4e-0957-4d3a-b9a8-6da71fed3455 none            swap    sw              0       0
...

What you want is the one that has the ext4 or 3 or 2

the /dev/sda1

then type:
mount /dev/?d?? /mnt/repair

in my example would look like this
mount /dev/sda1 /mnt/repair

what this does is mount the drive with the partion on sda1 to /mnt/repair so that we can start repairing the ubuntu partion

type:
sudo chroot /mnt/repair su
sudo apt-get update
sudo apt-get upgrade
sudo aptitude upgrade
sudo apt-get -f install
sudo dpkg --configure -a
sudo apt-get upgrade

what this does is changing root to the broken ubuntu system then we are updating and then upgrading to make sure everything is up to day. we then force install the pending and then we configure the packages and then upgrade again to make sure everything is upto date.

we can now exit and reboot the system.

This will fix the broken packages and then if that was what was holding up the boot then it should boot if not then you will have to try something else.

hope this helps start fixing a bad boot because of a bad install or update.

Local Tech Repair Admin






2 comments:

  1. I think you have to make "/mnt/repair" before it can work. I'm trying it now and it says "mnt/repair does not exist."

    ReplyDelete
  2. it should mount it in this section
    "then type:
    mount /dev/?d?? /mnt/repair

    in my example would look like this
    mount /dev/sda1 /mnt/repair"

    ReplyDelete