IMD SolutionComputing LibraryShop main store

Troubleshooting

Why clock skew detected breaks Linux builds on an edge PC

Operating systems on the plant floor Published 9 min read

Short answer

Clock skew detected means a build file carries a modification time later than the edge PC's clock — 3,611,765 s for binding.gyp and 5,022,797 s for config.mk in the logged builds. Set the clock with date -s, enable NTP so it holds, and rebuild nothing on images that already bundle MRAA and Mosquitto; update components through a Yocto image build only when a version requirement demands it.

On this page
  1. Why does make report Clock skew detected on a Linux edge PC?
  2. Why are binding.gyp and config.mk dated in the future?
  3. Why does node-gyp report ValueError: semaphore or lock released too many times?
  4. How do I set the clock on the edge PC before compiling?
  5. Do I need to build MRAA and Mosquitto from source at all?
  6. When should component updates go through a Yocto image build?
  7. How do I verify the clock and build tree after the fix?
  8. Which fix applies to your case?
  9. Questions asked

Clock skew detected does not describe a broken compiler; it describes a device clock running behind its own source files. GNU Make orders work by modification timestamps, so files stamped ahead of the system make that ordering untrustworthy, and on the edge PC behind these logs the mraa build then collapsed inside node-gyp with a Python multiprocessing semaphore error while the Mosquitto tree warned skew in every directory. The fix costs nothing: read and set the clock, enable time synchronization, and on an image that already bundles MRAA and Mosquitto, rebuild nothing — commission the installed components instead. Build from source only when a named version requirement justifies it, and then through a consistent image build.

Why does make report Clock skew detected on a Linux edge PC? #

GNU Make prints that warning when a build input carries a modification time later than the system clock, because the tool then cannot trust which target is older than which prerequisite and tells you the build may have skipped required steps.

Make decides what to compile purely by timestamps: a target older than its prerequisites is rebuilt, a newer one is skipped. When an input's stamp lies ahead of the clock, both branches of that decision become unreliable. The logged runs showed the literal warning Clock skew detected. Your build may be incomplete. at the top level and again inside the subdirectories of both builds.

The cause on a plant-floor edge PC is almost always the clock, never the source. A controller that boots without a synchronized clock starts from a stale date, and until a time source or a manual correction runs, every file unpacked after boot carries a stamp later than the system's own current time. An offset measured in days rather than seconds is the signature of that never-set clock, which is why the warning appeared across unrelated directories of two different builds at once.

Why are binding.gyp and config.mk dated in the future? #

The files are not corrupt and the compiler is not the fault: ../binding.gyp sat 3,611,765 s ahead of the device clock and ../config.mk 5,022,797 s ahead, roughly 42 and 58 days — a timestamp offset, not a duration, timeout or transfer speed.

Worked example, using the logged offsets. The mraa build reported ../binding.gyp at 3,611,765 s in the future; one day holds 86,400 s, so 3,611,765 / 86,400 = 41.8, which puts the clock 41 days and about 19 hours behind that file. The Mosquitto build reported ../config.mk at 5,022,797 s in the future, and 5,022,797 / 86,400 = 58.1 days ahead. Subtract the two offsets: 5,022,797 - 3,611,765 = 1,411,032 s, about 16.3 days, so the error was not one uniform shift applied to every file. Read the offset from each warning line, because a blanket correction assumed from one file can leave the other still future-dated.

The files themselves were written at ordinary times — created and unpacked at real dates while the device clock sat behind them. A file reported in the future is a clock reading to correct, not evidence against the archive: check the clock against a trusted reference before you suspect the download.

Why does node-gyp report ValueError: semaphore or lock released too many times? #

The ValueError came from the Python 2.7 multiprocessing worker inside the mraa build's node-gyp step, in the same run in which make had flagged ../binding.gyp as future-dated, so treat the timestamp disorder as the fault the logs prove and correct the clock before touching any library.

The traceback ran through /usr/lib/python2.7/multiprocessing/process.py into a pool worker and failed inside queues.py, on the release of a semaphore during the queue's get(), while node-gyp rebuild was regenerating the mraa makefiles. That path names the failing subsystem — a Python 2.7 multiprocessing worker cooperating with a native build — not a demonstrated defect in MRAA's hardware-access code.

The message text is documented against other multiprocessing-based Python tools, so it is not a signature unique to one library. What the log proves is the environment: a build whose inputs sat days ahead of the clock collapsed inside its helper, and in this run the skew is the only abnormality shown — so it is the cause to remove first, not MRAA, not Mosquitto, and not the Node-RED version. Correct the clock, then re-run anything that happened under skewed time.

If a compile is genuinely required and the semaphore error returns on a time-consistent tree, capture the full traceback and check the interpreter and build-tool combination documented for that image; Python 2.7 multiprocessing is the machinery this log names, and it narrows what a replacement must be compatible with.

How do I set the clock on the edge PC before compiling? #

Read the clock with date -u, compare it with a trusted reference at the same instant in UTC, set it with date -s, then re-read to confirm; on a fanless edge PC without a battery-backed real-time clock, enable NTP as well so the correction survives the next power cycle.

  1. Read the device clock with date -u and write the UTC instant down; comparing UTC on both sides keeps timezone settings out of the measurement.
  2. Read a trusted reference — a workstation, a phone, a plant time server — at the same moment; a gap of weeks confirms the never-set clock behind the build warnings.
  3. Set the clock with date -s "2026-02-03 08:45:00" on GNU coreutils images; many BusyBox-based images take the dotted form date -s "2026.02.03 08:45:00", and date --help shows the format yours accepts. Re-run date -u to confirm.
  4. Make it survive reboots: enable the image's NTP client or time-synchronization service against a reachable server, power-cycle once, and confirm the time held.
  5. Return to the build tree last: re-extract the source from a clean archive if any file still carries a future stamp, and run make clean before rebuilding so objects whose order make no longer trusts cannot survive.

One operational caution: a clock change on a plant PC reorders its logs and can trip certificate or license validity checks, so make the change in a maintenance window and record the old and new readings in the shift log.

Do I need to build MRAA and Mosquitto from source at all? #

Usually no: MRAA is the software interface to the hardware I/O and Mosquitto is the MQTT broker that routes published messages to subscribed clients, and on an image that already bundles both you commission what is installed instead of compiling replacements.

First establish what the image actually provides, down to its Linux base and bundled components — Identify the Linux base before installing Node-RED natively walks through that read. The logged attempt then ran npm install mraa from /home/root/.node-red, which selected mraa version 1.7.0 and started node-gyp rebuild, a native compile that only makes sense when the module is genuinely out of the runtime's reach. Presence at operating-system level and visibility to the Node-RED runtime are separate checks, so confirm what the installed node requires and where the runtime resolves it before compiling anything.

The Mosquitto attempt built /mosquitto-1.4.12 with make WITH_SRV=no and followed with make test, but a bundled broker wants commissioning, not compiling: confirm the service runs and that one publish/subscribe round trip succeeds from the runtime, with the listener and access-control settings behind that check covered in Run a secure Mosquitto MQTT lab broker with Node-RED. The line Nothing to be done for 'all' from the man directory described that subdirectory's target under skewed timestamps — it is not a verdict on the broker's health.

If Node-RED itself is not yet on the device, install it in the supported order first: Install Node-RED Natively on a Linux Edge Computer.

When should component updates go through a Yocto image build? #

Route an update through a Yocto image build when a specific application requirement names a version you must have: the Yocto framework assembles the library, the Node.js runtime and their dependencies into one reproducible image, keeping every dependency satisfied instead of patching one package on the deployed device.

Image release numbers and individual package versions identify different things, and a component's presence does not establish its version — read both before deciding. The version an older setup guide happens to install is not a requirement; the logged detour started exactly there, with instructions written for an older image. An upgrade needs a named interface or feature that the installed component lacks.

When that requirement exists, build the component into a Yocto image rather than replacing one package on the live device: the framework resolves the library, the runtime and the build-tool choices together, so dependencies stay satisfied. Preserve the Node-RED flows and configuration before replacing an image, and validate the rebuilt image's component versions on the bench before it reaches the plant.

How do I verify the clock and build tree after the fix? #

Re-read the clock in UTC after a reboot, confirm no file under the build tree reports a future modification time, then rebuild what you need: every Clock skew detected warning must be gone, and on a bundled image the correct result is a working broker, not a build.

  • date -u after one full power cycle reads the expected instant, proving the correction held.
  • The previously future-dated files, and everything else you plan to compile, now carry timestamps in the past relative to the clock.
  • A required rebuild runs from first object to last with no Clock skew detected line and no future-file warning.
  • On an image that bundles the components, the pass condition is not a build at all: the node loads and the broker round trip succeeds.

A build that then completes without the semaphore error confirms the environment fault is gone. If the error returns on this clean, time-consistent tree, the traceback you capture then moves the investigation off the clock and onto the runtime's build tools.

Which fix applies to your case? #

Three cases cover it: a clock behind its files gets set and synced, an image that already bundles MRAA and Mosquitto gets commissioned rather than rebuilt, and a genuine version requirement gets a Yocto image build — none of the three starts with npm install mraa or make WITH_SRV=no.

  • Clock-skew warnings only: set the clock with date -s, enable time synchronization, verify after a reboot, then rebuild only what a real requirement demands.
  • Semaphore ValueError during node-gyp on a bundled image: correct the clock, rebuild nothing, and verify that the installed module loads and the broker answers.
  • Named version requirement: integrate the component through a Yocto image build with the flows preserved and the result bench-validated — not through on-device npm install or make.

Questions asked

Does Clock skew detected stop the build?

No — make logs it as a warning and continues, which is why the condition is easy to miss in a long build. Treat nothing produced under skewed time as proven: repeat the run after the clock is corrected and schedule that repeat rather than shipping the output of the skewed run.

How do I keep the clock correct after the next power cycle?

Point the time-synchronization service at a source your plant controls and verify with a UTC clock read after one full power cycle. In an isolated cabinet with no reachable time server, reapply the correction at every boot until a source exists; otherwise the future-file warnings return with the next source tree you unpack.

Is the semaphore error evidence against MRAA itself?

The log gives no evidence against MRAA's hardware code: the traceback passes through the Python multiprocessing queue and pool machinery, and the same message text is documented against other multiprocessing-based Python tools such as joblib's process executor. Remove the timestamp disorder first; only if the error returns on a build tree with trustworthy times does the image's interpreter and build-tool pairing become the suspect to investigate.

What does make test prove for the Mosquitto build?

It runs the source tree's own test suite and only means anything after a genuine, time-consistent build. It does not set the clock, repair skewed timestamps, or show that the broker on your plant network accepts connections; that is a commissioning check on the deployed system, not a compiler result.

Keep reading

  • How-to

    Configure IP networking on an edge PC with no SSH access

    A new edge PC that leaves the factory with DHCP and static addressing disabled has no IP address, so SSH cannot connect to it. Do the first configuration at a keyboard and monitor: set X1 to DHCP and the plant-side port to the planned static address, restart networking, then confirm both addresses with nmcli device status and ip a before opening SSH or browser management on port 9090.

    Operating systems on the plant floor

  • How-to

    Identify the Linux base before installing Node-RED natively

    Run cat /etc/os-release and uname -m on the running controller before copying anything. ID=debian opens a Debian package workflow; ID=ptxdist with PTXDIST_VERSION 2020.08.0 marks an embedded image where an ARMv7l Node.js tarball needs the hard-float libatomic1_13.2.0-4_armhf.deb staged by the image's own method. The product label never decides this.

    Operating systems on the plant floor

  • How-to

    Add a Linux desktop and browser to a Debian edge PC

    Install GNOME on the running system: run sudo apt update, then sudo apt upgrade, reboot, then sudo apt install gnome. The download is about 1-2 GB and the procedure needs 10 GB of free disk; GNOME Web comes with it. Reinstall Debian with the graphical installer only when you are rebuilding the box anyway.

    Operating systems on the plant floor