Proceed with extreme caution. Having sufficient backups is encouraged at all times as you are just one step away from having to reinstall your entire system. Also, I don't claim responsibility for any possible disastrous outcomes. Good luck and all the best.
A not so great idea at fixing your problem.
You could try chrooting from a LiveCD of the same architecture and try and fix the broken packages.
Note: chrooting will fail if it is not of the same architecture. For example, you can only use a 64-bit LiveCD if your partition is also 64-bit. Or else, chrooting will fail midway. You can check your architecture with the command uname -m
.
Run sudo fdisk -l
and take note of the partition where your Ubuntu install is installed.
Create a directory in /mnt
for mounting the partition later on:
sudo mkdir /mnt/1
Assuming the file system of the partition is of the type ext4
, mount the partition at /mnt/1
.
sudo mount -t ext4 /dev/sda5 /mnt/1
If you entered a wrong filesystem type, you will get an error similar to this:
$ sudo mount -t ext3 /dev/sda5 /mnt/1
mount: wrong fs type, bad option, bad superblock on /dev/sda10,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
If you are not sure of the filesystem, mount the partition in your File manager and then run df -T
. Take note of the filesystem type and then unmount and mount it with the correct filesystem type:
sudo umount /dev/sda5
Now that you have correctly mounted it, chroot it to the previously created directory at /mnt
.
sudo chroot /mnt/1
If you get chroot: failed to run command /bin/bash no such file or directory
, try copying /bin
and /lib
to /mnt/1
and try chrooting again.
sudo cp -r /bin /lib /mnt/1
Now that you have chrooted into the system, try fixing the broken package through apt-get update && apt-get upgrade
. If there are any unresolved broken or unmet dependencies around, try to clean it up.
Hopefully, you now managed to resolve and remove any corrupt packages that might have previously stalled your boot process.
Any other extraordinary situations arising at this point of time demands its own question.