CODESYS Licensing with CodeMeter on Torizon OS
Introduction
CODESYS uses WIBU CodeMeter to activate and serve its licenses. CodeMeter binds a CmActLicense to the hardware that holds it, and that binding does not complete when CodeMeter runs inside a Docker container. You must run CodeMeter natively on the Torizon OS host.
This article describes how to install CodeMeter directly on a running Torizon OS device, activate a CODESYS license bound to the target device, and run the CODESYS runtime in a container that consumes the license. The setup is done when the runtime logs Runtime licensed and the license container still reports (enabled) after a reboot.
The Partner Demo Container - CODESYS article covers the CODESYS Development System workflow and the evaluation container, which runs for two hours without a license. For an introduction to the CODESYS Software PLC, refer to the CODESYS documentation.
This article complies with the Typographic Conventions for the Toradex Documentation.
Licensing Architecture
This setup involves three components:
- CodeMeter is the WIBU licensing daemon. It holds the license container and answers license queries. It runs natively on the Torizon OS host as a system service, outside any container.
- The CODESYS runtime is the software Programmable Logic Controller (PLC) that executes the application. It runs in a container and consumes the license by querying CodeMeter on the Torizon OS host.
- The CODESYS Development System runs on the host machine and connects to the runtime over port
11740.
CodeMeter operates in local network server mode, and the runtime queries it over the network. Server mode is mandatory in this use case, because CODESYS Virtual Control SL accepts only a network license.
CodeMeter stores licenses in SoftContainers. A SoftContainer is a CodeMeter construct and has no relation to a Docker container.
Prerequisites
- On the host machine:
codemeter-lite_9.0.8031.500_arm64.deb, from the WIBU user software download section. Filter the packages by Linux and search forcodemeter-lite. This package contains the CodeMeter binaries.codesyscontrol_linuxarm64_4.21.0.0_arm64.deb, from the CODESYS Store. This package carries the license template.- A CODESYS license ticket. Check which product the ticket lists before you start. A ticket for the wrong product activates without any error and still leaves the runtime in demo mode.
- On the target device:
- A working network connection with Network Time Protocol (NTP) synchronization. An incorrect clock locks the license container, so check it before you start.
- The
codesyscontrol_virtuallinuxarm64:4.21.0.0container image, which provides the CODESYS runtime.
Refer to the CODESYS TargetVisu Container article for the download steps of both required packages.
Install CodeMeter on Torizon OS
Extract the CodeMeter and CODESYS Packages
WIBU signs the CodeMeter package, so extract it with dpkg-deb -x instead of ar. The ar command extracts only the signature and leaves you with an empty directory.
Extract the package, archive the result, and copy it to the target device. Replace <family>, <processor>, and <serial_number> with the appropriate values for your device:
$ BOARD=torizon@<family>-<processor>-<serial_number>.local
$ dpkg-deb -x codemeter-lite_9.0.8031.500_arm64.deb cm-root
$ tar --numeric-owner -C cm-root -czf cm-root.tar.gz .
$ scp cm-root.tar.gz $BOARD:~/
The CODESYS runtime package carries the license template as a hidden file. Extract and rename it without the leading dot, which avoids globbing problems in the steps that follow:
$ dpkg-deb -x codesyscontrol_linuxarm64_4.21.0.0_arm64.deb cds-ext
$ find cds-ext -iname '*.WibuCmLif'
$ cp cds-ext/var/opt/codesys/.UFC_SoftContainer_CmRuntime.WibuCmLif ./UFC-template.WibuCmLif
$ scp UFC-template.WibuCmLif $BOARD:~/
Prefer the find command to locate the templates, since their path changes between CODESYS versions. Version 4.21.0.0 stores the templates at /var/opt/codesys/.
The package carries two .WibuCmLif templates, UFC_SoftContainer and CODESYS-Control_SL-V1. This procedure uses UFC_SoftContainer.
If the host machine does not provide dpkg-deb, extract the packages in a temporary Debian container:
$ docker run --rm \
-v "$PWD":/data \
-w /data debian:stable-slim \
sh -c 'dpkg-deb -x codesyscontrol_linuxarm64_4.21.0.0_arm64.deb cds-ext'
Install the CodeMeter Binaries
Torizon OS mounts /usr as read-only through OSTree, and not even the root user can write to it at runtime. Install the CodeMeter binaries into /opt instead, which stays writable and persistent.
Extract the archive, copy its contents to /opt/codemeter, and place the configuration files under /etc/wibu/CodeMeter:
# sudo mkdir -p /opt/codemeter /etc/wibu/CodeMeter
# mkdir -p ~/cm-stage
# tar --numeric-owner -C ~/cm-stage -xzf ~/cm-root.tar.gz
# sudo cp -a ~/cm-stage/. /opt/codemeter/
# sudo cp -a /opt/codemeter/etc/wibu/CodeMeter/. /etc/wibu/CodeMeter/
# sudo chown -R root:root /opt/codemeter /etc/wibu/CodeMeter
Confirm that the daemon and the client were copied successfully, both with mode -rwxr-xr-x:
# ls -la /opt/codemeter/usr/sbin/CodeMeterLin /opt/codemeter/usr/bin/cmu
Create the License State Directories
CodeMeter treats the state directory as a license vault and refuses to operate on a vault that anyone can write. Loose permissions make CodeMeter reject the license container, leave it (locked), or fail administrative operations with Access failed.
Create the full directory tree that CodeMeter expects, then apply mode 700 to the directories and mode 600 to the files:
# sudo mkdir -p \
/var/lib/CodeMeter/Backup \
/var/lib/CodeMeter/CmAct \
/var/lib/CodeMeter/CmCloud \
/var/lib/CodeMeter/NamedUser \
/var/lib/CodeMeter/WebAdmin \
/var/log/CodeMeter
# sudo chown -R root:root /var/lib/CodeMeter /var/log/CodeMeter
# sudo find /var/lib/CodeMeter /var/log/CodeMeter -type d -exec chmod 700 {} \;
# sudo find /var/lib/CodeMeter /var/log/CodeMeter -type f -exec chmod 600 {} \;
The commands use find -exec instead of chmod 600 dir/* deliberately. Your shell expands the glob before sudo runs, so with the directory at mode 700 and your session running as torizon, the command fails with No such file or directory even under sudo.
Never apply chmod -R a+rwX or mode 777 to these directories. Loose permissions break the license state in ways that the error messages never mention. Refer to the Access Failed on Import While the Container List Works section.
Enable Network Server Mode
Run the following command to rewrite the IsNetworkServer setting in /etc/wibu/CodeMeter/Server.ini to 1, which enables network server mode. Then, verify that the change was successful by checking the settings in the configuration file:
# sudo sed -i 's/^[[:space:]]*IsNetworkServer[[:space:]]*=.*/IsNetworkServer=1/' \
/etc/wibu/CodeMeter/Server.ini
# grep -E 'IsNetworkServer|BindAddress|ApiCommunicationMode' /etc/wibu/CodeMeter/Server.ini
IsNetworkServer=1
BindAddress=0.0.0.0
ApiCommunicationMode=1
The grep output must show IsNetworkServer=1. A different value, or a missing line, means the sed command matched nothing because your Server.ini carries the setting in another form. Edit the file and set IsNetworkServer=1 manually.
Leave ApiCommunicationMode at its default of 1. That value selects TCP communication on port 22350, which is the mode this procedure needs.
Keep the default values of LogCmActDiag and DiagnoseLevel as well. A higher diagnostic level generates enough events to saturate the log channel and degrade the daemon. The Daemon Consumes CPU and Grows in Memory section describes what that looks like.
Create the CmLogger Service
The WIBU package ships four systemd units:
codemeter.servicecodemeter-logger.servicecodemeter-logger.socketcodemeter-webadmin.service
This manual installation does not start the logger automatically. Create the logger unit manually to avoid having CodeMeter pile up events for a logger that does not exist until its buffer overflows.
# sudo tee /etc/systemd/system/codemeter-logger.service >/dev/null <<'EOF'
[Unit]
Description=CodeMeter Logger
Before=codemeter.service
[Service]
Type=simple
Environment=LD_LIBRARY_PATH=/opt/codemeter/usr/lib/aarch64-linux-gnu:/lib:/usr/lib
ExecStart=/opt/codemeter/usr/sbin/CmLogger
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
Create the CodeMeter Service
The daemon runs from a second unit, ordered after the logger:
# sudo tee /etc/systemd/system/codemeter.service >/dev/null <<'EOF'
[Unit]
Description=CodeMeter Runtime Server (native)
After=network-online.target time-sync.target local-fs.target codemeter-logger.service
Wants=network-online.target time-sync.target codemeter-logger.service
RequiresMountsFor=/opt/codemeter /var/lib/CodeMeter
[Service]
Type=simple
Environment=LD_LIBRARY_PATH=/opt/codemeter/usr/lib/aarch64-linux-gnu:/lib:/usr/lib
ExecStartPre=-/bin/rm -f /var/lock/cm_lock
ExecStart=/opt/codemeter/usr/sbin/CodeMeterLin -f
ExecReload=/bin/kill -USR1 $MAINPID
KillSignal=SIGINT
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
The time-sync.target dependency holds the daemon until the clock synchronizes. On a module without a Real-Time Clock (RTC), a daemon that starts too early creates the license container with the wrong time and locks it. The ExecStartPre line clears a stale /var/lock/cm_lock, which a daemon that crashed leaves behind.
Enable systemd-time-wait-sync.service so that time-sync.target waits for the actual synchronization, then start both services:
# sudo systemctl enable systemd-time-wait-sync.service
# sudo systemctl daemon-reload
# sudo systemctl enable --now codemeter-logger.service
# sudo systemctl enable --now codemeter.service
# sleep 10
# systemctl status codemeter --no-pager
The service must report active (running), and the journal must show EventNetworkClient: Connection established, which confirms that the logger serves the daemon. An Overflow while buffering messages message means the logger did not start. Refer to the Create the CmLogger Service section.
Create the CodeMeter Client Wrapper
You must call cmu through the wrapper. A direct call to /opt/codemeter/usr/bin/cmu without LD_LIBRARY_PATH loads an incompatible library. Read operations still work, so the installation looks healthy, and then every administrative operation fails with Access failed. Refer to the Access Failed on Every Operation section.
The /usr/local/bin directory belongs to the read-only /usr, so the wrapper goes in /opt:
# sudo tee /opt/codemeter/cmu >/dev/null <<'EOF'
#!/bin/sh
export LD_LIBRARY_PATH=/opt/codemeter/usr/lib/aarch64-linux-gnu:/lib:/usr/lib
exec /opt/codemeter/usr/bin/cmu "$@"
EOF
# sudo chmod 755 /opt/codemeter/cmu
Add /opt/codemeter to the PATH through /etc/profile.d/codemeter.sh, because /etc stays writable:
# echo 'export PATH=$PATH:/opt/codemeter' | sudo tee /etc/profile.d/codemeter.sh
Reopen your SSH session to pick up the new PATH. The remaining steps call sudo /opt/codemeter/cmu with the full path, so they work either way.
Confirm that the client talks to the daemon:
# sudo /opt/codemeter/cmu --version
# sudo /opt/codemeter/cmu --list
The --version option must report CodeMeter-Service at the same version as the client, and a not running message means the daemon is down. At this point, --list answers 0 CmContainer(s) listed without Access failed.
Initialize the CmAct Structure
The WIBU reference procedure runs CodeMeterLin -x once, before the first import, to create the internal CmAct structure. Stop the daemon first:
# sudo systemctl stop codemeter.service
# sudo env LD_LIBRARY_PATH=/opt/codemeter/usr/lib/aarch64-linux-gnu:/lib:/usr/lib \
/opt/codemeter/usr/sbin/CodeMeterLin -x
# pgrep -a CodeMeterLin
# sudo systemctl start codemeter.service
The -x option produces no output; that's expected. The pgrep command confirms that no process stayed in the background, which would leave two daemons running after the restart. Kill any process it finds before you start the service. Refer to the Two CodeMeter Daemons Run at the Same Time section for more information.
This step follows the WIBU reference procedure and you can skip it. Running it on a first-time installation does no harm, and it does not rescue a device that already failed to activate.
Activate the CODESYS License
CodeMeter binds each license to the device hardware, so you run this cycle once per device. No golden image carries the license.
Verify the Device State
An import with the wrong clock, or with two daemons running, leaves a license state that is difficult to reverse. Check the clock, the daemon, and the container list before you continue:
# timedatectl
# pgrep -a CodeMeterLin
# sudo /opt/codemeter/cmu --list
All three conditions must hold:
timedatectlreportsSystem clock synchronized: yeswith the correct date and time- Exactly one
CodeMeterLinprocess runs --listanswers0 CmContainer(s)without errors
Create the License Container
This import runs once per device. A second one creates an extra empty container that you then have to remove by hand.
# sudo /opt/codemeter/cmu --import --file /home/torizon/UFC-template.WibuCmLif
# sudo /opt/codemeter/cmu --list
A successful import reports:
CmActLicense update: Serial number 130-XXXXXXXXX, FirmCode 6000437.
--> successful
1 successful update done
The --list option then shows a 130- container in the (empty) state.
The import creates the container under Firm Code 6000437. Later commands pass that Firm Code through the --context option, and CodeMeter uses it as the prefix of the container filenames under /var/lib/CodeMeter/CmAct/.
The Two Containers Exist and One Is Empty section describes how to clean up after a double import. If this import returns ERROR 233, refer to the Error 233 on Import section.
Generate the Activation Request
Extract the serial number of the license container, then turn it into an activation request:
# SERIAL=$(sudo /opt/codemeter/cmu -x | sed -n 's/.*Serial Number \(130-[0-9]*\)-.*/\1/p' | head -n1)
# echo "Serial: $SERIAL"
# sudo /opt/codemeter/cmu --context 6000437 --serial "$SERIAL" --file ~/request.WibuCmRaC
# ls -la ~/request.WibuCmRaC
The echo command must print a serial number. An empty value means the previous step did not create the container.
Copy the request to the host machine:
$ scp torizon@<family>-<processor>-<serial_number>.local:~/request.WibuCmRaC ./
Activate the License on the CODESYS Website
On the CODESYS licensing website, enter your ticket, choose file-based activation, upload request.WibuCmRaC, complete the transaction, and download the .WibuCmRaU response.
Copy the response to the device:
$ scp response.WibuCmRaU torizon<family>-<processor>-<serial_number>.local:~/
Import the Activated License
Import the response on the same device that generated the request:
# sudo /opt/codemeter/cmu --import --file /home/torizon/response.WibuCmRaU
# sudo /opt/codemeter/cmu -x | grep -E "Serial Number|enabled|locked|empty"
The container moves from version 3.00 (empty) to version 4.50 (enabled), with the product codes enabled.
Keep the .WibuCmRaU file with the equipment record, and never import it again; a second import of an applied response returns ERROR 233.
Generate the Activation Receipt
CODESYS needs the receipt to open a support case later. The website round-trip usually ends your SSH session and clears $SERIAL, so the first command derives the serial number again:
# SERIAL=$(sudo /opt/codemeter/cmu -x | sed -n 's/.*Serial Number \(130-[0-9]*\)-.*/\1/p' | head -n1)
# sudo /opt/codemeter/cmu --context 6000437 --serial "$SERIAL" --file ~/receipt.WibuCmRaC
Copy the receipt to the host machine:
$ scp torizon@<family>-<processor>-<serial_number>.local:~/receipt.WibuCmRaC ./
Upload receipt.WibuCmRaC in the same transaction on the CODESYS licensing website.
Confirm the Network Server
Ask the daemon for its own network server entry:
# sudo /opt/codemeter/cmu --list-network --server 127.0.0.1
The command answers with the device hostname. A Server not found message means IsNetworkServer is not 1, or the daemon does not listen on port 22350:
# sudo netstat -tlnp 2>/dev/null | grep 22350
Run the CODESYS Runtime Container
The runtime runs in a container and reaches CodeMeter on the Torizon OS host. The Docker network mode decides which address it must use, and a wrong address is the most common cause of demo mode.
The codesyscontrol_linuxarm64 Debian package and the codesyscontrol_virtuallinuxarm64 container image are different artifacts. This procedure uses the package only for the license template, and the image to run the licensed runtime. The image corresponds to CODESYS Virtual Control for Linux ARM64 SL.
Host Network Mode
Host network mode shares the host network stack with the container, so localhost resolves to the host and the daemon answers. Toradex recommends this mode for a local license, because it does not depend on the host IP address.
# docker run -dit --name codesys-runtime --network host \
-v ~/dockerMount/conf/codesyscontrol/:/conf/codesyscontrol/ \
-v ~/dockerMount/data/codesyscontrol/data/codesyscontrol/:/data/codesyscontrol/ \
codesyscontrol_virtuallinuxarm64:4.21.0.0 -s localhost
The runtime binds ports 443, 4840, 8080, and 11740 directly on the host. These ports do not appear in docker ps because host network mode uses no port mapping and no Network Address Translation (NAT). Confirm the ports on the host:
# sudo netstat -tlnp 2>/dev/null | grep -E ":(443|4840|8080|11740) "
Bridge Network Mode
In bridge mode, localhost inside the container refers to the container itself and CodeMeter stays unreachable. Pass the host IP address instead:
# docker run -dit --name codesys-runtime \
-p 443:443 -p 4840:4840 -p 8080:8080 -p 11740:11740 \
-v ~/dockerMount/conf/codesyscontrol/:/conf/codesyscontrol/ \
-v ~/dockerMount/data/codesyscontrol/data/codesyscontrol/:/data/codesyscontrol/ \
codesyscontrol_virtuallinuxarm64:4.21.0.0 -s <host-ip>
Bridge mode depends on the host IP address, which changes when the network changes.
Do not pass --rm to docker run. A container started with --rm disappears when it stops and takes its log with it, and you need that history to diagnose a license loss. Use docker stop and docker start instead, which keep docker logs available.
Verify the License
The runtime takes a few seconds to report the licensing status:
# sleep 25 && docker logs codesys-runtime 2>&1 | grep -iE "Licenseserver|Runtime licensed|demo mode|No valid license"
The log must report Runtime licensed. The Licenseserver <address> written to config line shows the address that the startup script wrote, which confirms whether the runtime applied the -s option.
For a demo mode message, refer to the Runtime Stays in Demo Mode section.
Run One Runtime per License
The --list-content option reports License Quantity: 1 per product. Two CODESYS runtimes that consume the same product at the same time compete for one license, and one of them runs without it.
# docker ps --format '{{.Names}} {{.Image}}' | grep -i codesys
When more than one codesyscontrol container appears, confirm whether both are necessary.
A forgotten container still running takes the license and causes intermittent license loss for the runtime in use.
Validate Persistence across a Reboot
The point of this step is to check the full licensing chain status. Restart the device:
# sudo reboot
Reconnect and check the whole chain:
# systemctl status codemeter --no-pager
# systemctl status codemeter-logger --no-pager
# timedatectl
# sudo /opt/codemeter/cmu -x | grep -E "Serial Number|enabled|locked|Box Time"
# sudo /opt/codemeter/cmu --list-network --server 127.0.0.1
# docker logs codesys-runtime 2>&1 | grep -iE "Runtime licensed|demo mode" | tail -5
The device passes when both services start on their own and report active, the clock is synchronized, the license container reports (enabled) and not (locked), the network server answers, and the runtime reports Runtime licensed.
For a container that reports (locked) after boot, refer to the License Container Shows Locked section.
Installed File Layout
This procedure creates and configures the following files and directories:
/opt/codemeter/ # CodeMeter binaries and libraries
/opt/codemeter/cmu # wrapper that sets LD_LIBRARY_PATH
/etc/wibu/CodeMeter/Server.ini # daemon configuration
/etc/systemd/system/codemeter.service # daemon service
/etc/systemd/system/codemeter-logger.service # logger service
/etc/profile.d/codemeter.sh # PATH entry
/var/lib/CodeMeter/ # state and license, mode 700
/var/lib/CodeMeter/CmAct/ # CmActLicense container, files mode 600
/var/log/CodeMeter/ # logs, mode 700
Never delete /var/lib/CodeMeter. It holds the license, bound to this hardware. Deleting it invalidates the activation and may require a new ticket if the original ticket has already been consumed.
Best Practices with CodeMeter Licensing
Follow these rules to avoid the most common CodeMeter licensing issues:
- Permissions: keep state directories at mode
700and files at mode600, owned byroot:root. Never usechmod -R a+rwXor mode777. - Client: run
cmuthrough the wrapper instead of calling the CodeMeter binary directly. - Daemon: keep exactly one
CodeMeterLinprocess running. Confirm it withpgrepbefore any administrative operation. - Template: import the license template only once per device.
- Response file: import the
.WibuCmRaUresponse only once. Keep the file for the equipment records, but do not reimport it. - License state: never delete
/var/lib/CodeMeter. - System clock: synchronize the clock before activation, and keep the CodeMeter service ordered after
time-sync.targetfor subsequent boots. - CmAct files: stop the CodeMeter daemon before removing any CmAct files.
- Runtime container: do not use
--rm, and run only one runtime per license.
Limitations and Known Issues
- This procedure requires root access and runs on each device individually. For a fleet, put the files and the configuration into a custom image with TorizonCore Builder, which removes the need for root access on the customer side.
- CodeMeter binds each license to one device, so no golden image carries the license. Every module in the field runs the cycle described in Activate the CODESYS License.
- A module without a Real-Time Clock (RTC) depends on the network at boot, so that NTP synchronizes the clock before CodeMeter starts. Without it, CodeMeter starts with the wrong time and locks the license container. Ensure network connectivity at boot, or evaluate a battery-backed RTC on your carrier board.
ERROR 233during template import: the root cause on the first template import remains unidentified on two of the tested modules. Toradex ruled out differences in environment variables between the modules. If you hit it, refer to the Collect Diagnostics for Escalation section.- Root filesystem protection: this procedure writes to
/etc, which covers the systemd units,Server.ini, and thePATHentry. Torizon OS with rootfs protection enabled mounts/etcas an overlay that keeps the changes in memory and discards them on reboot, so this procedure targets a standard Torizon OS image.
Troubleshooting
This section catalogs the failures observed in the field, organized by symptom. If no symptom matches, or the fix does not hold, refer to the Collect Diagnostics for Escalation section.
Access Failed on Import While the Container List Works
Two known causes produce this symptom. Check them in this order.
-
Loose permissions on the license state: mode
777on/var/lib/CodeMeteror onCmAct, or mode666on the files, makes CodeMeter refuse to operate on the vault. It reportsAccess failedand says nothing about permissions. Repair them:# sudo ls -la /var/lib/CodeMeter/ /var/lib/CodeMeter/CmAct/
# sudo systemctl stop codemeter.service
# sudo chown -R root:root /var/lib/CodeMeter /var/log/CodeMeter
# sudo find /var/lib/CodeMeter /var/log/CodeMeter -type d -exec chmod 700 {} \;
# sudo find /var/lib/CodeMeter /var/log/CodeMeter -type f -exec chmod 600 {} \;
# sudo systemctl start codemeter.servicewarningMode
600on a directory removes the execute bit and makes its contents inaccessible. Directories take mode700and files take mode600. -
A client call that bypasses the wrapper: a direct call to the client binary loads an incompatible library, and administrative operations fail with
Access failed. Refer to the Access Failed on Every Operation section.
Access Failed on Every Operation
Check how the command calls the client. The following call bypasses LD_LIBRARY_PATH and fails:
# sudo /opt/codemeter/usr/bin/cmu --import --file <file>
The following call goes through the wrapper and succeeds:
# sudo /opt/codemeter/cmu --import --file <file>
The binary called directly loads a library from another location, and the incompatibility between the client and the daemon surfaces as Access failed. The --list option tolerates this mismatch, but --import does not. This difference in behavior indicates the problem.
For a missing wrapper, refer to the Create the CodeMeter Client Wrapper section. To identify the file, check its size: the wrapper is a shell script of approximately 125 bytes, while the cmu binary in /usr/bin is approximately 10 MB.
The License Container Shows Locked
The container moved from 4.50 (enabled) to 3.00 (locked), and the runtime dropped to demo mode.
The CmAct anti-rollback mechanism rejects the state. The clock is the most common cause: on a module without a Real-Time Clock (RTC), the daemon started before NTP synchronized, and the state carries an inconsistent time.
Check the clock, restart the daemon, and read the container state:
# timedatectl
# sudo systemctl restart codemeter.service
# sleep 10
# sudo /opt/codemeter/cmu -x | grep -E "Serial Number|enabled|locked|Box Time"
With a correct clock, the restart normally unlocks the container and returns it to 4.50 (enabled).
To prevent a repeat at every boot, confirm the service ordering:
# systemctl show codemeter -p After | tr ' ' '\n' | grep -E "time-sync|network-online"
# systemctl is-enabled systemd-time-wait-sync.service
For a missing time-sync.target in After, or a disabled systemd-time-wait-sync, refer to the Create the CodeMeter Service section.
Loose permissions also produce the (locked) state. When the clock is correct and the container still locks, refer to the Access Failed on Import While the Container List Works section.
Two CodeMeter Daemons Run at the Same Time
Count the daemon processes first:
# pgrep -a CodeMeterLin
More than one process means contention for the same state under /var/lib/CodeMeter, for port 22350, and for the lock file. Administrative operations then fail intermittently.
Common causes:
- An older CodeMeter installation in another path with its service still enabled
- A manually started
CodeMeterLin -xorCodeMeterLin -fprocess that stayed in the background - A Docker container that runs another CodeMeter instance
Identify the duplicate processes, services, or installations:
# systemctl list-units --all --type=service | grep -i codemeter
# systemctl list-unit-files | grep -i codemeter
# find / -xdev -iname 'CodeMeterLin' 2>/dev/null
# docker ps -a --format '{{.Names}} {{.Image}}' | grep -i codemeter
Disable the duplicate services and remove the orphaned installations. Then stop CodeMeter, kill what remains, clear the stale lock file, and start the service again:
# sudo systemctl stop codemeter.service
# pkill -9 CodeMeterLin
# sleep 2
# pgrep -a CodeMeterLin
# sudo rm -f /var/lock/cm_lock
# sudo systemctl start codemeter.service
The Daemon Consumes CPU and Grows in Memory
The symptoms are: memory over 20 MB, accumulated CPU time out of proportion to the uptime, and the following journal message:
[ERROR] EventNetworkClient: Overflow while buffering messages to be sent to CmLogger.
CodeMeter is buffering events for a logger that doesn't respond or doesn't exist. Start the codemeter-logger.service available in the Create the CmLogger Service section, then restart the daemon.
After the restart, the journal reports EventNetworkClient: Connection established.
Also confirm that the diagnostic options are configured to the default values, because a higher level generates more events and makes the problem worse:
# grep -E 'LogCmActDiag|DiagnoseLevel' /etc/wibu/CodeMeter/Server.ini
Error 233 on Import
ERROR 233 can be caused by different things, depending on the step at which the import fails. Identify your scenario before making any changes.
-
You reimported an applied response file: check whether an earlier import already succeeded. An import that reported successful followed by
skipped (update too old), and thenERROR 233on every later attempt, means the device already holds the license and its state is newer than the response file. A fix is not required in this case. Confirm the container state withcmu -xand move on. -
You imported into a locked container: CodeMeter does not apply an update to a locked container. Refer to the License Container Shows Locked section, clear the locked state, and retry the import.
-
You imported the template twice: a second template import returns
ERROR 233as well. Check whether the container already exists before you retry. -
The first template import fails with no container present: this scenario has no identified cause. Rule out the known ones before you escalate:
# timedatectl
# pgrep -a CodeMeterLin
# sudo ls -la /var/lib/CodeMeter/CmAct/
# sudo /opt/codemeter/cmu --version
# md5sum UFC-template.WibuCmLifAll of these must hold:
- The system clock is synchronized
- Exactly one
CodeMeterLinprocess runs - Directories use mode
700and files use mode600 - The CodeMeter client and daemon report the same version
- The template checksum matches the file extracted from the CODESYS package
If
ERROR 233persists after all of these checks, refer to the Collect Diagnostics for Escalation section.
Two Containers Exist and One Is Empty
A second template import creates an extra empty container. It consumes no license and blocks nothing, but it makes every later diagnostic harder to read.
List the CmAct files to identify both containers:
# sudo ls -la /var/lib/CodeMeter/CmAct/
Both files carry the 6000437_ prefix. Tell them apart by size rather than by name: the licensed container runs around 15 KB and the empty one around 2 KB.
Confirm the file size before deleting anything. Removing the larger file deletes the licensed container and requires a new activation, since the website has already consumed your ticket.
Stop the daemon, remove the empty container and the catalogue, then start the service again and read the remaining container with the following commands. Replace <empty-prefix> with the part of the smaller filename that follows 6000437_:
# sudo systemctl stop codemeter.service
# sleep 3
# pgrep -a CodeMeterLin
# sudo rm -f /var/lib/CodeMeter/CmAct/6000437_<empty-prefix>.*
# sudo rm -f /var/lib/CodeMeter/CmAct/Catalogue.WibuCmHt
# sudo ls -la /var/lib/CodeMeter/CmAct/
# sudo systemctl start codemeter.service
# sleep 10
# sudo /opt/codemeter/cmu -x | grep -E "Serial Number|enabled|empty"
CodeMeter rebuilds Catalogue.WibuCmHt when the daemon starts.
Remove container files only while the daemon is stopped. A running daemon rewrites the files from its in-memory state and brings the container back.
Files with a .+++ suffix are remnants of an interrupted operation, and the same procedure removes them.
The Runtime Stays in Demo Mode
CodeMeter reports the container as (enabled), and the runtime still runs in demo mode. Check the following causes in order.
-
The server address does not match the Docker network mode: bridge network mode does not work with
-s localhost, becauselocalhostrefers to the container itself rather than the host.# docker inspect codesys-runtime --format 'Net: {{.HostConfig.NetworkMode}} Args: {{.Args}}'
# docker logs codesys-runtime 2>&1 | grep -i LicenseserverA
NetofdefaultwithlocalhostinArgsis the failure. Recreate the container, following Host Network Mode, or Bridge Network Mode. -
Network server mode is disabled: verify that CodeMeter exposes the network server and responds locally:
# grep IsNetworkServer /etc/wibu/CodeMeter/Server.ini
# sudo /opt/codemeter/cmu --list-network --server 127.0.0.1IsNetworkServermust be1, and--list-networkmust answer with the device hostname. If either check fails, refer to the Enable Network Server Mode section. -
Two runtimes compete for the same license: two runtimes on the same licensed product leave one of them unlicensed. Refer to the Run One Runtime per License section.
-
Your ticket targets a different product: the
codesyscontrol_virtuallinuxarm64container runs CODESYS Virtual Control for Linux ARM64 SL. A license for CODESYS Control for Linux ARM64 SL is a different product with different product codes. CodeMeter then keeps the container(enabled)while the runtime stays in demo mode, which makes this the hardest case to spot.Compare the product on your ticket with the output of
cmu --list-content. If they do not match, no configuration change helps: CODESYS has to reissue the license for the correct product.The runtime message
No valid license found for the webvisualizationpoints at the same mismatch.
The Runtime Log Reports a Lost License
When the runtime loses access to the license, it generates a log similar to the following:
!!!! License lost - time left: 54 minutes
!!!! Follow up time will end around ...
To confirm whether the message is a licensing defect or not, compare the runtime log with the CodeMeter service history:
# grep -nE "License lost|Runtime licensed|demo mode" \
~/dockerMount/data/codesyscontrol/data/codesyscontrol/codesyscontrol.log | tail -30
# sudo journalctl -u codemeter.service --no-pager | grep -E "Stopped|Started" | tail -20
A Stopped entry for CodeMeter shortly before each License lost message explains it: the daemon restarted. That happens during maintenance, and the follow-up time is the expected grace period.
A License lost message with no matching restart needs closer inspection:
- Contention between runtimes. Refer to Run One Runtime per License.
- A locked license container. Refer to License Container Shows Locked.
- Wrong permissions on the license state. Refer to Access Failed on Import While the Container List Works.
Packaging Tools Are Not Available on the Device
Torizon OS is not a Debian distribution and ships no Debian packaging tools. This means dpkg-deb is not included in the available commands. To extract a package directly on the device, use a temporary Debian container:
# docker run --rm -v /var/rootdirs/home/torizon:/data -v ~/output:/out -w /data \
debian:stable-slim sh -c 'dpkg-deb -x <package>.deb /out'
Read-Only File System Errors
A Read-only file system error on a write to /usr means the protection is working. OSTree keeps /usr read-only at runtime, and sudo does not change that.
Install all runtime files under /opt, as described in this article. To include files under /usr, create a custom image with TorizonCore Builder.
The CodeMeter Client Command Is Not Found
Check the path to the binary you invoked. The wrapper lives at /opt/codemeter/cmu, and the client binary lives at /opt/codemeter/usr/bin/cmu. They are different files, and administrative operations go through the wrapper.
If /opt/codemeter/cmu does not exist, refer to the Create the CodeMeter Client Wrapper section.
Collect Diagnostics for Escalation
A case that goes to WIBU or CODESYS needs the full set of diagnostics. Collect everything in one pass before you open it:
# D=~/debug_logs && rm -rf $D && mkdir -p $D && cd $D
# sudo /opt/codemeter/cmu -vv > cmdust.txt 2>&1
# sudo /opt/codemeter/cmu -x > cmu-x.txt 2>&1
# sudo /opt/codemeter/cmu --list-content > cmu-list-content.txt 2>&1
# sudo /opt/codemeter/cmu --version > cmu-version.txt 2>&1
# sudo cp /etc/wibu/CodeMeter/Server.ini server-ini.txt
# sudo ls -la /var/lib/CodeMeter /var/lib/CodeMeter/CmAct > cmact-dir.txt 2>&1
# sudo journalctl -u codemeter.service --no-pager --since "5 days ago" > journal-codemeter.txt
# sudo find /var/log/CodeMeter /var/volatile/log/CodeMeter -iname '*CmActDiag*' \
-exec cp {} . \; 2>/dev/null
# docker logs codesys-runtime > log-runtime.txt 2>&1
# (timedatectl; uname -a; cat /proc/device-tree/model; \
cat /sys/devices/soc0/serial_number) > system-info.txt 2>&1
# sudo chown -R torizon:torizon $D
# cd ~ && tar -czf debug_logs.tar.gz debug_logs && ls -lh ~/debug_logs.tar.gz
The CmActDiagLog is an encrypted binary and only WIBU decodes it. Include it in the archive and do not try to read it.
Do not share the CmDust output of a device with third parties for comparison. It contains hardware identifiers and license state, and CodeMeter binds each license to one machine, so a comparison between dumps from different machines does not reveal the cause.