How to switch arch linux to lts kernel?

I’m running a headless server installation of arch linux. The high rate of kernel upgrades caused me some maintainance headache and I therefore wish to switch to the lts kernel.

I already installed the linux-lts and linux-lts-headers packages. Now, I got both kernels installed but I’m a bit clueless how to continue from here. The docs explain:

[…] you will need to update your bootloader’s configuration file to use the LTS kernel and ram disk: vmlinuz-linux-lts and initramfs-linux-lts.img.

I already located them in the boot section:

0 ✓ <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bcced3d3c8fcd4d3cfc8">[email protected]</a> ~ $ ll /boot/
total 85M
4,0K drwxr-xr-x  4 root root 4,0K 21. Mai 13:46 ./
4,0K drwxr-xr-x 17 root root 4,0K  4. Apr 15:08 ../
4,0K drwxr-xr-x  6 root root 4,0K  4. Apr 14:50 grub/
 27M -rw-r--r--  1 root root  27M 20. Mai 17:01 initramfs-linux-fallback.img
 12M -rw-r--r--  1 root root  12M 20. Mai 17:01 initramfs-linux.img
 27M -rw-r--r--  1 root root  27M 21. Mai 13:46 initramfs-linux-lts-fallback.img
 12M -rw-r--r--  1 root root  12M 21. Mai 13:46 initramfs-linux-lts.img
 16K drwx------  2 root root  16K  4. Apr 14:47 lost+found/
4,3M -rw-r--r--  1 root root 4,3M 11. Mai 22:23 vmlinuz-linux
4,2M -rw-r--r--  1 root root 4,2M 19. Mai 21:05 vmlinuz-linux-lts

Now, I already found entries pointing to the non-lts kernel in the grub.cfg but the header tells me not to edit this file. It points me to the utility grub-mkconfig instead but I can not figure out how to use this tool to tell grub which kernel and ramdisk to use.

How to switch archlinux with grub to the lts kernel? What else do I have to be cautious about when switching the kernel?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Okay, after joe pointed me the right direction in comments, this is how I did it:

  1. basicly just install pacman -S linux-lts
  2. (optional) check if kernel, ramdisk and fallback are available in ls -lsha /boot
  3. remove the standard kernel pacman -R linux
  4. update the grub config grub-mkconfig -o /boot/grub/grub.cfg
  5. reboot

Note, for syslinux you’ll need to edit the syslinux config file in /boot/syslinux/syslinux.cfg accordingly, just point everything to the -lts kernel.

Method 2

The answer from Afri works well for GRUB, but I’m using UEFI directly, which is more lightweight and makes full use of the UEFI motherboard.

  1. Install linux-lts
  2. (optional) Check if LTS version of kernel, ramdisk and fallback are available in /boot folder.
  3. Generate the EFI entry, the same way as you generated the regular Linux one, but replacing ramdisk and loader with the LTS ones. For example:
    efibootmgr --disk /dev/sdX --part Y --create --label "Arch Linux LTS" --loader /vmlinuz-linux-lts --unicode 'root=PARTUUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX rw initrd=initramfs-linux-lts.img' --verbose

    Note the --loader value and initrd value. These files should be in the /boot folder.

  4. Reboot. You may want to adjust the boot order in motherboad before booting into the operating system, for example by pressing F12 (depending on your motherboard). I actually use Hyper-V, which allows boot order configuration in “Hyper-V Manager”.
  5. (optional) After successfully booting into the LTS kernel (verify it with uname -r), remove the standard kernel with pacman -R linux.

Method 3

  1. Install linux-lts (or any other kernel):
    pacman -S linux-lts
  2. Update your boot loader entry:
    $ sudo vim /boot/loader/entries/arch.conf

    and change:

    linux   /vmlinuz-linux
    initrd  /initramfs-linux.img
    ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
    linux   /vmlinuz-linux-lts
    initrd  /initramfs-linux-lts.img
  3. Reboot and confirm with uname -r

Method 4

Like Franklin Yu, I’m also on a system without GRUB. I needed to switch to a different kernel and haven’t used efibootmgr before. I asked a more knowledgeable friend about this and he suggested the tool rEFInd, which automates the steps that Franklin suggested and presents you with a nice menu at boot time of which kernels you have available. The installation was totally straightforward and I was able to switch kernel versions easily.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x