# Dnf upgrade from 9.0 to 9.1 failed

**URL:** <https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269>\
**Category:** Rocky Linux Help & Support\
**Created:** [December 15, 2022, 12:17pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269 "2022-12-15T12:17:20Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerry666uk](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gerry666uk](https://forums.rockylinux.org/u/gerry666uk)\
**Post date:** [December 15, 2022, 12:17pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/1 "2022-12-15T12:17:20Z")

</div>

Before dnf upgrade

```auto
5.14.0-70.17.1.el9_0.x86_64

```

During dnf upgrade

```auto
2022-12-15T11:54:14+0000 INFO dracut: Can't write to /boot/efi/70135c696ca547939f1864d32e1cbf74/5.14.0-162.6.1.el9_1.0.1.x86_64: Directory /boot/efi/70135c696ca547939f1864d32e1cbf74/5.14.0-162.6.1.el9_1.0.1.x86_64 does not exist or is not accessible.

```

After dnf upgrade:  
The new kernel for 9.1 has been installed, but is missing from the grub menu, so it currently boots into the previous kernel from 9.0.  
It looks like all packages for 9.1 have been installed, but I can’t boot into the new kernel…

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [December 15, 2022, 1:14pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/2 "2022-12-15T13:14:40Z")

</div>

> [@gerry666uk](#):
>
> `/boot/efi/70135c696ca547939f1864d32e1cbf74`

Why did dracut try to write such non-existing location?

The EFI System Partition (ESP) – a VFAT filesystem – is mounted to `/boot/efi`.  
I have never seen anything but directory `EFI` in `/boot/efi/`.

The dracut was probably called in ‘postinstall’ script of some kernel\* package.  
The rest of the script might have been skipped due to what dracut returns.  
That could explain the lack of boot entry.

A trivial thing is to remove&install (or `reinstall`) the 5.14.0-162\* kernel packages.  
That would (re)create boot entry, if successful.

However, if the dracut issue persists, then you have to diagnose&fix it first.

---

<div class="post-metadata">

**Author:** ![gerry666uk](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gerry666uk](https://forums.rockylinux.org/u/gerry666uk)\
**Post date:** [December 15, 2022, 7:56pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/3 "2022-12-15T19:56:59Z")

</div>

The location (it was trying to write to) didn’t look right to me either, but at the top of ‘man dracut’, it implies that this _could_ be a valid location, based on the boot loader you are using, but all my previous initramfs files were directly under ‘/boot’, so I don’t know.

Removing all the 9.1 kernel packages and then running ‘dnf upgrade’ again, seems to have fixed everything, but I don’t know what the original problem was.

Under ‘/boot’ I now have:

```auto
config-5.14.0-162.6.1.el9_1.0.1.x86_64
initramfs-5.14.0-162.6.1.el9_1.0.1.x86_64.img
initramfs-5.14.0-162.6.1.el9_1.0.1.x86_64kdump.img
symvers-5.14.0-162.6.1.el9_1.0.1.x86_64.gz
System.map-5.14.0-162.6.1.el9_1.0.1.x86_64
vmlinuz-5.14.0-162.6.1.el9_1.0.1.x86_64

```

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [December 15, 2022, 8:29pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/4 "2022-12-15T20:29:51Z")

</div>

Two points related to bootloader (GRUB) config and hence its menu:

- The default is to use BLS (Boot Loader Specification). That is, each menu entry is a separate file in directory `/boot/loader/entries/` – not in the `grub.cfg`. (One can disable BLS to get back to the “all in one file” config.)
- In el9 – UEFI system – the EFI loads GRUB binary from `/boot/efi/EFI/${vendor}/` and `grub.cfg` from same location. The difference to el8 is that that `grub.cfg` is really short and essentially has one statement:  
`include /boot/grub2/grub.cfg`  
The “real grub.cfg” is thus the `/boot/grub2/grub.cfg`, just like in legacy systems. Should you have a need to run `grub2-mkconfig`, remember to direct the config to `/boot/grub2/grub.cfg`

---

<div class="post-metadata">

**Author:** ![gerry666uk](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gerry666uk](https://forums.rockylinux.org/u/gerry666uk)\
**Post date:** [December 15, 2022, 9:42pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/5 "2022-12-15T21:42:20Z")

</div>

In my case, I can see that ‘/boot/grub2/grub.cfg’ has not been changed since August, but ‘/boot/grub2/grubenv’ has been updated today, when I ran dnf upgrade. I don’t know if it updates grub before or after creating initramfs, but I gess it should leave grub until last.

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [December 15, 2022, 10:34pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/6 "2022-12-15T22:34:15Z")

</div>

How about files in `/boot/loader/entries/` ?

---

<div class="post-metadata">

**Author:** ![gerry666uk](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gerry666uk](https://forums.rockylinux.org/u/gerry666uk)\
**Post date:** [December 15, 2022, 11:08pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/7 "2022-12-15T23:08:37Z")

</div>

Boot loader entries:

```auto
ls /boot/loader/entries/
70135c696ca547939f1864d32e1cbf74-0-rescue.conf
70135c696ca547939f1864d32e1cbf74-5.14.0-162.6.1.el9_1.0.1.x86_64.conf
70135c696ca547939f1864d32e1cbf74-5.14.0-70.13.1.el9_0.x86_64.conf
70135c696ca547939f1864d32e1cbf74-5.14.0-70.17.1.el9_0.x86_64.conf

```

At the time of the original post, the 9.1 entry was not there, I can see it was added today after running dnf upgrade.

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [December 15, 2022, 11:33pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/8 "2022-12-15T23:33:16Z")

</div>

Those are your menu entries.

> [@Can install 9.0 but not 9.1 from USB drive](https://forums.rockylinux.org/t/can-install-9-0-but-not-9-1-from-usb-drive/8197/26):
>
> what caused the upgrade of the kernel to fail, nor why it was fixed by re-installing the failed kernel.

Just to be absolutely sure, I have on Ansible “update” play two steps:

1. update everything, except kernel&co
2. update everything

That way all the packages (except kernel modules) that could go to initramfs or are otherwise involved in installation of kernel are definitely already updated when the new kernel is installed on step two.

Not sure whether that has any real effect or benefit other than the false sense of being in control.

---

<div class="post-metadata">

**Author:** ![gerry666uk](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gerry666uk](https://forums.rockylinux.org/u/gerry666uk)\
**Post date:** [December 16, 2022, 11:15am UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/9 "2022-12-16T11:15:59Z")

</div>

Of all the different %post scripts, and in all the different kernel packages, do you know which one actually invokes dracut to create the ‘/boot’ initramfs files?

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [December 16, 2022, 12:33pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/10 "2022-12-16T12:33:38Z")

</div>

One can check:

```auto
$ rpm -qa kernel\* | while read P ; do echo "### $P ###" ; rpm -q --scripts ${P} | grep -m1 dracut ; done
### kernel-srpm-macros-1.0-11.el9.noarch ###
### kernel-core-5.14.0-70.26.1.el9_0.x86_64 ###
### kernel-modules-5.14.0-70.26.1.el9_0.x86_64 ###
### kernel-5.14.0-70.26.1.el9_0.x86_64 ###
### kernel-devel-5.14.0-70.26.1.el9_0.x86_64 ###
### kernel-core-5.14.0-70.30.1.el9_0.x86_64 ###
### kernel-modules-5.14.0-70.30.1.el9_0.x86_64 ###
### kernel-5.14.0-70.30.1.el9_0.x86_64 ###
### kernel-devel-5.14.0-70.30.1.el9_0.x86_64 ###
### kernel-core-5.14.0-162.6.1.el9_1.x86_64 ###
### kernel-modules-5.14.0-162.6.1.el9_1.x86_64 ###
	touch /var/lib/rpm-state/kernel/need_to_run_dracut_5.14.0-162.6.1.el9_1.x86_64
### kernel-tools-libs-5.14.0-162.6.1.el9_1.x86_64 ###
### kernel-tools-5.14.0-162.6.1.el9_1.x86_64 ###
### kernel-5.14.0-162.6.1.el9_1.x86_64 ###
### kernel-headers-5.14.0-162.6.1.el9_1.x86_64 ###
### kernel-devel-5.14.0-162.6.1.el9_1.x86_64 ###
### kernel-devel-matched-5.14.0-162.6.1.el9_1.x86_64 ###

```

Fascinating, only scripts of kernel-modules of el9\_1 appear to contain word “dracut”; the el9\_0 package did not. That is thus _new feature_.

However, I’d guess that the `/bin/kernel-install` called by ‘kernel-core’ might be involved.

---

<div class="post-metadata">

**Author:** ![cpappy](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@cpappy](https://forums.rockylinux.org/u/cpappy)\
**Post date:** [December 16, 2022, 2:53pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/11 "2022-12-16T14:53:36Z")

</div>

> [@jlehtone](#):
>
> update everything, except kernel&co

Is “1. update everything, except kernel&co” equivalent to

```auto
# yum update --exclude=kernel*

```

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [December 16, 2022, 3:00pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/12 "2022-12-16T15:00:13Z")

</div>

There are couple packages so tightly coupled to the kernel that they have to be in the list too:

```plaintext
dnf up --exclude=vdo,kmod-kvdo,kernel*

```

or as I have it as Ansible tasks:

```yaml
  - name: Update all, except kernel
    ansible.builtin.dnf:
      name: '*'
      state: latest
      exclude: 'vdo,kmod-kvdo,kernel*'

  - name: Update all, including kernel
    ansible.builtin.dnf:
      name: '*'
      state: latest

```

---

<div class="post-metadata">

**Author:** ![cpappy](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@cpappy](https://forums.rockylinux.org/u/cpappy)\
**Post date:** [December 16, 2022, 3:07pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/13 "2022-12-16T15:07:23Z")

</div>

No reboot between steps 1. and 2. Correct?

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [December 16, 2022, 3:17pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/14 "2022-12-16T15:17:05Z")

</div>

Yes.

Now that you do mention, upgrade of some libraries, e.g. `glibc` would warrant a reboot, but I’m not _that_ paranoid. See [Identify packages that will require a system reboot after an update - Red Hat Customer Portal](https://access.redhat.com/solutions/27943)

As for the reboot _later_:

```yaml
  - name: We will use 'needs-restarting'
    ansible.builtin.dnf:
      name: 'yum-utils'
      state: present

  - name: Check need for reboot
    check_mode: false
    changed_when: false
    shell: "needs-restarting -r > /dev/null && echo false || echo true"
    register: needs_reboot

  - debug:
      msg: "A reboot is required"
    when: "'true' in needs_reboot.stdout"

  - name: Gather the package facts
    ansible.builtin.package_facts:
    tags:
    - reboot

  - block:
    - name: Get running VMs
      check_mode: false
      changed_when: false
      command: virsh list --name
      register: virsh_list

    - block:
      - name: List running guests
        debug:
          var: virsh_list.stdout_lines
        when:
        - virsh_list.stdout_lines|length > 0

      - name: Reboot VM host that has no guests
        ansible.builtin.reboot:
        when:
        - "'true' in needs_reboot.stdout"
        - virsh_list.stdout_lines|length == 0

      when:
      - virsh_list.stdout_lines is defined
    when:
    - "'libvirt-client' in ansible_facts.packages"
    tags:
    - reboot

  - name: Reboot non-host
    ansible.builtin.reboot:
    when:
    - "'libvirt-client' not in ansible_facts.packages"
    - "'true' in needs_reboot.stdout"
    tags:
    - reboot

```

(But that could be better still.)

---

<div class="post-metadata">

**Author:** ![cpappy](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@cpappy](https://forums.rockylinux.org/u/cpappy)\
**Post date:** [December 16, 2022, 3:23pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/15 "2022-12-16T15:23:27Z")

</div>

Awesome! I think you just convinced me to start using Ansible.

---

<div class="post-metadata">

**Author:** ![gerry666uk](https://avatars.discourse-cdn.com/v4/letter/g/dbc845/32.png) [@gerry666uk](https://forums.rockylinux.org/u/gerry666uk)\
**Post date:** [December 16, 2022, 7:48pm UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/16 "2022-12-16T19:48:20Z")

</div>

> [@jlehtone](#):
>
> Fascinating, only scripts of kernel-modules of el9\_1 appear to contain word “dracut”; the el9\_0 package did not. That is thus _new feature_.

Maybe it only tries to use ‘dracut’ when things go wrong (as a fallback). There must be some “normal” way that it has been creating initramfs entries for years, before this change. I did notice there was a long pause when it was running ‘kmod-kvdo’, and perhaps it ended up in a half-finished state, but I did run ‘dnf check’ and it said everything was ok.

---

<div class="post-metadata">

**Author:** ![brian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/brian/32/5777_2.png) [@brian](https://forums.rockylinux.org/u/brian)\
**Post date:** [August 25, 2023, 3:30am UTC](https://forums.rockylinux.org/t/dnf-upgrade-from-9-0-to-9-1-failed/8269/17 "2023-08-25T03:30:53Z")

</div>

Closed on August 25, 2023, 3:30am UTC


