How to check your Ubuntu or Debian version and how long it gets security updates

Which commands show your Ubuntu and Debian version, how it differs from the kernel version and until which year it is patched.

Administration5 October 20265 min read

You have just logged in over SSH and the first question is which system this is. The version decides which guide applies, which package name is right, and whether the system still receives security fixes. Below are the commands that work on both Ubuntu and Debian, what each one prints, and one trap: on Ubuntu, /etc/debian_version does not tell you the Ubuntu version.

The reliable way: /etc/os-release

Every modern systemd-based distribution describes itself in /etc/os-release. Scripts and installers read it, so the format is standard:

cat /etc/os-release

On an Ubuntu 24.04 server it returns (a few link lines removed):

Output of cat /etc/os-release on Ubuntu 24.04: version, codename and distribution ID

VERSION_ID is the number you need. VERSION_CODENAME matters when a guide names repositories by codename instead of number. ID_LIKE=debian says Ubuntu is derived from Debian, so Debian-style commands usually apply.

Debian prints a similar file (example for Debian 12, not run on a live server):

Example output of cat /etc/os-release on Debian 12

lsb_release and hostnamectl

lsb_release -a splits the version into lines. On very small images the lsb-release package may be absent; os-release still works.

lsb_release -a
Output of lsb_release -a: distributor, description, release and codename

hostnamectl shows the OS, kernel, architecture and virtualization type together, which is handy for pasting into a support ticket:

hostnamectl
Output of hostnamectl: operating system, kernel, architecture and virtualization type

Debian: /etc/debian_version, and the trap on Ubuntu

On Debian the file holds the release including the point release, for example 12.5:

cat /etc/debian_version

On Ubuntu the same file names the Debian branch Ubuntu was built from. On our Ubuntu 24.04 server it prints:

trixie/sid

Taking that for the system version leads to wrong packages and wrong guides. Check Ubuntu with /etc/os-release or lsb_release.

The kernel version is not the system version

uname -r
6.8.0-35-generic

6.8.0 is the Linux kernel, 35 is Ubuntu's build number, generic is the kernel flavour. The system is still 24.04. A new kernel can arrive in a normal update without changing the release, so "upgrade to kernel 6.x" in a guide does not mean a new Ubuntu.

How long your version gets security updates

Ubuntu LTS releases (April of even years, like 22.04 and 24.04) get five years of free security updates. After that you can extend them with an Ubuntu Pro (ESM) subscription, otherwise the server is no longer patched.

UbuntuReleasedFree security updates untilWith Ubuntu Pro (ESM) until
18.04April 2018May 2023April 2028
20.04April 2020May 2025April 2030
22.04April 2022June 2027April 2032
24.04April 2024May 2029April 2034
26.04April 2026May 2031April 2036

Debian has two stages: regular support from the Debian security team, then an LTS period run by volunteers.

DebianReleasedRegular support untilLTS until
10 (buster)July 2019September 2022June 2024
11 (bullseye)August 2021August 2024August 2026
12 (bookworm)June 2023July 2026June 2028
13 (trixie)August 2025August 2028June 2030

Data as of 5 October 2026, months are approximate, check the official release pages for exact dates. Two uncomfortable facts follow: Debian 11 is out of support, and Ubuntu 20.04 lost free security updates in May 2025.

On Ubuntu you can ask the server itself:

ubuntu-security-status
Output of ubuntu-security-status: security patching until 2029, no Ubuntu Pro subscription attached

The last two lines are the answer. Main is patched until 2029; no Pro subscription is attached, so packages from Universe are covered only for the free period.

Checking whether a new release is out

do-release-upgrade -c
Output of do-release-upgrade -c: new release 26.04.1 LTS available

The -c flag only checks. It installs nothing. If you see that message, a newer LTS exists. Do not rush a production machine, though: a release upgrade rewrites configs, can break third-party repositories and needs a reboot. Take a backup, rehearse on a test server, then do the real one. If the server is new or nearly empty, skip the upgrade: create a fresh server with the current release and move your data.

FAQ

What is the difference between the OS version and the kernel version?

The OS version is the distribution release, such as Ubuntu 24.04. The kernel version is the number of the Linux kernel inside it, such as 6.8.0. The kernel updates separately and can change several times within one release.

How do I check the Debian version without lsb_release?

Print /etc/os-release or /etc/debian_version. Both files exist on every Debian system and need no extra packages.

What does LTS mean?

Long Term Support. Ubuntu LTS ships every two years in April and gets five years of free security updates. Servers should run LTS releases.

What if my version is no longer supported?

Plan a move to a current LTS. Until then keep unneeded ports closed, keep the firewall on and do not host anything important there. The cleanest route is a new server with a current system and a data migration.

Summary

  • cat /etc/os-release shows the system version on Ubuntu and Debian.
  • lsb_release -a and hostnamectl show the same in a friendlier layout.
  • On Ubuntu /etc/debian_version prints a Debian base like trixie/sid, not the Ubuntu version.
  • The kernel version (uname -r) and the OS version are different things.
  • Check support in the tables or with ubuntu-security-status. If the version is unsupported, plan a move.
  • do-release-upgrade -c shows a new release but do not upgrade production blindly.

Deploy a server in 1 minute

Choose a location and a plan in the client area. The server starts automatically after payment.