0

im using ubuntu 14.04 and last time i have problems of upgrading the system. i was searching for a solution and found this one: sudo apt-get -y purge

i was using it and in the end it says that i cannot delete any old kernels because it depends on linux-image-3.13.0-93-generic. So, i understood i have to install that linux-image-3.13.0-93-generic. But the problem is that i dont have enough space for that. It's quite stupid because i have almost 500GB left on computer and still i cant use them for system memory? its quite absord that i have a lot of memory on my computer and im stuck because of a low memory of this system and because all kernels are depends one another so i cant even delete them

anyone can help me?

thanks.

1 Answers1

0

This answer is copied from this article.

As you can see in the error message, some packages have unmet dependencies. That means there are some mixing in third-party dependencies. APT package manager is easy to use for installing, removing etc but while mixing with third-party dependencies, apt-get sometimes gives this kind of error that you're getting.

Please follow the steps:

Take a backup of configuration files like:

/etc/apt/sources.list

Now remove the corrupt package database first:

sudo apt-get clean

or

sudo apt-get autoclean

Now please run this:

sudo apt-get -f install

This is most basic command to fix dependencies issues.

Now run:

sudo dpkg --configure -a

then,

sudo apt-get -f install

See the output, if its like this: 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.then it means it failed.

Now run this:

sudo apt-get -u dist-upgrade

If it shows any held packages then you have to eliminate it by this command:

sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade

Again see the output. If it's like this:

0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

That means it failed again.

Now you have to delete the held packages one by one by running dist-upgrade each time. Use --dry-run and be aware of each incidents.

sudo apt-get remove --dry-run package-name

If not any luck then you have to find and remove the dependencies by yourself.

Disable PPA's:

Open Software Center > Edit > Software Sources and click on Other Software. You will see that each PPA have two lines, one for the compiled packages and one for the source, Uncheck both lines to disable a PPA.

Purge:

It means downgrading the packages in the selected PPA to the version in the official Ubuntu repositories and disabling that PPA. Run this command:

sudo apt-get install ppa-purge

If the above fails then run this:

mkdir ppa-purge && cd ppa-purge && wget http://mirror.pnl.gov/ubuntu/pool/universe/p/ppa-purge/ppa-purge_0.2.8+bzr56_all.deb && wget http://mirror.pnl.gov/ubuntu//pool/main/a/aptitude/aptitude_0.6.6-1ubuntu1_i386.deb && sudo dpkg -i ./*.deb

Use PPA Purge:

sudo ppa-purge ppa:someppa/ppa

Remove:

Run the commands:

sudo apt-get autoremove --purge package-name
sudo add-apt-repository --remove ppa:someppa/ppa
sudo apt-get autoclean

After that try again.

Read the original article and your concept will be much more clear.

Another method:

Show all installed packages with "linux-" and contains a number.(edit as your requirement):

dpkg -l linux-* | awk '/^ii/{ print $2 }' | grep -e [0-9]

Now specify the name of packages that you want to purge:

sudo apt-get -y purge  linux-headers-3.13.0-24  linux-headers-3.13.0-24-generic  linux-headers-3.13.0-29  linux-headers-3.13.0-29-generic  linux-image-3.13.0-24-generic  linux-image-3.13.0-29-generic  linux-image-extra-3.13.0-24-generic  linux-image-extra-3.13.0-29-generic

Alternative command:

dpkg -l 'linux-*' | sed  '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]*  [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

This is the advanced command, which removes all kernel except the latest one.