Skip to content

About

Common TwinCAT TcPkg Commands

Resources

Stars

20 stars

Watchers

1 watching

Forks

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Common TwinCAT TcPkg Commands

Disclaimer

This is a personal guide not a peer reviewed journal or a sponsored publication. We make no representations as to accuracy, completeness, correctness, suitability, or validity of any information and will not be liable for any errors, omissions, or delays in this information or any losses injuries, or damages arising from its display or use. All information is provided on an as is basis. It is the reader’s responsibility to verify their own facts.

The views and opinions expressed in this guide are those of the authors and do not necessarily reflect the official policy or position of any other agency, organization, employer or company. Assumptions made in the analysis are not reflective of the position of any entity other than the author(s) and, since we are critically thinking human beings, these views are always subject to change, revision, and rethinking at any time. Please do not hold us to them in perpetuity.

Further commands can be found here

Troubleshooting

Check of consistancy

tcpkg check -c

Repair inconsistancy

tcpkg repair --all-dependencies

Installation

Full Migration installation of 4026.x using only CLI

⚠️
In most instances the migration of an IPC is possible using the TwinCAT.XAE.MigrateCli. If however this fails then look to re-image the IPC with an OS already configured for 4026. If this is not available, then a fresh install using a blank OS is prefered.
################################
#                              #
#  Read the full instructions  #
#    first before starting     #
#                              #
################################

## Install the package manager from the main beckhoff website.

## Follow the instructions below using a CMD window
## with admin rights.

## Add the source replacing YOUR_EMAIL_ADDRESS with your actual myBeckhoff email address.  After pressing enter you will be prompted to enter your password
tcpkg source add -n Stable -s "https://public.tcpkg.beckhoff-cloud.com/api/v1/feeds/stable/" --priority=1 -u "YOUR_EMAIL_ADDRESS"

## Install the migrate tool
tcpkg install TwinCAT.XAE.MigrateCli

################################
#                              #
#    Now close and reopen      #
#         cmd as admin         #
#                              #
################################

## progress with the upgrade
TcMigrateCmd upgrade --whatIf False

Offline installation of 4026 (i.e. no internet connection)

Notes can be found here...


Uninstallation

Full Uninstallation of 4026.x

tcpkg uninstall all

Full Uninstallation of 4024.x

You must first install the migrate tool, then use this to clean the installation. You may need to restart your PC after the first step.

################################
#                              #
#  Read the full instructions  #
#    first before starting     #
#                              #
################################

## Install the package manager from the main beckhoff website.

## Once installed, do not open the package manager from the UI.
## Instead follow the instructions below using a CMD window
## with admin rights.

## Add the source replacing YOUR_EMAIL_ADDRESS with your actual myBeckhoff email address.  After pressing enter you will be prompted to enter your password
tcpkg source add -n Stable -s "https://public.tcpkg.beckhoff-cloud.com/api/v1/feeds/stable/" --priority=1 -u "YOUR_EMAIL_ADDRESS"

## Install the migrate tool
tcpkg install TwinCAT.XAE.MigrateCli

################################
#                              #
#    Now close and reopen      #
#         cmd as admin         #
#                              #
################################

## progress with the uninstall
TcMigrateCmd.exe clean --whatIf False

## once done, you can restart your pc and uninstall the package manager using add/remove programs

Working with sources

List all configured sources

tcpkg source list

Verify the stable source is available

tcpkg source verify "Beckhoff Stable Feed"

Typical Sources

# "Beckhoff Stable Feed" | all current packages and workloads
tcpkg source add -n Stable -s "https://public.tcpkg.beckhoff-cloud.com/api/v1/feeds/stable/" --priority=1 -u "YOUR_EMAIL_ADDRESS"

# "Beckhoff Outdated Feed" | all outdated versions
tcpkg source add -n Outdated -s "https://public.tcpkg.beckhoff-cloud.com/api/v1/feeds/outdated/" --priority=2 -u "YOUR_EMAIL_ADDRESS"

# "Beckhoff Testing Feed" | Soon to be released packages and workloads (i.e. Beta versions).
tcpkg source add -n Testing -s "https://public.tcpkg.beckhoff-cloud.com/api/v1/feeds/testing/" --priority=3 -u "YOUR_EMAIL_ADDRESS"

# "Beckhoff Preview Feed" | Feature testing feed - Packages that aren’t planned to auto-release like in the Testing feed. (i.e. Preview Beta versions).
tcpkg source add -n Preview -s "https://public.tcpkg.beckhoff-cloud.com/api/v1/feeds/preview/" --priority=4 -u "YOUR_EMAIL_ADDRESS"

Working with packages and workloads: Installing, upgrading, and uninstalling

List all installed packages and workloads

tcpkg list -i

List all installed workloads

tcpkg list -i -t workload

List all of the available workloads of the feeds

tcpkg list -t workload

Install a package with a specific version

tcpkg install TwinCAT.XAE.PLC=3.6.16

Install a package without user intervention

Add the -y flag. Can be mixed with other installation options.

tcpkg install TwinCAT.XAE.PLC -y

Listing dependency of a package

tcpkg resolve TwinCAT.Standard.Xae=4026.14 --dependency-tree

Repairing a package

tcpkg repair twincat.xae.plc

Repairing a workload

tcpkg repair twincat.standard.xae --include-dependencies

Downgrading a package

tcpkg upgrade twincat.standard.xae=4026.13.0 --allow-downgrade

Tcpkg Configuration

Set Visual Studio integration

# Enable a specific Visual Studio or TcXaeShell integration
tcpkg config set -n useVS2022
tcpkg config set -n useTcXaeShell64

ℹ️ After setting, you must install the corresponding integration:

tcpkg install vs2022.ext

Remove Visual Studio integration

# Disable a specific Visual Studio or TcXaeShell integration
tcpkg config unset -n useVS2022
tcpkg config unset -n useTcXaeShell64

ℹ️ After unsetting, you must uninstall the corresponding integration:

tcpkg uninstall vs2022.ext

View current configuration

tcpkg config list

Example output:

UseVS2017: Not configured
UseVS2019: Not configured
UseVS2022: Using instance b0979586
UseVS2026: Not configured
UseTcXaeShell: True
UseTcXaeShell64: True
VerifySignatures: True
TcPkgVersionOutput: True
TrackInstalledFiles: False
LogLevel: Information
XarMode: KM
DefaultTake: 500
Proxy: Not configured

Fault finding

Use the log file as a primary tool of fault finding. Logs can be found here: %programdata%\Beckhoff\TcPkg\logs.

GUI %localappdata%\Beckhoff\TwinCAT.Package.Manager.GUI\logs

If you are looking to fault find TwinCAT.XAE.MigrateCli, then note, the log files for this are stored here: %programdata%\Beckhoff\TcMigrateCmd.


Remote control

TcPkg supports controlling a remote instance of TcPkg over SSH, allowing you to relay both commands and package downloads to a connected IPC. This is especially useful when the IPC does not have internet access, but your engineering laptop does.

An installation of Package Manager must exist on the remote IPC and be compatible with the version being used on the engineering side.

remote

Setup our Engineering TcPkg

In the examples below, we’ll refer to the remote IPC as MyIpc. You can choose any name you like, and register as many remotes as needed.

# replace 169.254.165.127 with your ipc's ip address
# the --internet-access false will use your engineering computer's internet and feeds for obtaining packages.
tcpkg remote add -n MyIpc --host 169.254.165.127 --port 22 -u Administrator --internet-access false

When prompted, enter the Administrator password and accept the SSH fingerprint.

The details of a remote IPC connection are added to the main TcPkg configuration file appsettings.json, found in %programdata%\Beckhoff\TcPkg.

e.g.:

"RemoteTargets": {
    "MyIPC": {
      "Host": "169.254.165.127",
      "Port": 22,
      "User": "Administrator",
      "UserPassword": <encrypted>,
      "InternetAccess": false,
      "SHA256Fingerprint": <encrypted>,
      "PrivateKeyFile": "",
      "Passphrase": ""
    }

To list configured remote connections:

tcpkg remote list

To edit a configured remote connection:

tcpkg remote edit <name> [options]

Installing a Package on the Remote IPC

Once your remote IPC (MyIpc) is registered, you can install TwinCAT packages directly to it using:

tcpkg install TF8020.BACnet.XAR -r MyIpc

What this does:

  • Connects to the IPC over SSH.
  • Downloads all required packages using the engineering laptop’s internet connection.
  • Transfers the packages to the IPC.
  • Installs them on the IPC via its local TcPkg.

You’ll be prompted to confirm before installation begins:

Continue? (Y/N): Y

Expected output:

Package(s) installed:
TF8020.BACnet.XAR 1.0.4
TwinCAT.XAR.BACnet 2.1.6

Troubleshooting a remote connection

TcPkg uses SSH to remote control the second instance. If you are unable to add a remote, then check the following.

Check SSH Access via Command Prompt

Open Command Prompt and run:

# Replace 169.254.165.127 with your target’s IP address.
ssh Administrator@169.254.165.127

You’ll be prompted for the Administrator password.

Connection Errors

The default password for a Beckhoff IPC is too small to be used for SSH. Therefore you must change your IPC's password first to something secure.

If your password is too short, you will be told Permission denied, please try again. and The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.


Package Manager Trouble Shooting

Error: '0x00' is an invalid start of a value. Path: $ | LineNumber : 0 | BytePositionInLin : 0.

Can also result in: Upgrade of TcPkg packages failed. ExitCode: 574.

  • Delete %localappdata%\Beckhoff\TwinCAT.Package.Manager.GUI\TcPkgUiSettings.json
  • Delete %programdata%\Beckhoff\TcPkg\lookupcache.json
  • Restart

Package Management Command Comparison

Here is a comparison of the TwinCAT Package Manager ( tcpkg ) commands alongside their equivalents in FreeBSD ( pkg ) and Debian-based Linux systems ( apt ).

Source: infosys.beckhoff.com

Function TwinCAT (tcpkg) FreeBSD (pkg) Debian (apt)
List all available packages tcpkg list pkg search apt list
List all versions of a package tcpkg list -a [PackageName] pkg search -o [PackageName] apt list -a [PackageName]
List installed packages tcpkg list -i pkg info apt list --installed
List upgradable packages tcpkg list -o pkg version -v | grep '<' apt list --upgradable
Show package details tcpkg show [PackageName] pkg info [PackageName] apt show [PackageName]
Install a package tcpkg install [PackageName] pkg install [PackageName] apt install [PackageName]
Install specific version tcpkg install [PackageName]=[Version] Not directly supported; use Ports or specify version if available apt install [PackageName]=[Version]
Upgrade a package tcpkg upgrade [PackageName] pkg upgrade [PackageName] apt install --only-upgrade [PackageName]
Upgrade all packages tcpkg upgrade all pkg upgrade apt upgrade
Uninstall a package tcpkg uninstall [PackageName] pkg delete [PackageName] apt remove [PackageName]
Uninstall with dependencies tcpkg uninstall [PackageName] --include-dependencies pkg delete -R [PackageName] apt autoremove [PackageName]
Add a package source/feed tcpkg source add --n=[Name] --s=[URL] --priority=[Value] pkg repo (edit /etc/pkg/FreeBSD.conf) Add entry to /etc/apt/sources.list or .list.d/ file
Edit a package source/feed tcpkg source edit [Name] --priority=[NewValue] Edit /etc/pkg/FreeBSD.conf manually Edit corresponding .list file in /etc/apt/sources.list.d/
Enable/disable a package source tcpkg source edit [Name] --enabled true/false Edit /etc/pkg/FreeBSD.conf manually Use apt-add-repository or comment out entries in .list
Set configuration options tcpkg config set -n [Option] Not applicable Not applicable
Unset configuration options tcpkg config unset -n [Option] Not applicable Not applicable
Details
  • FreeBSD (pkg): Installing specific versions is not directly supported; use the Ports Collection or specify version if available.
  • Debian (apt): Specific versions can be installed with apt install [Package]=[Version] , if that version exists in your enabled repositories.
  • Package Sources/Feeds: Managing package sources in FreeBSD and Debian typically requires editing config files manually. Debian provides helper tools like add-apt-repository to ease the process.

About

Common TwinCAT TcPkg Commands

Resources

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors