# Unknown Error occurred: Could not run transaction

**URL:** <https://forum.ansible.com/t/unknown-error-occurred-could-not-run-transaction/39764>\
**Category:** Get Help\
**Tags:** ansible, aws, linux\
**Created:** [January 22, 2025, 12:03pm UTC](https://forum.ansible.com/t/unknown-error-occurred-could-not-run-transaction/39764 "2025-01-22T12:03:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmcculla](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@kmcculla](https://forum.ansible.com/u/kmcculla)\
**Post date:** [January 22, 2025, 12:03pm UTC](https://forum.ansible.com/t/unknown-error-occurred-could-not-run-transaction/39764/1 "2025-01-22T12:03:31Z")

</div>

**Workstation** :  
Packer v1.11.2  
ansible [core 2.16.3]  
config file = /etc/ansible/ansible.cfg  
configured module search path = [‘/home/citadel/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python3.12/site-packages/ansible  
ansible collection location = /home/citadel/.ansible/collections:/usr/share/ansible/collections  
executable location = /bin/ansible  
python version = 3.12.8 (main, Dec 12 2024, 16:30:29) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] (/usr/bin/python3.12)  
jinja version = 3.1.2  
libyaml = True

**Instance being built** :  
“discovered\_interpreter\_python”: “/usr/bin/python3.9”,  
“distribution\_file\_variety”: “Amazon”,  
“distribution\_major\_version”: “2023”,

SELinux status: enabled  
SELinuxfs mount: /sys/fs/selinux  
SELinux root directory: /etc/selinux  
Loaded policy name: targeted  
Current mode: enforcing  
Mode from config file: enforcing  
Policy MLS status: enabled  
Policy deny\_unknown status: allowed  
Memory protection checking: actual (secure)  
Max kernel policy version: 33

Via packer command line, running the following within a playbook to remove codedeploy from the instance:

- name: Uninstall CodeDeploy  
ansible.builtin.dnf:  
name: codedeploy-agent  
state: absent

Getting the following error…

```
bastion.amazon-ebs.bastion: The full traceback is:
bastion.amazon-ebs.bastion: File "/tmp/ansible_ansible.legacy.dnf_payload_amirom_7/ansible_ansi 

```

ble.legacy.dnf\_payload.zip/ansible/modules/dnf.py", line 1364, in ensure  
bastion.amazon-ebs.bastion: File “/usr/lib/python3.9/site-packages/dnf/base.py”, line 1034, in do\_transaction  
bastion.amazon-ebs.bastion: tid = self.\_run\_transaction(cb=cb)  
bastion.amazon-ebs.bastion: File “/usr/lib/python3.9/site-packages/dnf/base.py”, line 1153, in \_run\_transaction  
bastion.amazon-ebs.bastion: raise dnf.exceptions.Error(msg)  
bastion.amazon-ebs.bastion: fatal: [default]: FAILED! =\> {  
bastion.amazon-ebs.bastion: “changed”: false,  
bastion.amazon-ebs.bastion: “failures”: ,  
bastion.amazon-ebs.bastion: “invocation”: {  
bastion.amazon-ebs.bastion: “module\_args”: {  
bastion.amazon-ebs.bastion: “allow\_downgrade”: false,  
bastion.amazon-ebs.bastion: “allowerasing”: false,  
bastion.amazon-ebs.bastion: “autoremove”: false,  
bastion.amazon-ebs.bastion: “bugfix”: false,  
bastion.amazon-ebs.bastion: “cacheonly”: false,  
bastion.amazon-ebs.bastion: “conf\_file”: null,  
bastion.amazon-ebs.bastion: “disable\_excludes”: null,  
bastion.amazon-ebs.bastion: “disable\_gpg\_check”: false,  
bastion.amazon-ebs.bastion: “disable\_plugin”: ,  
bastion.amazon-ebs.bastion: “disablerepo”: ,  
bastion.amazon-ebs.bastion: “download\_dir”: null,  
bastion.amazon-ebs.bastion: “download\_only”: false,  
bastion.amazon-ebs.bastion: “enable\_plugin”: ,  
bastion.amazon-ebs.bastion: “enablerepo”: ,  
bastion.amazon-ebs.bastion: “exclude”: ,  
bastion.amazon-ebs.bastion: “install\_repoquery”: true,  
bastion.amazon-ebs.bastion: “install\_weak\_deps”: true,  
bastion.amazon-ebs.bastion: “installroot”: “/”,  
bastion.amazon-ebs.bastion: “list”: null,  
bastion.amazon-ebs.bastion: “lock\_timeout”: 30,  
bastion.amazon-ebs.bastion: “name”: [  
bastion.amazon-ebs.bastion: “codedeploy-agent”  
bastion.amazon-ebs.bastion: ],  
bastion.amazon-ebs.bastion: “nobest”: false,  
bastion.amazon-ebs.bastion: “releasever”: null,  
bastion.amazon-ebs.bastion: “security”: false,  
bastion.amazon-ebs.bastion: “skip\_broken”: false,  
bastion.amazon-ebs.bastion: “sslverify”: true,  
bastion.amazon-ebs.bastion: “state”: “absent”,  
bastion.amazon-ebs.bastion: “update\_cache”: false,  
bastion.amazon-ebs.bastion: “update\_only”: false,  
bastion.amazon-ebs.bastion: “use\_backend”: “auto”,  
bastion.amazon-ebs.bastion: “validate\_certs”: true  
bastion.amazon-ebs.bastion: }  
bastion.amazon-ebs.bastion: },  
bastion.amazon-ebs.bastion: “msg”: “Unknown Error occurred: Could not run transaction.”,  
bastion.amazon-ebs.bastion: “rc”: 1,  
bastion.amazon-ebs.bastion: “results”:   
bastion.amazon-ebs.bastion: }  
bastion.amazon-ebs.bastion:  
bastion.amazon-ebs.bastion: PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
bastion.amazon-ebs.bastion: default : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

Any suggestions on how to resolve this issue?
