Nginx unmet dependencies over Vagrant / Puppet

Roman Newaza asked:

I have no such issue on 64bit Ubuntu Precise, but once I tried to start 32bit machine, it failed on this command:

# /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install nginx=1.6.0-1+precise0
Reading package lists...
Building dependency tree...
Reading state information...
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:
 nginx : Depends: nginx-full (>= 1.6.0-1+precise0) but it is not going to be installed or
                  nginx-light (>= 1.6.0-1+precise0) but it is not going to be installed or
                  nginx-extras (>= 1.6.0-1+precise0) but it is not going to be installed or
                  nginx-naxsi (>= 1.6.0-1+precise0) but it is not going to be installed
         Depends: nginx-full (< 1.6.0-1+precise0.1~) but it is not going to be installed or
                  nginx-light (< 1.6.0-1+precise0.1~) but it is not going to be installed or
                  nginx-extras (< 1.6.0-1+precise0.1~) but it is not going to be installed or
                  nginx-naxsi (< 1.6.0-1+precise0.1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I can see 1.6.0-1+precise0 present on the instance:

# apt-cache show nginx
Package: nginx
Version: 1.6.0-1+precise0
Architecture: all
Maintainer: Kartik Mistry <kartik@debian.org>
Installed-Size: 45
Depends: nginx-full (>= 1.6.0-1+precise0) | nginx-light (>= 1.6.0-1+precise0) | nginx-extras (>= 1.6.0-1+precise0) | nginx-naxsi (>= 1.6.0-1+precise0), nginx-full (<< 1.6.0-1+precise0.1~) | nginx-light (<< 1.6.0-1+precise0.1~) | nginx-extras (<< 1.6.0-1+precise0.1~) | nginx-naxsi (<< 1.6.0-1+precise0.1~)
Filename: ./nginx/nginx_1.6.0-1+precise0_all.deb
Size: 22514
MD5sum: 510911ed565fba855485f4d25bfd5af6
SHA1: ca3f54a5bb48dd9d806c9c2d92e87ae8b9b96358
SHA256: 1c604932660e160bdc52c0d4fc565263c8ca6ef6ddf130ff29ad08a314c75a88
Section: httpd
Priority: optional
Homepage: http://nginx.net
Description: small, powerful, scalable web/proxy server
 Nginx ("engine X") is a high-performance web and reverse proxy server
 created by Igor Sysoev. It can be used both as a standalone web server
 and as a proxy to reduce the load on back-end HTTP or mail servers.
 .
 This is a dependency package to install either nginx-full (by default) or
 nginx-light.

Puppet module:

class nginx::install {

  # Required by nginx image_filter module
  package { ['libgd2-xpm','libgd2-xpm-dev']:
    ensure => 'latest',
  }

  package { 'init-system-helpers':
    ensure => '1.7~precise1~ppa1',
  }

  package { 'nginx':
    ensure => '1.6.0-1+precise0',
    require => Package['libgd2-xpm','libgd2-xpm-dev','init-system-helpers'],
  }

  package { 'nginx-common':
    ensure => '1.6.0-1+precise0',
    require => Package['libgd2-xpm','libgd2-xpm-dev','init-system-helpers','nginx'],
  }

  package { 'nginx-full':
    ensure => '1.6.0-1+precise0',
    require => Package['libgd2-xpm','libgd2-xpm-dev','init-system-helpers','nginx-common'],
  }

}

Installing it manually, leads to the same error:

apt-get install nginx
...
The following packages have unmet dependencies:
 nginx : Depends: nginx-full (>= 1.6.0-1+precise0) but it is not going to be installed or
                  nginx-light (>= 1.6.0-1+precise0) but it is not going to be installed or
                  nginx-extras (>= 1.6.0-1+precise0) but it is not going to be installed or
                  nginx-naxsi (>= 1.6.0-1+precise0) but it is not going to be installed
         Depends: nginx-full (< 1.6.0-1+precise0.1~) but it is not going to be installed or
                  nginx-light (< 1.6.0-1+precise0.1~) but it is not going to be installed or
                  nginx-extras (< 1.6.0-1+precise0.1~) but it is not going to be installed or
                  nginx-naxsi (< 1.6.0-1+precise0.1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

How to fix it?

My answer:


You have your dependencies backward.

The nginx package requires one of those four named packages to be installed, so you should ensure that one of them (e.g. nginx-full) is installed first. Since it could be any of the four, no choice is made for you automatically.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.