Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add other debian derivatives support #3

Open
electrofloat opened this issue Mar 20, 2023 · 6 comments
Open

Add other debian derivatives support #3

electrofloat opened this issue Mar 20, 2023 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@electrofloat
Copy link

Hi!

Checking the repo it seems that this is only for debian, but it also seems that it shouldn't be that hard to be able to support for example ubuntu too.

Can you add support for at least ubuntu?

@x70b1
Copy link
Owner

x70b1 commented Mar 20, 2023

The required changes should be small. But I dont use Ubuntu.
If you find out whats missing or wrong, we could work on this.

@electrofloat
Copy link
Author

I haven't used your plugin yet (I'm searching one that can be used on ubuntu to check apt), but looking through https://github.com/x70b1/telegraf-apt/blob/master/telegraf-apt.sh, the following surely needs changing:

  • on ubuntu release version/codename comes from lsb_release (-r for release, -c for codename)
  • I'm not exactly sure what the release_ltsinfo and from that release_support should contain
  • instead of /usr/sbin/needsrestart, most probably only the existence of /run/reboot-required needs checking, also /run/reboot-required.dpkgs should contain packages that needs reboot

I think the other commands should work as is on ubuntu too.

@x70b1
Copy link
Owner

x70b1 commented Mar 20, 2023

Codename ist doable.

release_support and release_ltsinfo check the debian wiki if the running system is on a current version.
We need a way for ubuntu here to find this out.

needrestart is a tool that should also be availiable on ubuntu to check which services use old libs but also checks if a newer kernel is availiable. That should work without issues.

@electrofloat
Copy link
Author

I see.
Ubuntu does not have the same versioning like debian. lsb_release can also tell if the current version installed is an LTS or not, but there are new releases every half a year and not all of them LTS versions.
do-release-upgrade -c can tell if there is a new LTS version or not. For example here is the output of it on Ubuntu Jammy (22.04):

Checking for a new Ubuntu release
There is no development version of an LTS available.
To upgrade to the latest non-LTS development release 
set Prompt=normal in /etc/update-manager/release-upgrades.

Looking into the above script, it can also output a lot of different infos, like:

Your Ubuntu release is not supported anymore.
For upgrade information, please visit:\n
(url)s\n") % { 'url' : url }
In /etc/update-manager/release-upgrades Prompt
is set to never so upgrading is not possible.
New release '%s' available.
Run 'do-release-upgrade' to upgrade to it.

so you could parse the output of this python script, or just simply check for the exit code of it. Exit codes are:

RELEASE_AVAILABLE=0
NO_RELEASE_AVAILABLE=1

@x70b1
Copy link
Owner

x70b1 commented Mar 21, 2023

Thanks for this hint.

The problem is that it reports an 20.04.6 LTS as upgradable to 22.04.2 LTS which is true. But 20.04 is still not outdated.

One other thing is in my mind that is still open. In the script at L22 is a curl that asks the Debian wiki to find out if the current running version is still supported or not. I could also hard code the time values when a specific release is up to date or not. The idea was that a system is able to find out his own status even if the script is outdated. If I insert some timestamps, the script needs to be up to date to return correct values.

This info is used for debian_support (would be ubuntu_support on Ubuntu) and updates_severity.

Solution A: We could remove this logic and insert some timestamps for specific releases.

Solution B: We find a way to solve this for ubuntu too. But as there are a lot more releases and the wiki release page is not that easy to parse.

@electrofloat
Copy link
Author

I think inserting timestamps is not the best idea, since as you said that means the script needs to be updated every time to be correct.

Maybe there are other ways for ubuntu then. Needs a bit more research.

@x70b1 x70b1 added enhancement New feature or request help wanted Extra attention is needed labels Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants