3

When I try to install python-dev, libxml2-dev, libxslt-dev for Python2 on my Ubuntu 14.04, I get the following error:

E: Unable to correct problems, you have held broken packages
E: Unable to correct problems, you have held broken packages
E: Unable to correct problems, you have held broken packages
Reading package lists...
Building dependency tre...
Reading state information...
Some packaghes 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 nor been moved out of Incoming. 
The following information may help to resolve the situation:
The following packages have unmet dependecies:
python-dev : Depends: libpython-dev (= 2.7.5-5ubuntu3) but it is not going to be installed
Depends: python2.7-dev (>= 2.7.5-1~) but it is not going to be installed

What exactly to I need to do in order to fix this? The error is not very clear...

3
  • iasptk.com/ubuntu-fix-broken-package-best-solution Try the things suggested here Commented Oct 19, 2019 at 10:04
  • The error is here: "E: Unable to correct problems, you have held broken packages". It looks like you placed a hold on some packages and they cannot be upgraded as a result. If you still need to hold the package, you might be able to work around this by installing the correct version of libpython-dev and python2.7-dev using something like sudo apt-get install package==version. Otherwise, the answer is to release the hold on the packages that affected packages that are being held. Commented Oct 19, 2019 at 10:09
  • You might need to enable the -updates and -security repos as mentioned here. Honestly, it's a poor error coming from apt if that's the case. :-( Commented Oct 23, 2019 at 0:19

1 Answer 1

1

You may just need to repair the unstable state. Reboot and try...

sudo apt-get update --fix-missing

and

sudo dpkg --configure -a

and

sudo apt-get install -f

If the problem of a broken package still exists, the solution is to edit the dpkg status file manually.

$ sudo nano /var/lib/dpkg/status #(you can use vim or gedit instead of nano)

Locate the corrupt package, and remove the whole block of information about it and save the file.

# Unlock the dpkg – (message /var/lib/dpkg/lock)
sudo fuser -vki /var/lib/dpkg/lock
sudo dpkg --configure -a

From this link.

Sign up to request clarification or add additional context in comments.

4 Comments

While this link may answer the question, you should include the actual relevant details inside of your answer, in case the link breaks at any point.
The flags are not quite right--some websites turn -- into hypen (). It should be --fix-missing and --configure.
I should say that I don't believe this helps the OP either. Packages are being held (they're pinned) to a specific version, and that is the underlying source of the issue.
@John Szakmeister I would say post that as an additional answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.