Over a million developers have joined DZone.

Comparing the Difference Between Two Environments

DZone's Guide to

Comparing the Difference Between Two Environments

Everyone's heard ''your app doesn't work on my machine,'' and there are tons of variables that can contribute to why something is broken. Here's a way to quickly find out what the differences are.

· DevOps Zone ·
Free Resource

Easily enforce open source policies in real time and reduce MTTRs from six weeks to six seconds with the Sonatype Nexus Platform. See for yourself - Free Vulnerability Scanner. 

Why is this working on my server, but fails on yours? This kind of question is quite common. After careful checks and side-by-side tests, we may or may not find the difference. The root cause may be a packages conflict, mismatched versions, corrupted files, or something magical.

How we can quickly detect the noticeable differences between two servers?


 Let's examine the common differences:

  1. OS flavor. The OS version may be different. Say, the system may work on Ubuntu 14.04 64-bit, but fails on Ubuntu 12.04 32-bit. The server may have less memory than we expect, etc.
  2. Software Packages. Missing packages, extra packages installed which cause conflicts, wrong installation versions, etc.
  3. Libraries. Wrong JDK version, some .jar libraries are missing, etc.
  4. Config files. Incorrect setting in config files.

Luckily all this information can be discovered by using multiple existing commands. For example, we can get all OS details by probing  /proc filesystem  or commands like  free/df/lscpu , etc. All software installed after OS installation can be found like this. Jar libraries usually are placed under the $CLASSPATH folder, etc.

Apparently it demands a lot of learning and experience to get familiar with all these tools. Furthermore, humans are slow and error-prone.

What if we design a command-line tool to automate the check and compare process?

We need it to:

  • Dump detailed information into txt files.
  • Categorize different checks into typical scenarios, like OS, Java, Python, etc.
  • Diff the generated list by category.

Based on this idea, here comes list_os_packages cli tool in Github.


For better user experience, we can wrap up it as a Jenkins job: CompareMachinesReport.



Like our blog posts? Discuss with us on LinkedIn, Wechat, or NewsLetter.

Automate open source governance at scale across the entire software supply chain with the Nexus Platform. Learn more.

devops ,troubleshoot ,compare

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}