Payments are experiencing issues due to temporary restrictions in Russia. If your payment does not go through, please submit a support request.Our support team is available 24/7 — we are always here to help with hosting and server issues.We are now accepting requests for dedicated server rental and colocation services in our data center.Reminder: we recommend enabling backups for additional data protection.A new VPS/VDS lineup with NVMe storage and improved performance is now available.Maintenance work on some servers has been completed. All services are operating normally.
Article3 min readViews0

How to Check the Installed Package Version and Update Source in Ubuntu

We verify the package using dpkg-query and apt-cache policy, distinguishing between the installed version, the candidate for update, and the actual source of the running process.

Checking a computer component and its packaging
In this article

The terminal displays the program number, but that is insufficient for maintenance. You need to know where it was installed and how it receives fixes. A package from a repository, a manually compiled build, and a program inside a container may share a similar name but have completely different update procedures.

Find the installed package

Examples are intended for Ubuntu or Debian with dpkg and APT. The name nginx is used as a package example; the composition and names may differ in a specific installation.

dpkg-query -W -f='${Package}\t${Version}\t${Status}\n' nginx

The output shows the package, full version, and status. A message stating the package is missing does not prove the program is absent: it could have been installed manually, inside a container, or under a different package name.

The full package version contains more information than the short program number. A distribution may backport fixes into its build without moving to the latest upstream branch. Therefore, evaluating the presence of a fix based only on the first digits of the version is incorrect.

Check the candidate and priorities

For the local cache state of APT:

apt-cache policy nginx

The command displays the installed version, the candidate, and available sources based on existing indexes and priorities. It does not update packages and does not guarantee that indexes are current. If lists have not been updated for a long time, the output will not reflect the latest changes in repositories.

The candidate is determined by the version selection policy. It may differ from the highest version number you have seen on the developer's website. Repository restrictions, version pinning, and maintenance settings must be considered separately.

Link the package to the running program

Example: the package is updated, but the service is launched from a different path. In this case, the dpkg state does not describe the binary file actually serving the site. Check the launch command and deployment architecture before declaring the update complete.

A container represents another layer: updating a package on the host does not replace the contents of an already used image. For the image, the version, build method, and deployment procedure are critical. Do not mix these details into a single statement like 'server updated'.

Do not change repositories just for a nicer version

Adding a new source changes the trust chain and subsequent package selection. This is a separate change that requires understanding compatibility and the order of operations. For initial diagnostics, it is sufficient to read the current policy and note the discrepancy.

If the question concerns a specific fix, look for it in the vendor's official advisory for your system release and full package number. An upstream number without the distribution build can lead to both false alarms and false security.

What counts as a useful outcome

Record the system release, package, installed version, candidate, source, and application launch method. Note the freshness of indexes and the presence of manual components separately. These data points allow you to formulate a justified update plan.

After a coordinated change, verify not only the record in the package database but also the actual version of the running service, followed by the user scenario. Package source diagnostics do not perform the update themselves; they make the subsequent decision verifiable and help avoid affecting an unsuitable environment.

Discussion 0

Share your experience and ask questions. Comments without links appear after editorial review.

No comments yet. Start the discussion.