I am trying to install gcc (in order to install postGIS later), but i have the folowing problem (you can see in the picture). Can anyone help?
1 Answers
You can get a list of actually held packages with:
dpkg --get-selections | grep hold
If there are none, or none look related, then it's probably something else. You can also try using the aptitude
rather than apt-get
to install your package:
sudo aptitude install <packagename>
Aptitude will try and find solutions which involve modifying other packages. It will also give you a detailed explanation of the problem and options for fixing it.
If you try Aptitude with -f
, it will change its priorities and then you will obtain only those solutions which require removing/downgrading fewer packages. Here's the command:
sudo aptitude -f install <packagename>
Note: Assuming dpkg --get-selections | grep hold
is empty, Aptitude is your best solution to resolve held packages.
Source URL: Unable to correct problems, you have held broken packages

- 1,030
-
Thanks! I installed Aptitude and then i did sudo aptitude install
. Aptitude helped me to find solutions – Laura A. Agalioti Mar 16 '19 at 13:12 -
apt-cache policy gcc gcc-7
– doug Mar 16 '19 at 12:10gcc-7 7.3.0-12
looks more like a Debian package than an Ubuntu one - have you added any non-Ubuntu repositories to your apt sources? – steeldriver Mar 16 '19 at 12:10sudo apt update
before install, to update the package repository. – Soren A Mar 16 '19 at 12:14Reading state information... Done 3 packages can be upgraded. Run 'apt list --upgradable' to see them. – Laura A. Agalioti Mar 16 '19 at 12:16
sudo apt upgrade
to install those packages. And lastly, runsudo apt install gcc
again. – Soren A Mar 16 '19 at 12:27Reading state information... Done Calculating upgrade... Done The following packages were automatically installed and are no longer required: linux-headers-4.15.0-36 linux-headers-4.15.0-36-generic linux-image-4.15.0-36-generic linux-modules-4.15.0-36-generic linux-modules-extra-4.15.0-36-generic Use 'sudo apt autoremove' to remove them. The following packages have been kept back: curl libcurl4 libcurl4-openssl-dev 0 to upgrade, 0 to newly install, 0 to remove and 3 not to upgrade. – Laura A. Agalioti Mar 16 '19 at 12:29
sudo apt full-upgrade
– Soren A Mar 16 '19 at 12:34