# Remove latest kernel

**URL:** <https://forums.rockylinux.org/t/remove-latest-kernel/10731>\
**Category:** Rocky Linux Help & Support\
**Created:** [July 17, 2023, 10:42pm UTC](https://forums.rockylinux.org/t/remove-latest-kernel/10731 "2023-07-17T22:42:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![matNgrl](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matNgrl](https://forums.rockylinux.org/u/matNgrl)\
**Post date:** [July 17, 2023, 10:42pm UTC](https://forums.rockylinux.org/t/remove-latest-kernel/10731/1 "2023-07-17T22:42:59Z")

</div>

Hi everyone,

I am looking for uninstall my latest kernel update who doesn’t work at all.  
Is there any solution for that ?

Thanks for you time

Best Regards

---

<div class="post-metadata">

**Author:** ![Sherif](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/sherif/32/42_2.png) [@Sherif](https://forums.rockylinux.org/u/Sherif)\
**Post date:** [July 17, 2023, 11:41pm UTC](https://forums.rockylinux.org/t/remove-latest-kernel/10731/2 "2023-07-17T23:41:51Z")

</div>

Pick and older kernel from grub, then dnf remove the kernel you don’t want

---

<div class="post-metadata">

**Author:** ![matNgrl](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matNgrl](https://forums.rockylinux.org/u/matNgrl)\
**Post date:** [July 18, 2023, 5:43am UTC](https://forums.rockylinux.org/t/remove-latest-kernel/10731/3 "2023-07-18T05:43:17Z")

</div>

Thanks for your reply,  
Can you explain me deeply.

I am a new linux user.  
So you what you mean os to modify the entries boot/loader/entries ?

---

<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:** [July 18, 2023, 7:40am UTC](https://forums.rockylinux.org/t/remove-latest-kernel/10731/4 "2023-07-18T07:40:14Z")

</div>

```bash
# Show installed kernel packages
dnf list installed kernel\*

# Show version of currently running kernel
uname -r

```

You will see that there are many packages. Some of them you do have multiple versions. To see just those:

```bash
dnf repoquery --installed --installonly

```

Just the latest installed version:

```bash
dnf repoquery --installed --installonly --latest=1

```

* * *

If the latest “does not work”, then surely you have selected an older from version from bootloader’s menu in order to boot?  
Therefore, the `uname -r` should show different version than the latest.

You can take the list of packages from a command and ask dnf to remove them:

```bash
sudo dnf remove $(dnf repoquery --installed --installonly --latest=1)

```

That would uninstall the latest kernel (and also remove it from the bootloader’s menu).

Some packages, like `kernel-headers` remain, but that is ok – no need to downgrade.

* * *

More important question is: _Why the latest kernel does not work?_  
You want to solve that, because not being able to update kernel does block security updates.

---

<div class="post-metadata">

**Author:** ![matNgrl](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matNgrl](https://forums.rockylinux.org/u/matNgrl)\
**Post date:** [July 21, 2023, 6:36pm UTC](https://forums.rockylinux.org/t/remove-latest-kernel/10731/5 "2023-07-21T18:36:12Z")

</div>

Sorry for my late reply,

When I start to launch 9.2, I have a amdGpu securedisplay error.  
If I start on 9.1, my current kernel is the 9.1 but I loose my nvidia driver.

`Error: Unable to find a match: kernel-headers-5.14.0-162.6.1.el9_1.x86_64 kernel-devel-5.14.0-162.6.1.el9_1.x86_64"`

Naively I was thinking about going back to my previous version and it would fixed everything.

I also seen a thread to resolve the amdGpu error as well, maybe it’s the best solution, I don’t know

Best Regards

---

<div class="post-metadata">

**Author:** ![wintpe](https://avatars.discourse-cdn.com/v4/letter/w/e47774/32.png) [@wintpe](https://forums.rockylinux.org/u/wintpe)\
**Post date:** [July 22, 2023, 9:28am UTC](https://forums.rockylinux.org/t/remove-latest-kernel/10731/6 "2023-07-22T09:28:37Z")

</div>

## if you run dnf history it will give you a list of update events for example dnf history ID | Command line | Date and time | Action(s) | Altered

```
45 | update | 2023-07-02 13:21 | C, E, I, U | 65 EE
44 | install iperf | 2023-07-01 10:10 | Install | 1   
43 | update -y | 2023-05-20 09:52 | C, E, I, U | 300 EE
42 | update | 2023-04-06 10:00 | C, E, I, U | 50 EE
41 | update -y | 2023-03-17 09:58 | I, U | 17   
40 | update -y | 2023-02-26 10:39 | C, E, I, U | 79 EE
39 | remove MariaDB-server | 2023-02-26 10:37 | Removed | 3   
38 | update -y | 2023-02-06 10:09 | C, E, I, U | 99   
37 | update -y | 2023-01-13 12:45 | C, E, I, U | 334 EE

```

you can use dnf history rollback 38 to rollback the changes that the update did.

then you can reboot and review what caused your problems.

but make sure you have booted from the previous kernel first otherwise it wont be able to remove the current one if it was updated since that transaction took place

sorry cant quite get how to alter fonts in discord… apologies for the big text

regards peter

---

<div class="post-metadata">

**Author:** ![rindi](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@rindi](https://forums.rockylinux.org/u/rindi)\
**Post date:** [July 23, 2023, 1:52pm UTC](https://forums.rockylinux.org/t/remove-latest-kernel/10731/7 "2023-07-23T13:52:19Z")

</div>

I’m not sure what an Amd GPU & an nVidia GPU driver have to do on the same system. What do you actually have? Normally you either have one or the other. They normally don’t really work well together.

You can also, in the boot menu of GRUB, select previous versions of the kernel to boot into, You don’t have to remove the new kernel for that.

You can edit the file /etc/default/grub and change the "GRUB\_DEFAULT=“0"” to the one you want to start with. Then run sudo update-grub. Now your OS should boot to the kernel you selected, without having to remove your newest version.

---

<div class="post-metadata">

**Author:** ![matNgrl](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@matNgrl](https://forums.rockylinux.org/u/matNgrl)\
**Post date:** [July 23, 2023, 3:28pm UTC](https://forums.rockylinux.org/t/remove-latest-kernel/10731/8 "2023-07-23T15:28:44Z")

</div>

I already setuo my grub default to the correct kernel, but it’s not working well, having the error can not find kernel header blablabla.

My decision is to stop using rocky unfortunatly.

Thanks any way for your time.

Best regards
