Linux Kernel - Manjaro breaking dependencies
Context
One day you find yourself running your Manjaro installation as usual, and you think of installing a new fancy package which will provide you with some new fancy tool or software. Usually, before installing any package you perform an upgrade of all system packages by running pacman -Syu
command. And then you find:
λ sudo pacman -Syu
:: Synchronizing package databases...
core is up to date
extra is up to date
community is up to date
multilib is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: installing nvidia-utils (510.73.05-1) breaks dependency 'nvidia-utils=510.68.02' required by linux516-nvidia
Congratulations! You are probably running a no longer supported Linux Kernel!
Folks over endoflife.date have a really nice site to check on different Kernels and packages releases and EOLs (End Of Life) so you can check and be ready to find your Kernel EOLed.
Of course, you can avoid all this nightmare by running an LTS Kernel (like Linux 5.10 at the time of writing this) but, if you are like me, you will be likely running the latest stable release; yeah, I’m not that hardcore to run unstable releases (I use this machine to do some work on it) and, for such case, I’d be running plain Arch Linux, which is rolling release and my favourite distribution!
Troubleshooting
Let’s first check what Kernels I do have currently installed in my system with the help of mhwd-kernel
utility (you can find more information about it in Manjaro Wiki):
λ sudo mhwd-kernel -li
Currently running: 5.16.20-2-MANJARO (linux516)
The following kernels are installed in your system:
* linux510
* linux516
Checking the endoflife.date and also having a look at Kernel.org, I can see the current stable release is 5.17.9, hence 5.16 is not supported anymore. We can also see the available Kernels that can be installed:
λ sudo mhwd-kernel -l
available kernels:
* linux414
* linux419
* linux49
* linux510
* linux515
* linux517
* linux518
* linux54
* linux515-rt
* linux517-rt
Using the same tool (mhwd-kernel
), I will now install the supported stable release according to Kernel.org site:
λ sudo mhwd-kernel -i linux517
:: Synchronizing package databases...
core 166,9 KiB 835 KiB/s 00:00 [#############################################################################] 100%
extra 1896,1 KiB 10,9 MiB/s 00:00 [#############################################################################] 100%
community 7,0 MiB 38,2 MiB/s 00:00 [#############################################################################] 100%
multilib 177,5 KiB 4,68 MiB/s 00:00 [#############################################################################] 100%
resolving dependencies...
looking for conflicting packages...
Packages (3) linux517-5.17.9-1 linux517-nvidia-510.73.05-1 linux517-virtualbox-host-modules-6.1.34-9
Total Download Size: 35,83 MiB
Total Installed Size: 159,14 MiB
:: Proceed with installation? [Y/n] Y
We can see that installing the Kernel also installs the required linux517-*
packages, including the one that is now outdated in the EOLed Kernel (linux516-nvidia
) and is preventing the system upgrade.
Once installation finishes, you can reboot the machine; listing the installed Kernels we can now see:
λ sudo mhwd-kernel -li
Currently running: 5.17.9-1-MANJARO (linux517)
The following kernels are installed in your system:
* linux510
* linux516
* linux517
I’ll now remove the EOLed Kernel by executing:
λ sudo mhwd-kernel -r linux516
checking dependencies...
Packages (3) linux516-5.15.41-1 linux516-nvidia-510.73.05-1 linux516-virtualbox-host-modules-6.1.34-9
Total Removed Size: 140,58 MiB
:: Do you want to remove these packages? [Y/n] Y
:: Running pre-transaction hooks...
(1/1) Removing linux initcpios...
:: Processing package changes...
(1/3) removing linux516-virtualbox-host-modules [#############################################################################] 100%
(2/3) removing linux516-nvidia [#############################################################################] 100%
(3/3) removing linux516 [#############################################################################] 100%
:: Running post-transaction hooks...
(1/4) Arming ConditionNeedsUpdate...
(2/4) Updating module dependencies...
(3/4) Updating Kernel initcpios for Nvidia-DRM...
(4/4) Updating Grub-Bootmenu
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.17-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-5.17-x86_64.img
Found initrd fallback image: /boot/initramfs-5.17-x86_64-fallback.img
Found linux image: /boot/vmlinuz-5.10-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-5.10-x86_64.img
Found initrd fallback image: /boot/initramfs-5.10-x86_64-fallback.img
Found memtest86+ image: /boot/memtest86+/memtest.bin
done
Aaaaand, it’s gone:
λ sudo mhwd-kernel -li
Currently running: 5.17.9-1-MANJARO (linux517)
The following kernels are installed in your system:
* linux510
* linux517
You should be able now to proceed with the system packages upgrade as usual leveraging pacman -Syu
command.
Recommendations
It’s considered a good practice to have a LTS Kernel installed, just in case things break; I have Linux 5.10 release as LTS fallback installed.
Imagine you screw things when you first see the message about the dependency breaking and you opt to remove the linux516-nvidia
package. Cool, system upgrade will work, but the next time you boot your machine you will find a nice black screen due to NVIDIA drivers now gone from your installation. Ok, you better search for your Manjaro installation media so you can chroot
and fix things… or not!
As you followed the general recommendation of having a LTS Kernel installed, you will be able to boot it from the Advanced options
in your boot loader; once booted, you can then install whatever Kernel you wish to run (a supported one), and then boot into it and work as usual.
Manjaro Kernel Management Summary
To list installed kernels in the machine:
mhwd-kernel -li
To list available Kernels for installation:
mhwd-kernel -l
To remove a Kernel
mhwd-kernel -r kernel-name
To add a Kernel, aka linux 418
mhwd-kernel -i kernel-name