# Chef Server and problem with YUM

**URL:** <https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774>\
**Category:** Chef Infra Server\
**Created:** [February 7, 2024, 3:14pm UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774 "2024-02-07T15:14:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slawek](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Slawek](https://discourse.chef.io/u/Slawek)\
**Post date:** [February 7, 2024, 3:14pm UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774/1 "2024-02-07T15:14:56Z")

</div>

Hi All,  
Possibly someone will be able to help. The thing is that when we run a cookbook that should install Java 8 as openJDK package it works fine on CentOS up to version CentOS 7.9. When we try to run it on Rocky Linux 9.3 (which uses DNF instead of YUM) it fails with the following error:

```auto
Running handlers:
[2024-02-07T10:23:50+00:00] ERROR: Running exception handlers
Running handlers complete
[2024-02-07T10:23:50+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 02 seconds
[2024-02-07T10:23:50+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2024-02-07T10:23:50+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2024-02-07T10:23:50+00:00] ERROR: package[java-1.8.0-openjdk] (java::openjdk line 54) had an error: NoMethodError: undefined method `version' for nil:NilClass
[2024-02-07T10:23:51+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

```

Does anyone can advise what the problem is and how to fix it?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![christo](https://avatars.discourse-cdn.com/v4/letter/c/ebca7d/32.png) [@christo](https://discourse.chef.io/u/christo)\
**Post date:** [February 7, 2024, 6:12pm UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774/2 "2024-02-07T18:12:12Z")

</div>

What happens when you manually install `dnf install java-1.8.0-openjdk` on that box?

The error looks like the package cannot be found (version is `nil`).

Best

Christopher

---

<div class="post-metadata">

**Author:** ![Slawek](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Slawek](https://discourse.chef.io/u/Slawek)\
**Post date:** [February 7, 2024, 8:22pm UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774/3 "2024-02-07T20:22:51Z")

</div>

Hi,  
That's weird, as when I try to install it manually it works, but not via Chef.  
When I run the same recipe on CentOS 7.9 it works fine - the same recipe. I think this might be caused by YUM that has a symlink to DNF. Maybe DNF misreads it?

Slawek

---

<div class="post-metadata">

**Author:** ![jimbray](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jimbray/32/2662_2.png) [@jimbray](https://discourse.chef.io/u/jimbray)\
**Post date:** [February 7, 2024, 8:45pm UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774/4 "2024-02-07T20:45:01Z")

</div>

Different commands for Yum and DNF

![~WRD0000.jpg](https://us1.discourse-cdn.com/flex016/uploads/chef/original/2X/5/52d5f1c08649212fe6768d2cacdcf8df711810d9.jpeg)

![image001.png](https://us1.discourse-cdn.com/flex016/uploads/chef/original/2X/f/f1f1ae92a3c18941c2fae4ccbe8f40a1a70b759b.png)

---

<div class="post-metadata">

**Author:** ![dano](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@dano](https://discourse.chef.io/u/dano)\
**Post date:** [February 7, 2024, 9:05pm UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774/5 "2024-02-07T21:05:10Z")

</div>

Why not use the package resource? Then it will do the right thing no matter the version.

---

<div class="post-metadata">

**Author:** ![jimbray](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jimbray/32/2662_2.png) [@jimbray](https://discourse.chef.io/u/jimbray)\
**Post date:** [February 7, 2024, 9:41pm UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774/6 "2024-02-07T21:41:52Z")

</div>

That is an excellent idea, in fact we do that on a lot of systems.

Just use the rpm commands directly

![~WRD0000.jpg](https://us1.discourse-cdn.com/flex016/uploads/chef/original/2X/5/52d5f1c08649212fe6768d2cacdcf8df711810d9.jpeg)

![image001.png](https://us1.discourse-cdn.com/flex016/uploads/chef/original/2X/f/f1f1ae92a3c18941c2fae4ccbe8f40a1a70b759b.png)

---

<div class="post-metadata">

**Author:** ![nkadel](https://avatars.discourse-cdn.com/v4/letter/n/5f9b8f/32.png) [@nkadel](https://discourse.chef.io/u/nkadel)\
**Post date:** [February 8, 2024, 2:13am UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774/7 "2024-02-08T02:13:12Z")

</div>

> > ![](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jimbray/45/2662_2.png "jimbray") | [jimbray](https://discourse.chef.io/u/jimbray)  
> > February 7 |
> > 
> > - | - |
> 
> That is an excellent idea, in fact we do that on a lot of systems.
> 
> Just use the rpm commands directly

RPM commands need to know where the file is, directly, for installation. It doesn't support handling the dependencies or multiple upstream repositories or conflicts directly.

The "yum", "dnf", and "package" modules for ansible, even if they all wind up using the "dnf" command on recent RHEL compatible Linux.

---

<div class="post-metadata">

**Author:** ![Slawek](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Slawek](https://discourse.chef.io/u/Slawek)\
**Post date:** [February 21, 2024, 8:07pm UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774/8 "2024-02-21T20:07:50Z")

</div>

Apologies for late response.  
RPM commands may help to install packages directly, however we have some libraries that have hardcoded yum commands which we can't avoid using as these are in a binary files. We can't do reverse engineering of course.

Any other ideas guys?

---

<div class="post-metadata">

**Author:** ![clarisafelicia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/clarisafelicia/32/4476_2.png) [@clarisafelicia](https://discourse.chef.io/u/clarisafelicia)\
**Post date:** [March 13, 2024, 4:45am UTC](https://discourse.chef.io/t/chef-server-and-problem-with-yum/22774/9 "2024-03-13T04:45:40Z")

</div>

I've also tried the same but it is not working.
