On Tue, Nov 09, 2021 at 09:22:25AM +0000, Koler, Nethanel wrote: > I am Nati, I am trying to find a variable that is configured in the > linux-headers that can tell me on which Debian I am
This sounds like an X-Y problem. What's your real objective? There is NOT a one-to-one correspondence between a Linux kernel version and a Debian release version. Debian allows you the freedom to use any kernel you want -- one of Debian's kernels, or one that you built yourself, or one that you copied over from an Ubuntu system, or whatever. Even if you use a Debian kernel, it might not have come from the Debian version that you're currently running. You might still be using a 4.x kernel on bullseye, for instance, due to incompatibility with one of your devices. Or you might be using a backported kernel from a future release because of hardware needs. > For example in RedHat > After downloading the linux-headers > I can go to cd /usr/src/kernels/<header>/include/generated/uapi/linux > There there is a file called version.h > Where they define this variables > > #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) > #define RHEL_MAJOR 8 > #define RHEL_MINOR 4 That sounds like a really bad idea to me. At *best* this would only tell you what version of Red Hat Enterprise Linux the developer thought the kernel was being built on. At worst, it's a complete fabrication. In *all* cases, this number is baked into the kernel, at compile time, and does not reflect anything about the actual system that the kernel is booting. Correct me if I'm wrong, but I think RHEL does not support upgrades. If you're running RHEL 7 and you want to upgrade to RHEL 8, you have to reinstall. Therefore, it's *sort of* conceivable that the version number which is baked into the kernel might mean something, but only if the administrator of the box has actually followed RHEL's advice and never upgraded it, outside of official RHEL support channels. That doesn't work for Debian, at all. Debian's greatest strength is its ability to be upgraded. A great deal of development time is put into achieving this goal. A Debian system is expected to be installed one time, and upgraded many times, until it's finally retired. At any point in that lifespan, you might have a kernel which has an older release's version number baked into it, on a newer release of Debian. The version number inside the kernel would therefore be inaccurate.