JoseL
JoseL

Reputation: 21

Ubuntu, Cannot install zlib1g-dev

I'm trying to install nodejs in Ubuntu, after checking all the missing dependencies I encounter an issue when installing zlib1g-dev, zlib1g is already at 1:1.2.8.dfsg-2ubuntu4.1 :

[pp@src]$ sudo apt-get install zlib1g-dev

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:
 zlib1g-dev : **Depends: zlib1g (= 1:1.2.8.dfsg-2ubuntu4) but 1:1.2.8.dfsg-2ubuntu4.1 is to be installed**
E: Unable to correct problems, you have held broken packages.


[pp@src]$ sudo apt-get install zlib1g

Reading package lists... Done
Building dependency tree       
Reading state information... Done
**zlib1g is already the newest version (1:1.2.8.dfsg-2ubuntu4.1)**.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Upvotes: 0

Views: 9067

Answers (3)

user3893474
user3893474

Reputation: 101

Answer for this is given by SeinopSys in Error installing zlib1g-dev you need to take note of the required package version (in your case = = 1:1.2.8.dfsg-2ubuntu4), then run the command below to downgrade to that version:

$ sudo apt install zlib1g== 1:1.2.8.dfsg-2ubuntu4

Then you can try re-installing.

Upvotes: 0

Peter Barrett Bryan
Peter Barrett Bryan

Reputation: 675

I would try a sudo apt-get update to start (sometimes the problem is trivial!). Consider including the results of dpkg --get-selections | grep hold in the comments.

Autoremove might help, too!

Finally, trying again with aptitude (https://unix.stackexchange.com/questions/767/what-is-the-real-difference-between-apt-get-and-aptitude-how-about-wajig) might highlight the issue.

Tough to diagnose without more information.

Upvotes: 0

JoseL
JoseL

Reputation: 21

I was able to do the installation with:

sudo apt-get update && sudo sudo apt-get install zlib1g-dev

After updating /etc/apt/sources.list with the following:

#------------------------------------------------------------------------------#
#                            OFFICIAL UBUNTU REPOS                             #
#------------------------------------------------------------------------------#


###### Ubuntu Main Repos
deb http:// us.archive .ubuntu. com/ubuntu/ xenial main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial main restricted universe multiverse 

###### Ubuntu Update Repos
deb http:// us.archive .ubuntu. com/ubuntu/ xenial-security main restricted universe multiverse 
deb http://us.archive .ubuntu. com/ubuntu/ xenial-updates main restricted universe multiverse 
deb http:// us.archive .ubuntu. com/ubuntu/ xenial-proposed main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-security main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-updates main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-proposed main restricted universe multiverse 

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner

Upvotes: 1

Related Questions