How do I resolve “The following packages have unmet dependencies”

15 views
Skip to first unread message

Keith Mills

unread,
Jul 31, 2019, 11:29:04 AM7/31/19
to Ansible Project
I am setting up a new Server (Debian 10). I need to install required packages (and some Perl Modules) with_items using default package manager (apt). When I run my playbook, I receive the following failure:

failed: [deb7ex6405] (item=libexpat1-dev) => {"ansible_loop_var": "item", "cache_update_time": 1559401245, "cache_updated": false, "changed": false, "item": "libexpat1-dev", "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--


force-confdef\" -o \"Dpkg::Options::=--force-confold\"     --simulate install 'libexpat1-dev'' failed: E: Unable to correct problems, you have held broken packages.\n"
, "rc": 100, "stderr": "E: Unable to correct problems, you have held


broken packages.\n"
, "stderr_lines": ["E: Unable to correct problems, you have held broken packages."], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nSome packages could not be


installed. This may mean that you have\nrequested an impossible situation or if you are using the unstable\ndistribution that some required packages have not yet been created\nor been moved out of Incoming.\nThe following information


may help to resolve the situation:\n\nThe following packages have unmet dependencies:\n libexpat1-dev : Depends: libexpat1 (= 2.1.0-1+deb7u2) but 2.1.0-1+deb7u4 is to be installed\n"
, "stdout_lines": ["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:", " libexpat1-dev : Depends: libexpat1 (=


2.1.0-1+deb7u2) but 2.1.0-1+deb7u4 is to be installed"
]}

Ansible Version:

ansible 2.8.0
config file
= /etc/ansible/ansible.cfg
configured
module search path = [u'/home/kjames/.ansible/plugins/modules',
 u
'/usr/share/ansible/plugins/modules']
 ansible python
module location = /usr/lib/python2.7/site-packages/ansible
 executable location
= /usr/bin/ansible
 python version
= 2.7.5 (default, Apr  9 2019, 14:30:50) [GCC 4.8.5 20150623
 
(Red Hat 4.8.5-36)]



Ansible Controller:

NAME="CentOS Linux"
VERSION
="7 (Core)"


Destination Server:

PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
NAME
="Debian GNU/Linux"
VERSION_ID
="7"


new-buildserver.yaml:

---
# Plan
# use a staging inventory file or specify individual hosts
# copy repos
# install packages
# copy configs for installed packages
# install cpan modules
# update all the things to appropriate levels
# install mxdk
#


- hosts: buildservers
  remote_user
: root
  roles
:
   
- buildservers


debian-8.yaml:

---
   
# 2018-07-02
   
# Vollmer


   
# Install required packages (and some perl modules) with_items using default package manager


   
- name: install required packages
     
package:
        name
: "{{ item }}"
        state
: present
      with_items
:
       
- alien
       
- apache2
       
- autofs
       
- bison
       
- createrepo
       
- dos2unix
       
- flex
#       - g++-multilib
       
- git
       
- html2text
       
- krb5-user
#       - libc6-dev-i386
#       - libevent-dev
       
- libmng1
#       - libxml++2.6-2v5
#       - libxml++2.6-dev
#       - libxml2-dev
       
- libxml++2.6-2
#       - libxml2-dev:i386
#       - lib64stdc++6:i386
       
- libxml2-utils
       
- lzma
       
- make
#       - smbfs
       
- nasm
       
- ntp
       
- pbuilder
       
- python-lxml
       
- rpm2cpio
       
- xsltproc
       
- zip
       
- libexpat1-dev
       
- libssl-dev
       
- zlib1g-dev
       
- cpanminus
#       - update
       
# The following never worked but were included in the original deployment scripts, kept here for reference
#       - lib64stdc++6:i386
#       - libxml2-dev:i386
#       - smbfs
       
# It appears that Debian uses all CPAN provided modules so we do not need to install any from the package manager
     
- name: install required perl modules
       
package:
          name
: "{{ item }}"
          state
: present
#         type: package
        with_items
:
         
- libanydata-perl
         
- libapache-asp-perl
         
- libcrypt-rc4-perl
         
- libdigest-sha-perl
         
- libhttp-dav-perl
         
- liblog-log4perl-perl
         
- libsoap-lite-perl
         
- libterm-shell-perl
         
- libxml-dom-perl
         
- libxml-libxml-perl
         
- libxml-sax-perl
         
- libxml-xpath-perl



ansible-playbook -i buildservers-agd new-buildserver.yaml --limit DEBIAN

I have tried `sudo apt-get install -f`.
-f, --fix-broken Fix; attempt to correct a system with broken dependencies in place.
This didn't work.

I have also tried:
sudo apt-get 
update sudo 
apt-get clean 
sudo apt-get autoremove

Expected results are to have the packages install successfully.




Kai Stian Olstad

unread,
Jul 31, 2019, 1:14:03 PM7/31/19
to ansible...@googlegroups.com
On 31.07.2019 17:29, Keith Mills wrote:
> I am setting up a new Server (Debian 10). I need to install required
> packages (and some Perl Modules) with_items using default package manager
> (apt). When I run my playbook, I receive the following failure:
>
> failed: [deb7ex6405] (item=libexpat1-dev) => {"ansible_loop_var": "item",
> "cache_update_time": 1559401245, "cache_updated": false, "changed": false,
> "item": "libexpat1-dev", "msg": "'/usr/bin/apt-get -y -o
> \"Dpkg::Options::=--
>
>
> force-confdef\" -o \"Dpkg::Options::=--force-confold\" --simulate
> install 'libexpat1-dev'' failed: E: Unable to correct problems, you have
> held broken packages.\n", "rc": 100, "stderr": "E: Unable to correct
> problems, you have held
>
>
> broken packages.\n", "stderr_lines": ["E: Unable to correct problems, you
> have held broken packages."], "stdout": "Reading package lists...\nBuilding
> dependency tree...\nReading state information...\nSome packages could not be

This error message has nothing to do with Ansible.
Suggest you seek support in a Debian community.


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages