Thursday 19 April 2018

ubuntu - Continue on error when apt-get encounters an install unable to locate package issue


When I run the following:


sudo apt-get install vim abcde php5-cli

It fails with the following message which is the expected behavior:



E: Unable to locate package abcde`.



I want it to install vim and even if there is an error on abcde just continue to install php5-cli package. Meaning I want apt-get to continue down the list, even if it can not find some of the packages.


I've tried:


sudo apt-get install --ignore-missing vim abcde php5-cli

Answer



Short answer: It is possible that you actually do not want to do this.


Why is that? There has been a lot of discussion on this particular functionality. One such is in this (duplicate)bug report and the one it is linked to.


Discussion at the bug report also explains that "--ignore-missing" only applies if the there is an issue downloading a package that should otherwise exist by the information your ´apt-get´ has. This is also explained here and in the documentation.


Is there a workaround?


If after reading the previous sources you are still very sure you want to do this then, on the other hand, there are (suboptimal but rather safe) options like the one specified by user "Aleksandr Levchuk" here:


for i in package1 package2 package3; do
sudo apt-get install $i
done

Or if you prefer then a one-liner with minimal modification:


for i in package1 package2 package3; do sudo apt-get install $i; done

If there're a lot of packages, you can add -y so it won't ask for confirmation repeatedly:


for i in package1 package2 package3; do
sudo apt-get install -y $i
done

Or:


for i in package1 package2 package3; do sudo apt-get install -y $i; done

Hope this helps.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...