# apt returns: No package matching... but apt-get install on managed host works

**URL:** <https://forum.ansible.com/t/apt-returns-no-package-matching-but-apt-get-install-on-managed-host-works/15001>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 11, 2014, 6:21pm UTC](https://forum.ansible.com/t/apt-returns-no-package-matching-but-apt-get-install-on-managed-host-works/15001 "2014-04-11T18:21:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sampsont](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sampsont](https://forum.ansible.com/u/sampsont)\
**Post date:** [April 11, 2014, 6:21pm UTC](https://forum.ansible.com/t/apt-returns-no-package-matching-but-apt-get-install-on-managed-host-works/15001/1 "2014-04-11T18:21:04Z")

</div>

I’m fairly new to Ansible. I really like it but can’t get past this show stopper. If anyone can offer any hints, I sure would appreciate it. The package I’m trying to install is my own. Something may be wrong with it but it installs fine with apt-get. Normal packages install OK.

Running **_apt-get_**  **_install_** from the shell works but running **_apt_** does not work. apt is like a black box. I can’t find any way to debug it. I can find messages in /var/log/auth.log. They all look good. syslog has:

> Apr 11 10:56:46 station1 ansible-apt: Invoked with dpkg\_options=force-confdef,force-confold upgrade=None force=False package=m9kpdc-static purge=False state=installed update\_cache=False pkg=m9kpdc-static default\_release=None install\_recommends=True cache\_valid\_time=None

Nothing gets written to /var/log/dpkg.log

**Versions:**  
ansible: 1.5.4  
All hosts: Ubuntu 12.04LTS

**Details**  
**Installing a package with apt fails:**

> dfr@master:~$ ansible station1 -m apt -a “pkg=m9kpdc-static state=installed”
> 
> station1 | FAILED \>\> {
> 
> “failed”: true,
> 
> “msg”: “ **No package matching ‘m9kpdc-static’ is available** ”
> 
> }

**Installing a package with apt-get works:**

> dfr@master:~$ ansible station1 -m shell -a “apt-get install m9kpdc-static” -K  
> sudo password:  
> station1 | success | rc=0 \>\>  
> Reading package lists…  
> Building dependency tree…  
> Reading state information…  
> The following NEW packages will be installed:  
> m9kpdc-static:i386  
> 0 upgraded, 1 newly installed, 0 to remove and 37 not upgraded.  
> Need to get 0 B/1068 kB of archives.  
> After this operation, 0 B of additional disk space will be used.  
> Selecting previously unselected package m9kpdc-static:i386.  
> (Reading database … 78241 files and directories currently installed.)  
> Unpacking m9kpdc-static:i386 (from …/m9kpdc-static\_2.2\_i386.deb) …  
> Processing triggers for ureadahead …  
> Setting up m9kpdc-static:i386 (2.2) …  
> Post-install starting m9kpdc

**Package is available:**

---

<div class="post-metadata">

**Author:** ![adam2](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@adam2](https://forum.ansible.com/u/adam2)\
**Post date:** [April 11, 2014, 8:37pm UTC](https://forum.ansible.com/t/apt-returns-no-package-matching-but-apt-get-install-on-managed-host-works/15001/2 "2014-04-11T20:37:25Z")

</div>

Multi-arch? Aka, this is a 64-bit machine, but that package is only available on i386, and the idempotent ansible apt module isn't capable of dealing with that?

---

<div class="post-metadata">

**Author:** ![sampsont](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@sampsont](https://forum.ansible.com/u/sampsont)\
**Post date:** [April 11, 2014, 9:36pm UTC](https://forum.ansible.com/t/apt-returns-no-package-matching-but-apt-get-install-on-managed-host-works/15001/3 "2014-04-11T21:36:35Z")

</div>

Thanks Adam!  
Wow. That was a big help. I forced apt to get the i386 version by setting pkg=m9kpdc-static:i386 and now it works.  
Thanks for taking the time to help!

Todd

---

<div class="post-metadata">

**Author:** ![adam2](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@adam2](https://forum.ansible.com/u/adam2)\
**Post date:** [April 11, 2014, 9:45pm UTC](https://forum.ansible.com/t/apt-returns-no-package-matching-but-apt-get-install-on-managed-host-works/15001/4 "2014-04-11T21:45:55Z")

</div>

It'd be nice if ansible could be smarter here, I'm certain they would take a patch. I am not a member of the project, just another user.
