23

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 ✓ root@host ~ $ 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?

  • 1
    this is the simplest invocation. the tool should autolocate your existing kernels (plus extra bits like ramdisk, microcode etc) and automatically add them. this gives a nice overview of how you can configure the resulting grub.cfg file. – Joe May 21 '16 at 12:10
  • also, you can add entries to files in /etc/grub.d - see here – Joe May 21 '16 at 12:20
  • Run grub-mkconfig, check that you see a stanza for linux-lts in grub.cfg, and reboot. – fpmurphy May 21 '16 at 12:55
23

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.

  • 1
    Note that one may need to replace any kernel modules with their lts equivalent as well. e.g. if acpi_call was previously installed, it's probably best to also install acpi_call-lts, otherwise the module won't load. – Ponkadoodle Apr 9 '17 at 22:03
  • 4
    FWIW you can skip step 3 and have both kernels installed at once. For me, lts was selected by default after rebooting, but I could also go into grub's advanced options and select the standard kernel instead. – Sparhawk May 22 '17 at 5:36
  • Mine got stuck at boot of initramfs and I had to manually run sudo mkinitcpio -p linux-lts. – leetNightshade Jul 23 '18 at 2:08
  • and how do I switch back? – Benj May 2 at 5:20
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.