Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk4 min

Call systemd Varlink Methods Without Guessing Their Arguments

Use varlinkctl to identify a service endpoint, inspect its live interface and method signature, and build a call from the documented JSON arguments—not guesses.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use varlinkctl to inspect a Varlink service before calling it: identify how it is exposed, list its interfaces, inspect the relevant interface definition, then construct a call from the method signature. This avoids guessing socket paths, method names, or JSON arguments. The commands and options available depend on the installed systemd version, and documented socket paths are examples—not guarantees that a socket exists on your host.

What varlinkctl does

varlinkctl is a command-line client for getting information about Varlink services, discovering and inspecting interfaces, invoking methods, and validating interface definition files. The Debian trixie manual records the core commands as introduced in systemd 255; options and commands added later may not be available on an older installation. Check varlinkctl --version and the local varlinkctl man page before relying on a newer feature. Debian trixie varlinkctl(1) manual

As an Amazon Associate I earn from qualifying purchases.

How do I find a systemd Varlink socket?

First determine whether the service is reached through a local socket, a local executable, or an SSH-mediated endpoint. The manual accepts explicit service references as well as a socket or executable filesystem path directly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Address form Where and what it reaches Important detail
unix:/absolute/path/to/socket Local filesystem Unix socket The path must exist and be accessible on the host.
unix:@name Local abstract-namespace Unix socket Abstract sockets are not supported by the ssh-unix: mode.
exec:/absolute/path/to/program Local executable varlinkctl starts the program and passes it a connected stream socket.
ssh-unix:host:/absolute/path/to/socket Remote Unix socket over SSH The server requires OpenSSH 9.4 or newer; abstract-namespace sockets are unsupported.
ssh-exec:host:/path/to/command Remote program over SSH The program communicates using Varlink over standard input and output.

These are address syntaxes, not a list of sockets guaranteed to be installed by systemd. The service’s configuration and host setup determine whether a socket is present and which path it uses. If you have a candidate address from service documentation or local configuration, use it for discovery rather than assuming a path from another machine applies.

How do I inspect a Varlink interface?

Start with service metadata, then enumerate interfaces and inspect the interface you intend to use. The following sequence is the manual’s example for investigating systemd-resolved; the path and interface may not be present on your host:

varlinkctl info /run/systemd/resolve/io.systemd.Resolve
varlinkctl list-interfaces /run/systemd/resolve/io.systemd.Resolve
varlinkctl introspect /run/systemd/resolve/io.systemd.Resolve io.systemd.Resolve
  • info reports basic service metadata and its implemented interfaces.
  • list-interfaces lists the interfaces offered by the service.
  • introspect displays an interface definition, including its methods and signatures.

Use the interface definition to establish the fully qualified method name and the required argument fields before you prepare a call. list-methods is another discovery command, but the cited manual marks it as added in systemd 257, so it may be unavailable on older systems. Command descriptions and version notes

How do I call a Varlink method with JSON?

Pass the service address, fully qualified method name, and a JSON argument object. This is the executable example from the manual, not a command verified on your machine:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
varlinkctl call /usr/lib/systemd/systemd-pcrextend 
  io.systemd.PCRExtend.Extend 
  '{"pcr":15,"text":"foobar"}'

In this example, io.systemd.PCRExtend.Extend is the method and the final argument is the JSON object supplied to it. Omit the JSON argument on the command line to have varlinkctl read it from standard input. Use {} for a method with no parameters. Reply parameters are written as JSON to standard output. Always match the argument object to the signature shown by introspection; a syntactically valid JSON object can still have the wrong fields or values for a method.

How should I handle methods that return multiple replies?

Choose output handling based on what the method does and what will consume its replies. The manual documents these options for methods that support multiple replies:

Option Output behavior Use when
--more Sets the Varlink more flag and writes replies as JSON-SEQ, separating individual replies. You need to process a reply stream rather than wait for one collected result. The manual marks this option as added in systemd 255.
--collect Collects replies into a JSON array. Your consumer expects one array containing the replies. The manual marks this option as added in systemd 256.

The manual documents a default call timeout of 45 seconds. For a continuous update stream, it says an infinite timeout is typically desirable; an enumeration expected to finish quickly can instead benefit from a finite timeout. Set a timeout deliberately where needed, for example with --timeout=infinity for a continuing stream. These settings do not make a single-reply method into a streaming method: the method’s semantics must support the behavior. Streaming and timeout options

Can varlinkctl validate an interface definition?

Yes. varlinkctl validate-idl [FILE] parses and checks a Varlink interface definition for syntax and internal consistency. If you omit the file, it reads the definition from standard input. Treat this as a check of the local definition file: it does not establish that a running service implements the same definition, authorize a caller, or certify that invoking a method is safe.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What can a systemd service’s Varlink API expose?

systemd-nsresourced illustrates why inspecting the live interface matters: its documentation says it exposes io.systemd.NamespaceResource over Varlink for registering user namespaces and assigning mounts, cgroups, and network interfaces. That documentation does not establish a socket address or a method-call command for the API, so neither should be inferred from the interface name. Inspect the service’s available interface definition on the host before constructing a call. systemd-nsresourced.service(8) manual

Best Value
Sale
UNIX and Linux System Administration Handbook, 4th Edition
  • New
  • Mint Condition
  • Dispatch same day for order received before 12 noon
  • Guaranteed packaging
  • No quibbles returns

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.