Can I get a warning about EOL of a kernel?

Thanks, I didn’t pay attention and will upgrade to 5.14 too. (Just like I didn’t pay attention to the Qtile thing above there… man and that happens, even when I try to read these things and stay updated.)

Maybe a warning or a note from Pamac that the current Kernel is EOL would be good.

I just meant the information that is available at every post with the posts here anyway. It would be a good idea to include this in Pamac. Just a suggestion, nothing more.

Our current supported kernels
linux44 4.4.284
linux49 4.9.283
linux414 4.14.247
linux419 4.19.207
linux54 5.4.148
linux510 5.10.68
linux512 5.12.19 [EOL]
linux513 5.13.19 [EOL]
linux514 5.14.7
linux515 5.15-rc2
linux510-rt 5.10.52_rt47

But I see what you are saying. So my solution would be to write a script for automated check of EOL status. I just learned how to scrape websites in commandline. Execute the script each time I am updating should be enough I guess.

1 Like

script written yesterday - use hook pacman

is not for EOL but same logic
Last paragraph tests if an installed kernel no longer exists (after EOL)
First, scrape websites

for eol, i have also a python script : test if kernel is not in testing or unstable. use branch-compare as data (so is not an manjaro announcement !)

url = "https://manjaro.org/branch-compare/packages.x86_64.json"

response = urllib.request.urlopen(url)
data = json.loads(response.read())['packages']
# pkg only in stable/testing and in "core" repo
data = [p for p in data if (p[1]['testing'] == "n/a" or p[1]['unstable'] == "n/a") and p[1]['repository'] == "core"]
eofs = set([p[0].split('#')[0] for p in data])  # want only names
print('EOL kernels:', eofs)
2 Likes

I’ve marked this answer as the solution to your question as it is by far the best answer you’ll get.

However, if you disagree with my choice, please feel free to take any other answer as the solution to your question or even remove the solution altogether: You are in control! (If you disagree with my choice, just send me a personal message and explain why I shouldn’t have done this or :heart: or :+1: if you agree)

:innocent:
P.S. In the future, please don’t forget to come back to your question after your issue has been solved and click the 3 dots below the answer to mark a solution like this below the answer that helped you most:
Solution
so that the next person that has the exact same problem you just had will benefit from your post as well as your question will now be in the “solved” status.

1 Like

Thanks both of you. The solution seems to be doing what it is promise, so I have nothing against it. But I want to add a more simple way of getting current EOL Kernel from kernel.org. I had something in mind like this:

$ curl --silent --fail "https://www.kernel.org/feeds/kdist.xml" --output kernel.xml 
$ grep --color=auto "Version:.*(EOL)" kernel.xml | grep -o -E '[0-9].* \(EOL\)' 

Output:
5.13.19 (EOL)

There is a program called xmllint which I use to scrape simple sites. But couldn’t make it work for this purpose.

As for your solution, I have no experience with creating pacman hooks for kernels and need to read more about these topics before diving in or commenting about it.

but manjaro is not kernel.org :wink:

for example we have 512, you can use announcements :

curl -Ls https://forum.manjaro.org/c/announcements/stable-updates.rss | awk -F'>| ' '/\[EOL\]/ {print $2" : "$3}' | sort | uniq

Create a simple hook with this:

#/etc/pacman.d/hooks/z_eol_kernels.hook
[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = *

[Action]
Description = list Manjaro EOL kernels (or dead)
When = PostTransaction
Depends = curl
#Exec = /usr/bin/curl -Ls https://forum.manjaro.org/c/announcements/stable-updates.rss | awk -F'>| ' '/\[EOL\]/ {print $2" is EOL (or not exists)"}' | sort | uniq
Exec= /path/personalscript

/path/personalscript

#!/usr/bin/bash
/usr/bin/curl -Ls https://forum.manjaro.org/c/announcements/stable-updates.rss | awk -F'>| ' '/\[EOL\]/ {print "  "$2" is (was) EOL"}' | sort | uniq
# after can compare with mhwd-kernel -li and return error if installed EOL
# ...

Target = * : run for all packages (one time by transaction)
Exec : not possible to use pipe so call a script
z_eol_kernels.hook : hooks sorted by filenames (so i use z_xxxxx for run at end)

3 Likes

These hooks are pretty cool. I guess this is what kicks the nvidia related stuff too, after a Kernel update? Thank you for the explanation and examples. :slight_smile: I will definitely read into it and make use of this system. Your Python script and the associated JSON packages file is probably exactly what I am looking for, as I am only concerned about EOL Kernels.

I also saw the Announcements - Manjaro Linux Forum ? The file is smaller, almost a fourth of the .json file. And because I can, here is an alternative to find EOL Kernels with shell script:

#!/bin/sh

tmpdir="/tmp/manjaro_rss/"
rsslink="https://forum.manjaro.org/c/announcements.rss"
wget -q -P "$tmpdir" --max-redirect 1 "$rsslink" 2> /dev/null
grep -E '\s*<li>linux.*\[EOL\]</li>\s*' "$tmpdir/announcements.rss" \
    | grep -Eo 'linux.*\[EOL\]' \
    | sort | uniq
rm -f "$tmpdir/"*
rmdir "$tmpdir"

So this comes down to download speed (file sizes) versus local computation (multiple commands).

yes , /etc/ is for user hook, but we have /usr/share/libalpm/hooks/ for system (55 for me). So 55 good examples :slight_smile:

man pacman-hooks

here, the only problem is that not exists local file with this data, nor a manjaro web api. so it is up to us to be creative…

best after, in same script, is to compare kernel installed to eol kernels and return error if installed
not tested:

declare -a installed=($(mhwd-kernel -li | awk '/* / {print $2}'))
# installed=(linux510 linux512 linux514)    # result example
declare -a eol=($(curl -Ls "https://forum.manjaro.org/c/announcements/stable-updates.rss" | awk -F'>| ' '/\[EOL\]/ {print " "$2}' | sort | uniq))
# eol=(linux511 linux512 linux513 linux57 linux58 linux59)    # result today

echo " ${eol[*]}"
for k in "${installed[@]}"; do
    if [[ $(printf "%s\n" "${eol[@]}"|grep ^$k$ -c) > 0 ]]; then
        # oops linux512 is in EOL list
        echo "Warning: kernel \"$k\" installed but is EOL"
        #exit 5  # exit in hook not break pacman transaction but is big error for user
    fi
done

result:

sudo pacman -S yad
[sudo] password for patrick: 
warning: yad-10.1-1 is up to date -- reinstalling
...
:: Running post-transaction hooks...
(1/9) Arming ConditionNeedsUpdate...
(7/9) Updating the desktop file MIME type cache...
(9/9) list manjaro eol kernels (or dead)
 linux511 linux512 linux513 linux57 linux58 linux59
Warning: kernel "linux512" installed but is EOL

ps: I prefer : Type = Path and Target = boot/linux*.kver or Type = Package and Target = linux* for run this hook only if we update/install kernel :wink: lest text in pacman.log

2 Likes

Great extension would be to install a newer kernel after detection of an eol kernel.

install, i dislike… but can propose:

#!/usr/bin/bash

[[ "$(pacman-conf | awk -F '= ' '/^Architecture/ {print $2}')" != 'x86_64' ]] && exit 0
branch=$(pacman-conf -r core | awk -F'/' '/^Server/ {$(NF=NF-2); print ($NF);exit}')
declare -a eol=($(curl -Ls "https://forum.manjaro.org/c/announcements/${branch}-updates.rss" | awk -F'>| ' '/\[EOL\]/ {print " "$2}' | sort | uniq))
#echo " ${eol[*]}"    # not usefull if EOL is not installed

propose(){
  declare -a good=($(curl -s "https://gitlab.manjaro.org/applications/manjaro-settings-manager/-/raw/master/src/libmsm/KernelModel.cpp" | awk '/<< "linux.*/ { gsub(/"|;/,"",$NF);print $NF}'))
  echo "Last LTS is ${good[0]}"
  [[ "${good[0]}" != "${good[1]}" ]] && echo "Recommanded LTS is ${good[1]}"
}

# compare to mhwd-kernels -li
declare -a installed=($(mhwd-kernel -li | awk '/* / {print $2}'))
#installed=(linux510 linux512 linux514)    # result example

for k in "${installed[@]}"; do
    if [[ $(printf "%s\n" "${eol[@]}"|grep ^$k$ -c) > 0 ]]; then
        # oops linux512 is in EOL list
        echo "Warning: kernel $k installed but is EOL"
        propose
    fi
done

result:

Warning: kernel linux512 installed but is EOL
Last LTS is linux510

EDIT: add detect branch for read good subjects

2 Likes

This is perfect! Thank you. I have nothing else to add to this and this is my final script now.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.