Unable to install build-essential, held broken packages
Solution 1
After struggling for a while, I found the solution to this problem.
First sudo apt-get install aptitude
, which works fine. Then try sudo aptitude install build-essential
, which first says that there is something wrong and proposes a solution. The first solution it proposes keeps nothing change, which is not what we want, so choose no
. And it proposes the second solution, which would work.
By the way, I am still confused as why would I "held broken packages" on a newly installed ubuntu system? What does it mean to "held broken packages"?
Solution 2
For some reason, you have build-essential:i386
(the 32
bits version) installed, and your system, like you said, it's 64
bits (i.e., amd64
).
First, remove build-essential:i386
:
sudo apt-get remove build-essential:i386
Then install the 64 version:
sudo apt-get install build-essential
Related videos on Youtube
Andy Ge
Updated on September 18, 2022Comments
-
Andy Ge over 1 year
So I was trying to set up my computer for development. I installed ubuntu 14.04 LTS. I wanted to write a hello-world-program. However I can not compile it. After some searching, I tried
sudo apt-get install build-essential
, which complained:>sudo apt-get install build-essential Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: build-essential : Depends: g++ (>= 4:4.4.3) but it is not going to be installed Depends: dpkg-dev (>= 1.13.5) but it is not going to be installed E: Unable to correct problems, you have held broken packages.
I tried changing the source and
sudo apt-get update
,sudo apt-get upgrade
, and the issue remained. I triedsudo apt-get autoclean
,sudo apt-get install --fix-broken
or something like that, non of which worked.Also, I tried
sudo aptitude why-not build-essential
, which said:>sudo aptitude why-not build-essential p gvfs-bin:i386 Provides gvfs-bin p gvfs-bin:i386 Suggests gvfs:i386 p gvfs:i386 Suggests gvfs-backends:i386 p gvfs-backends:i386 Depends libgphoto2-port10:i386 (>= 2.5.2) p libgphoto2-port10:i386 Suggests gphoto2:i386 (> 2.1.0) p gphoto2:i386 Suggests gthumb:i386 p gthumb:i386 Recommends flex:i386 p flex:i386 Suggests build-essential:i386 p build-essential:i386 Conflicts build-essential
So what is wrong here?
Also my
sources.list
file:>cat /etc/apt/sources.list # deb cdrom:[Ubuntu 14.04.4 LTS _Trusty Tahr_ - Release amd64 (20160217.1)]/ trusty main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://mirrors.163.com/ubuntu/ trusty main restricted deb-src http://mirrors.163.com/ubuntu/ trusty main restricted ## Major bug fix updates produced after the final release of the ## distribution. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://mirrors.163.com/ubuntu/ trusty universe deb-src http://mirrors.163.com/ubuntu/ trusty universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://mirrors.163.com/ubuntu/ trusty multiverse deb-src http://mirrors.163.com/ubuntu/ trusty multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. deb http://archive.canonical.com/ubuntu trusty partner # deb-src http://archive.canonical.com/ubuntu trusty partner ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. deb http://extras.ubuntu.com/ubuntu trusty main deb-src http://extras.ubuntu.com/ubuntu trusty main
my
sources.list.d
directory:>ls -la /etc/apt/sources.list.d total 8 drwxr-xr-x 2 root root 4096 4月 10 2014 . drwxr-xr-x 6 root root 4096 4月 14 14:16 ..
By the way, could anyone give a brief explanation about what is a broken package and why it appears so easily? Or what is the possible reason/why this is happening? Shouldn't apt-get be able to fix such issues or at least give some helpful information here? I've met this error so many times recently and couldn't find any solution.
Thanks a lot.
-
Andy Ge about 8 yearsMy system is running on 64-bit. I installed Ubuntu from the official site and I don't know why there are 32-bit programs. What should I do if I want to install the 64-bit one?(and possibly uninstall the 32-bit one)
-
emk2203 about 8 yearsSorry, disregard this. I use
apt depends build-essential
, and it's different fromaptitude
. If I runaptitude depends
, I also get i386 shown.apt depends build-essential
shows only the 64-bit dependencies. What doaptitude why-not g++
andaptitude why-not dpkg-dev
show?
-
-
Alper91 over 7 yearsI had the same problem, I applied each suggestion on all forums and all of them were useless. I did your way and vaula! Thanks man.
-
Wolfish about 7 yearsFacing exactly the same issue as OP, with the same version numbers and why-not results.
sudo apt-get remove build-essential:i386
fails because the system appears not to know that it's installed in the first place