How To Control the Kernel in Manjaro [SOLVED]

Alexzee

Well-Known Member
Credits
4,287
By default Manjaro uses the cutting edge kernel that is installed and running at the top of the list.
Screenshot from 2020-10-15 18-03-45.png

I don't want to use kernel 5.8, instead I have installed kernel 5.4.67-1 which is the LTS kernel.
To change that I booted into the Advanced options for Manjaro and choose kernel 5.4.67 and than removed kernel 5.8. using the Manjaro Setting MGR. Upon boot up today it's using kernel 5.8 again.

I'm reading this and it explains how to remove a kernel and it's headers but doesn't explain how to stop the system from using the most current kernel.

How do I stop Manjaro from consistently using the cutting edge kernel?
 
Last edited:


KGIII

Active Member
Credits
1,389
I haven't used Manjaro since it was Mandriva, a long time ago.

If I wanted to use a different kernel, I'd install it and then set the kernel as the default kernal in GRUB.

Here are some hints:
 

Alexzee

Well-Known Member
Credits
4,287
This desktop pc is a triple booted rig so I don't feel comfortable with editing the grub file and making a mess of my linux box.

Does anyone know, is there a native way through Manjaro to fix this issue?
 

KGIII

Active Member
Credits
1,389
I can sympathize with your reluctance, and wish you the best of luck.

If nobody offers you another way, there's 'grub-customizer' and it's likely packaged for Manjaro. If so, it's a nice GUI way to make adjustments. With that, you can quite literally select the default kernel with a drop-down menu or move it to the top and the top-most listing is the default.
 

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
I tried it out on a virtual machine and it worked for me.
Code:
sudo pacman -S linux-lts
Then boot and when booting select advanced options and then select the lts kernel from the list to boot from . Then when booted into the lts kernel:
Code:
sudo pacman -Rsn linux58
It should automatically update your grub and then next time you boot it should be the lts kernel you boot into.
 

Alexzee

Well-Known Member
Credits
4,287
I tried it out on a virtual machine and it worked for me.
Code:
sudo pacman -S linux-lts
Then boot and when booting select advanced options and then select the lts kernel from the list to boot from . Then when booted into the lts kernel:
Code:
sudo pacman -Rsn linux58
It should automatically update your grub and then next time you boot it should be the lts kernel you boot into.
Can I expect the same results on Manjaro installed to my HDD?
 

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
Yes because installing and removing kernels works no different on a virtual machine than it does on a physical machine.
 

Alexzee

Well-Known Member
Credits
4,287
Yes because installing and removing kernels works no different on a virtual machine than it does on a physical machine.
Ok, I'll let you know how it goes later.
 

Alexzee

Well-Known Member
Credits
4,287
I followed your instructions and this is the output:



[[email protected] ~]$ sudo pacman -Rsn linux58
[sudo] password for sifu:
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: removing linux58 breaks dependency 'linux58' required by linux-latest

A fresh reboot and I was still booted into kernel 5.8.11.
 

Alexzee

Well-Known Member
Credits
4,287
Can you link the article where you got the instructions please?
 

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
Just remove the dependency it's complaining about then, try this:
Code:
sudo pacman -R linux-latest linux58
 
Last edited:

wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
6,153
Just a tip I should have placed earlier (& yes, I know, Alex, I can sound like a cracked record :D )

Do be sure you have a current Timeshift snapshot before modifying kernel matters.

Chris
 

Alexzee

Well-Known Member
Credits
4,287
Just remove the dependency it's complaining about then, try this:
Code:
sudo pacman -R linux-latest linux58
This looks like a redundant cycle that going to repeat itself.

Just got an update today for kernel 5.8.16-2 along with other pkg' that needed to be updated.
I didn't want 5.8.11 either:-

Having said that it looks like I will have to continue to keep removing the newer/experimental kernels with each new update.

Is there a way to fix this permanently?
 
Last edited:

Alexzee

Well-Known Member
Credits
4,287
Just a tip I should have placed earlier (& yes, I know, Alex, I can sound like a cracked record :D )

Do be sure you have a current Timeshift snapshot before modifying kernel matters.

Chris
Thanks Chris!-;)
 

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
This looks like a redundant cycle that going to repeat itself.

Just got an update today for kernel 5.8.16-2 along with other pkg' that needed to be updated.
I didn't want 5.8.11 either:-

Having said that it looks like I will have to continue to keep removing the newer/experimental kernels with each new update.

What do you think?
I don't think so because it works on my test system. I think you have something seriously weird going on.
[[email protected] ~]$ uname -r
5.4.67-1-MANJARO
[[email protected] ~]$ 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...

Packages (13) firefox-81.0.2-1 linux-firmware-20201005.r1732.58d41d0-1 linux54-5.4.72-1 manjaro-release-20.1.2-1 matcha-gtk-theme-20200928-1 mhwd-db-0.6.5-4 mhwd-nvidia-450xx-450.80.02-1 mhwd-nvidia-455xx-455.28-2 pamac-cli-9.5.12-1
pamac-common-9.5.12-1 pamac-flatpak-plugin-9.5.12-1 pamac-gtk-9.5.12-1 pamac-snap-plugin-9.5.12-1

==> Warning:
-> Kernel has been updated. Modules of the current kernel
-> have been backed up so you can continue to use your
-> computer. However, the new kernel will only work
-> at next boot.

(11/12) Updating the desktop file MIME type cache...
(12/12) Updating the MIME type database...
[[email protected] ~]$ sudo reboot
Connection to 192.168.122.244 closed by remote host.
[[email protected] ~]$ uname -r
5.4.72-1-MANJARO
Can you show the output of
Code:
pacman -Qqe |grep ^linux
 
Last edited:

Alexzee

Well-Known Member
Credits
4,287
I don't think so because it works on my test system. I think you have something seriously weird going on.

Can you show the output of
Code:
pacman -Qqe |grep ^linux
Is your test system a VM?

-systemproductname ~]$ pacman -Qqe |grep ^linux
linux-latest

Here's more information:
ls /boot/
amd-ucode.img linux57-x86_64.kver
grub linux58-x86_64.kver
initramfs-5.7-x86_64-fallback.img memtest86+
initramfs-5.7-x86_64.img vmlinuz-5.7-x86_64
initramfs-5.8-x86_64-fallback.img vmlinuz-5.8-x86_64
initramfs-5.8-x86_64.img

It looks like the newest kernel is incorporated alongside the updates.
So, if you want the updates that come along with the kernel you have to accept the latest kernel that is tied to it than remove the latest that you don't want.

I think if this can't be fixed permanently I'll just allow the latest kernel to continue to be installed along with the updates and leave the system run as is.
 

f33dm3bits

Gold Member
Gold Supporter
Credits
6,156
Yes my test system is a vm but that doesn't make a difference. I run Arch on a physical system and it works there too, since Manjaro is Arch based it shouldn't be any different.

It isn't because I did what I advised you to do and I had installed updates and the latest kernel wasn't reinstalled. So latest seems to be the package providing the latest kernels, so you need to first install linux-lts and then remove linux-latest.
Code:
sudo pacman -S linux-lts
sudo pacman -R linux-latest
sudo reboot
 

Alexzee

Well-Known Member
Credits
4,287
Here's what worked for me:




[[email protected] ~]$ sudo pacman -R linux58 linux58-headers linux58-extramodules
[sudo] password for sifu:
error: target not found: linux58-headers
error: target not found: linux58-extramodules
[[email protected] ~]$ sudo pacman -R linux58 linux58-headers
error: target not found: linux58-headers
[[email protected] ~]$ sudo pacman -R linux58
checking dependencies...

Packages (1) linux58-5.8.11-1

Total Removed Size: 149.25 MiB

:: Do you want to remove these packages? [Y/n] Y
:: Running pre-transaction hooks...
(1/1) Removing linux initcpios...
:: Processing package changes...
(1/1) removing linux58 [######################] 100%
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating module dependencies...
(3/3) Updating Grub-Bootmenu
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-5.4-x86_64.img
Found initrd fallback image: /boot/initramfs-5.4-x86_64-fallback.img
Found Debian GNU/Linux 9 (stretch) on /dev/sda1
Found LMDE 4 Debbie (4) on /dev/sdb1
Found memtest86+ image: /boot/memtest86+/memtest.bin
done

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:


  1. The kernel itself
  2. The kernel's headers
  3. The kernel's extra modules

Whether or not the headers and extra modules must be deleted depends on whether or not they have been installed.


1. To remove a kernel use the following syntax:

sudo mhwd-kernel -r linux[version]



Here is an example for removing kernel 5.0.17-1

sudo mhwd-kernel -r linux50



2. To delete a kernel's headers, the syntax is:

sudo pacman -R linux[version]-headers



For example, to delete the headers of kernel version 5.0.x from the system, the following command would be entered:

sudo pacman -R linux50-headers



3. To delete a kernel's extra modules, the syntax is:

sudo pacman -R linux[version]-extramodules



For example, to delete the extra modules of kernel version 5.0.x from the system, the following command would be entered:

sudo pacman -R linux50-extramodules



4. To delete all elements of a kernel at the same time - where they are all present on your system - the syntax is:

sudo pacman -R linux[version] linux[version]-headers linux[version]-extramodules



For example, to completely remove all elements of kernel version 5.0.x, the following command would be entered:

sudo pacman -R linux50 linux50-headers linux50-extramodules


When I rebooted I was booted into kernel 5.4!-:)
 

Alexzee

Well-Known Member
Credits
4,287
Need a cold beer after that!

Cheers,
Alex
 

wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
6,153
Grab another beer ;)

Some might find the following TL;DR

Although this Thread may be marked Solved, for Alex’s future reference, and for the benefit of The Viewers, I will show you another method for inhibiting the upgrade of kernels and Arch and Arch-based Distros including Manjaro.

I’ll provide one of my Manjaroes, a Cinnamon (community-based) version, as an example.

I have arrived on my Desktop and a short while later been notified that I have 11 updates available to be installed.

I enter Pamac, a GUI-based front-end to the Pacman package manager, and this is a part of what I see.



We can see from here that there are included two (2) kernels to upgrade, a 4.19 and a 5.4.

The ticks (checkmarks) at right indicate these packages will be installed/upgraded.

uname -r

tells me I am using

5.4.67-1-MANJARO

and Manjaro Settings Manager – Kernel

shows the following



which indicates that both the 4.19 and 5.4 kernels are LTS (Long-Term Support). 4.19 not shown here.

These packages can also be seen to be integral, from my Grub Menu, Advanced Options



If I decided that I did not want to upgrade those, I could uncheck those by clicking on the green upgrade box, but that would only work for now, and sooner or later (rebooting or other) they would appear again as a reminder.

A more permanent solution involves accessing and modifying

/etc/pacman.conf

cat /etc/pacman.conf

reveals what is seen in the Spoiler

[[email protected] ~]$ cat /etc/pacman.conf
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives

#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc manjaro-system
# If upgrades are available for these packages they will be asked for first
SyncFirst = manjaro-system archlinux-keyring manjaro-keyring
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =

#NoUpgrade =
#NoExtract =

# Misc options
#UseSyslog
#Color
#TotalDownload
CheckSpace
#VerbosePkgLists

# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required

# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Manjaro Linux
# packagers with `pacman-key --populate archlinux manjaro`.

#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#

[core]
Include = /etc/pacman.d/mirrorlist

[extra]
Include = /etc/pacman.d/mirrorlist

[community]
Include = /etc/pacman.d/mirrorlist

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

[multilib]
Include = /etc/pacman.d/mirrorlist

# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

The area I am going to focus on features the following


# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =

By uncommenting one line, and adding one or more packages to it, I can get them placed on hold from updates.

If Pamac is still open, close it first.

So I could make that section look as follows


# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
# @20201020 line below changed to withhold kernel updates
IgnorePkg = linux4* linux5*
#IgnoreGroup =

Note that I insert a comment for my benefit or that of another to see what I have modded and why.

Save the file, reboot if you like, but there is no real need, as the changes are effected in real time. Launch Pamac again, and you will now find those packages unchecked for now and for the future until or unless you remove the restriction.

I could have made the ignore line just read

IgnorePkg = linux*

and the same withholding of kernel upgrades would be in effect, but that would also remove the check mark from Linux firmware, as you can see.



Users who multiboot, or who surf Distros may be pleased to know the same functionality is available across Families:

apt-mark hold <packagename> for Debian and -based

For Redhat/Fedora &c – use the “exclude” option in dnf.conf

For SLES/openSUSE - Put package name in /etc/zypp/locks, or zypper al

Gentoo and -based - /etc/portage/package.mask

Cheers

Wizard
 


Members online


Top