Why not only use mhwd-kernel to uninstall?

As per the manjaro wiki I should use pacman to remove kernels, but there is a -r option to remove kernels with mhwd-kernel.
Can someone explain why this is while you are instructed to use mhwd-kernel to install?

Is it because mhwd-kernel will not remove everything so I should clean up with pacman?

Edit
I just used mhwd-kernel to remove a kernel, and everything gets removed including nvidia drivers. I’m just curious why all those steps are there?

No, that example only shows you how to use pacman for removing headers, extramodules, or everything, all as possible options.

You are not actively being told to use pacman for removing kernels. As the matter of fact, the example for removing a kernel by way of mhwd-kernel -r is right there on the page, above the examples for using pacman.

The recommended way for uninstalling a kernel is mhwd-kernel -r.

2 Likes

I think the diference might be that mhwd-kernel will uninstall the kernel itself, whereas pacman might uninstall the kernel and all dependencies.

I could be wrong; I haven’t bothered to google for correctness, as many obviously do. :wink:

In fact, I’ve never really considered this point before, as I would simply use mhwd-kernel out of habit.

Edit: The comment from @Aragorn seems more elegant.

1 Like

Same. And I just checked, the page does specify and show removing kernels with mhwd-kernel. As @Aragorn mentioned, it’s only the headers and extramodules that mentions using pacman.

2 Likes

Not really, should probably be worded differently then:

Where multiple kernels are present on your system, pacman can be used to remove them in the terminal. It may be necessary to delete a total of three elements of the kernel in total to completely remove it:

The kernel itself
The kernel's headers
The kernel's extra modules

The line “It may be necessary to delete a total of three elements of the kernel in total to completely remove it” is what bothers me. There is no description on how to KNOW that.

I know I’m making a chicken out of a feather here, but if I get confused, so can others (although I should not take that for granted xD)

I tend to agree, on this point. Some clarity, and perhaps an example using pacman to remove extraneous cruft, where needed, might be in order.

Not sure if this will lead to anything, maybe I should make a post in suggestions, but I will mark an answer so the thread closes.

No, not just with R.
Something like -Rns will remove dependencies not required by anything else as well as save files.

Not sure, either. That’s up to you. :man_shrugging:

Where? Did you mean Feedback? It seems you may have missed that I moved your topic to Wiki :wink:

Yes, something like.

The point was, pacman vs. mhwd-kernel.

Well … theres other possibilities.
Rs, Rnu, etc.

No … the point was you postulated the reason for “R” was to remove dependencies as well when “R” alone rather explicitly means just the single package.

1 Like

Yes, I see how you would interpret it that way.

Corrected, irrespective of intended context.

And then there is the question of cache files… Unless you periodically clean the folder completely but rather use the rvk3 method, you will have leftovers from every kernel you ever uninstalled.
In this case, I only needed mhwd-kernel (I think, still unclear to me when I need to use pacman on top).

I ran sudo find /var/cache/pacman/pkg/ -type f -iname 'linux65*' and yepp, there they were.
sudo find /var/cache/pacman/pkg/ -type f -iname 'linux65*' -exec rm -v {} \;

Another thing not mentioned in the wiki.

Its mentioned in a few places.
Remove all but 2 latest caches of installed packages, then remove all uninstalled caches…

paccache -rvk2
paccache -rvuk0

Not to mention bigger hammers like …

sudo pacman -Scc

And remember … at least initially the idea of the manjaro wiki was to not just duplicate things on the Arch wiki. So for something like pacman … you will find the most verbose information there.

https://wiki.archlinux.org/title/Pacman#Cleaning_the_package_cache

(well … next to man pages)

Let me ask this question instead then:
Under what circumstances would I have to run mhwd-kernel AND pacman to uninstall?
The recommendation that I first marked as solution earlier stated to only use mhwd-kernel.

If you have extra packages aside from the kernel installed.
(though by and large I thought they will be gotten by dependencies checks)
At least one person here seemed to think it was needed to remove the headers.

(mhwd-kernel doesnt work when I’m running a non-manjaro kernel so I cant check right now)

I know, I typed to fast, its in your first repy so I edited it out.

More interested in feedback about the question.

I have never attempted to specifically install or remove kernel headers using mhwd-kernel; is that an option? I’ve only used pacman for that purpose.

The headers aren’t normally required unless one has a DKMS package installed. If MHWD detects headers are necessary / no longer necessary, it will install / remove them.

EDIT: Example below :point_down:

No, the idea was just that it took them with the kernel … and …

$ sudo mhwd-kernel -r linux61
checking dependencies...
:: base optionally requires linux: bare metal support
:: dkms optionally requires linux-headers: build modules against the Manjaro kernel

Packages (2) linux61-6.1.61-1  linux61-headers-6.1.61-1

Total Removed Size:  288.70 MiB

:: Do you want to remove these packages? [Y/n]