swtpm_ioctl(8)
πΈ NAME πΈ
okay so bestie, welcome to swtpm_ioctl (manual section 8, she's fancy) β it's literally the utility for sending control commands to swtpm π«Ά
β¨ SYNOPSIS β¨
swtpm_ioctl [COMMAND] [<device>]
π DESCRIPTION π
So swtpm_ioctl is a whole client tool for controlling the swtpm_cuse and swtpm TPM software emulators β like, the actual management of them: initialization, shutdown, all that β¨. Once the TPM has been initialized, you can send TPM commands to it. Main character energy, honestly.
π heads up, bestie: you can set the environment variableSWTPM_IOCTL_BUFFERSIZEto the size of the buffer used for state blob transfer. If it's not set, theioctl()interface gets used for transferring the state. This env var is primarily used for testing purposes β iykyk π
The following commands are supported:
π¦ Pick your device / connection first π¦
--tpm-devicedevice β use the given device. You gotta give the full path to the character device, like for example/dev/vtpm-200. This option can be used instead of providing the device as the last parameter π--tcpserver:port β connect to the given server and port; if no server is given,127.0.0.1is used; if port is not given, the default port6545is used π--unixpath β connect to the given UnixIO path π¦
π The actual commands π
-cβ get the capability flags indicating which commands are supported π-iβ send a hardware initialization signal to theswtpm_cuse/swtpm. Volatile state previously written by the TPM will be read and the file automatically delete π (yes, that's what it does, don't @ me)-sβ initiate a graceful shut down π«Ά--stopβ stop theswtpm_cuse/swtpm. Note that this does not shut it down! The-icommand can again be sent to it. After a stop it's also possible to load TPM stateblobs into the TPM using the--loadcommand β¨-eβ get thetpmEstablishedbit β-rlocality β reset thetpmEstablishedbit using the given locality. Only localities 3 and 4 work. This operation will not permanently change the locality that was previously set using the-loption π-llocality β set the locality for the subsequent TPM commands π-vβ have the TPM write the volatile state to a file. Upon aTPM_Init(-i) the TPM state will be read and the TPM can then resume operation without further initialization π₯-Cβ cancel an ongoing TPM command, bye π-hdata β reset and extend PCR 17 with the hash of the given data. If data is the single character'-', then all data are read from stdin π--saveTPM state blob name filename β save the TPM state blob into the given file. Valid TPM state blob names are'permanent','volatile', and'savestate'π
π§ note that this command can be executed at any time. However, to retrieve the latest volatile state, the-vcommand should have been run immediately before running this command. Thesavestateblob will only be returned if aTPM_SaveStatecommand was executed in the TPM (TPM 1.2).
--loadTPM state blob name filename β load the given TPM state blob from the given file. Valid TPM state blob names are'permanent','volatile', and'savestate'π
π note that this command can only be executed on a TPM that is shut down. To then start the TPM with the uploaded state, the -i command must be issued.
-gβ get configuration flags that for example indicate which keys (file encryption or migration key) are in use by the TPM π--infoflags β get information about the TPM implementation and its configuration in JSON format π. The following values can be provided. All of the values can be or'ed (or added) together to get information about all of them in one query:0x1: information about the specification the TPM implementation followed0x2: information about the manufacturer, model and version of the TPM0x4: lists supported RSA and Camellia key sizes0x8: describes supported and enabled algorithms0x10: describes supported and enabled commands0x20: describes the active profile0x40: lists all built-in profiles0x80: describes supported attributes
--lock-storageretries β lock the storage and retry a given number of times with10msdelay in between. Locking the storage may be necessary to do after the state of the TPM has been migrated out and the lock on the storage has been released when the'savestate'blob was received and now the storage should be locked again π
π EXAMPLE π
Start swtpm on port 10000 for the control port and emulate a TPM 1.2 β slay:
#> swtpm socket --tpmstate dir=/tmp/myvtpm1 --log level=4 --ctrl type=tcp,port=10000 --server type=tcp,port=10001 --flags not-need-init
Get information about the TPM implementation in JSON π¦:
#> swtpm_ioctl --tcp :10000 --info 1
{"TPMSpecification":{"family":"1.2","level":2,"revision":116}}
#> swtpm_ioctl --tcp :10000 --info 2
{"TPMAttributes":{"manufacturer":"id:00001014","version":"id:00740001","model":"swtpm"}}
Shut down the swtpm, bye bestie π:
#> swtpm_ioctl --tcp :10000 -s
π SEE ALSO π
swtpm_cuse β go read that one too, fr fr π
that's the whole page, bestie π
this cutie came from swtpm (source/version), dated 2026-08-23, and it lives in manual section swtpm_ioctl(8) β periodt πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: swtpm 0.10.2-160000.1.1 Β· BSD-3-Clause
- opensuse-leap 16.0: swtpm 0.10.2-160000.1.1 Β· BSD-3-Clause
- opensuse-leap 16.0: swtpm 0.10.2-160000.1.1 Β· BSD-3-Clause
- opensuse-leap 16.0: swtpm 0.10.2-160000.1.1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms