2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" >
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id=
"org.freedesktop.portable1" conditional='ENABLE_PORTABLED'
7 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
9 <title>org.freedesktop.portable1
</title>
10 <productname>systemd
</productname>
14 <refentrytitle>org.freedesktop.portable1
</refentrytitle>
15 <manvolnum>5</manvolnum>
19 <refname>org.freedesktop.portable1
</refname>
20 <refpurpose>The D-Bus interface of systemd-portabled
</refpurpose>
24 <title>Introduction
</title>
27 <citerefentry><refentrytitle>systemd-portabled.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
28 is a system service that may be used to attach, detach and inspect portable services. This page describes the
29 D-Bus interface.
</para>
33 <title>The Manager Object
</title>
35 <para>The service exposes the following interfaces on the Manager object on the bus:
</para>
37 <programlisting executable=
"systemd-portabled" node=
"/org/freedesktop/portable1" interface=
"org.freedesktop.portable1.Manager">
38 node /org/freedesktop/portable1 {
39 interface org.freedesktop.portable1.Manager {
43 ListImages(out a(ssbtttso) images);
44 GetImageOSRelease(in s image,
45 out a{ss} os_release);
46 GetImageMetadata(in s image,
51 GetImageMetadataWithExtensions(in s image,
57 out a{say} extensions,
59 GetImageState(in s image,
61 GetImageStateWithExtensions(in s image,
65 AttachImage(in s image,
71 AttachImageWithExtensions(in s image,
78 DetachImage(in s image,
81 DetachImageWithExtensions(in s image,
85 ReattachImage(in s image,
90 out a(sss) changes_removed,
91 out a(sss) changes_updated);
92 ReattachImageWithExtensions(in s image,
98 out a(sss) changes_removed,
99 out a(sss) changes_updated);
100 RemoveImage(in s image);
101 MarkImageReadOnly(in s image,
103 SetImageLimit(in s image,
105 SetPoolLimit(in t limit);
107 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
108 readonly s PoolPath = '...';
109 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
110 readonly t PoolUsage = ...;
111 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
112 readonly t PoolLimit = ...;
113 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
114 readonly as Profiles = ['...', ...];
116 interface org.freedesktop.DBus.Peer { ... };
117 interface org.freedesktop.DBus.Introspectable { ... };
118 interface org.freedesktop.DBus.Properties { ... };
122 <!--Autogenerated cross-references for systemd.directives, do not edit-->
124 <variablelist class=
"dbus-interface" generated=
"True" extra-ref=
"org.freedesktop.portable1.Manager"/>
126 <variablelist class=
"dbus-interface" generated=
"True" extra-ref=
"org.freedesktop.portable1.Manager"/>
128 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetImage()"/>
130 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"ListImages()"/>
132 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetImageOSRelease()"/>
134 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetImageMetadata()"/>
136 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetImageMetadataWithExtensions()"/>
138 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetImageState()"/>
140 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetImageStateWithExtensions()"/>
142 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"AttachImage()"/>
144 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"AttachImageWithExtensions()"/>
146 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"DetachImage()"/>
148 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"DetachImageWithExtensions()"/>
150 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"ReattachImage()"/>
152 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"ReattachImageWithExtensions()"/>
154 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"RemoveImage()"/>
156 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"MarkImageReadOnly()"/>
158 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"SetImageLimit()"/>
160 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"SetPoolLimit()"/>
162 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"PoolPath"/>
164 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"PoolUsage"/>
166 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"PoolLimit"/>
168 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"Profiles"/>
170 <!--End of Autogenerated section-->
173 <title>Methods
</title>
175 <para><function>GetImage()
</function> may be used to get the image object path of the image with the
176 specified name.
</para>
178 <para><function>ListImages()
</function> returns an array of all currently known images. The
179 structures in the array consist of the following fields: image name, type, read-only flag, creation
180 time, modification time, current disk space, usage and image object path.
</para>
182 <para><function>GetImageOSRelease()
</function> retrieves the OS release information of an image.
183 This method returns an array of key value pairs read from the
184 <citerefentry><refentrytitle>os-release
</refentrytitle><manvolnum>5</manvolnum></citerefentry> file in
185 the image and is useful to identify the operating system used in a portable service.
</para>
187 <para><function>GetImageMetadata()
</function> retrieves metadata associated with an image.
188 This method returns the image name, the image's
<citerefentry><refentrytitle>os-release
</refentrytitle>
189 <manvolnum>5</manvolnum></citerefentry> content in the form of a (streamable) array of bytes,
190 and a list of portable units contained in the image, in the form of a string (unit name) and
191 an array of bytes with the content.
</para>
193 <para><function>GetImageMetadataWithExtensions()
</function> retrieves metadata associated with an
194 image. This method is a superset of
<function>GetImageMetadata()
</function> with the addition of a list
195 of extensions as input parameter, which were overlaid on top of the main image via
196 <function>AttachImageWithExtensions()
</function>. The path of each extension and an array of bytes with
197 the content of the respective extension-release file are returned, one such structure for each
198 extension named in the input arguments.
</para>
200 <para><function>GetImageState()
</function> retrieves the image state as one of the following
203 <listitem><para>detached
</para></listitem>
205 <listitem><para>attached
</para></listitem>
207 <listitem><para>attached-runtime
</para></listitem>
209 <listitem><para>enabled
</para></listitem>
211 <listitem><para>enabled-runtime
</para></listitem>
213 <listitem><para>running
</para></listitem>
215 <listitem><para>running-runtime
</para></listitem>
216 </itemizedlist></para>
218 <para><function>GetImageStateWithExtensions()
</function> is a superset of
219 <function>GetImageState()
</function>, with additional support for a list of extensions
220 as input parameters, which is necessary to query the state in case the image was attached
221 in that particular way. The
<varname>flag
</varname> parameter is currently unused and
222 reserved for future purposes.
</para>
224 <para><function>AttachImage()
</function> attaches a portable image to the system.
225 This method takes an image path or name, a list of strings that will be used to search for
226 unit files inside the image (partial or complete matches), a string indicating which
227 portable profile to use for the image (see
<varname>Profiles
</varname> property for
228 a list of available profiles), a boolean indicating whether to attach the image only
229 for the current boot session, and a string representing the preferred copy mode
230 (whether to copy the image or to just symlink it) with the following possible values:
232 <listitem><para>(empty)
</para></listitem>
234 <listitem><para>copy
</para></listitem>
236 <listitem><para>symlink
</para></listitem>
238 <listitem><para>mixed
</para></listitem>
240 If an empty string is passed the security profile drop-ins and images will be symlinked while unit
241 files will be copied,
<varname>copy
</varname> will copy,
<varname>symlink
</varname> will prefer
242 linking if possible (e.g.: a unit has to be copied out of an image), and
<varname>mixed
</varname> will
243 prefer linking the resources owned by the OS (e.g.: the portable profile located within the host's
244 /usr/ tree) but will copy the resources owned by the portable image (e.g.: the unit files and the
245 images). This method returns the list of changes applied to the system (for example, which unit was
246 added and is now available as a system service). Each change is represented as a triplet of strings:
247 the type of change applied, the path on which it was applied, and the source (if any). The type of
248 change applied will be one of the following possible values:
250 <listitem><para>copy
</para></listitem>
252 <listitem><para>symlink
</para></listitem>
254 <listitem><para>write
</para></listitem>
256 <listitem><para>mkdir
</para></listitem>
258 Note that an image cannot be attached if a unit that it contains is already present
259 on the system. Note that this method returns only after all the listed operations are completed,
260 and due to the I/O involved it might take some time.
</para>
262 <para><function>AttachImageWithExtensions()
</function> attaches a portable image to the system.
263 This method is a superset of
<function>AttachImage()
</function> with the addition of
264 a list of extensions as input parameter, which will be overlaid on top of the main
265 image. When this method is used, detaching must be done by passing the same arguments via the
266 <function>DetachImageWithExtensions()
</function> method. For more details on this functionality,
267 see the
<varname>MountImages=
</varname> entry on
268 <citerefentry><refentrytitle>systemd.exec
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
269 and
<citerefentry><refentrytitle>systemd-sysext
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
272 <para><function>DetachImage()
</function> detaches a portable image from the system.
273 This method takes an image path or name, and a boolean indicating whether the image to
274 detach was attached only for the current boot session or persistently. This method
275 returns the list of changes applied to the system (for example, which unit was removed
276 and is no longer available as a system service). Each change is represented as a triplet of
277 strings: the type of change applied, the path on which it was applied, and the source
278 (if any). The type of change applied will be one of the following possible values:
280 <listitem><para>unlink
</para></listitem>
282 Note that an image cannot be detached if a unit that it contains is running. Note that this method
283 returns only after all the listed operations are completed, and due to the I/O involved it might take
286 <para><function>DetachImageWithExtensions()
</function> detaches a portable image from the system.
287 This method is a superset of
<function>DetachImage()
</function> with the addition of
288 a list of extensions as input parameter, which were overlaid on top of the main
289 image via
<function>AttachImageWithExtensions()
</function>.
</para>
291 <para><function>ReattachImage()
</function> combines the effects of the
292 <function>AttachImage()
</function> method and the
<function>DetachImage()
</function> method.
293 The difference is that it is allowed to reattach an image while one or more of its units
294 are running. The reattach operation will fail if no matching image is attached.
295 The input parameters match the
<function>AttachImage()
</function> method, and the return
296 parameters are the combination of the return parameters of the
297 <function>DetachImage()
</function> method (first array, units that were removed) and the
298 <function>AttachImage()
</function> method (second array, units that were updated or added).
</para>
300 <para><function>ReattachImageWithExtensions()
</function> reattaches a portable image to the system.
301 This method is a superset of
<function>ReattachImage()
</function> with the addition of
302 a list of extensions as input parameter, which will be overlaid on top of the main
303 image. For more details on this functionality, see the
<varname>MountImages=
</varname> entry on
304 <citerefentry><refentrytitle>systemd.exec
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
305 and
<citerefentry><refentrytitle>systemd-sysext
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
308 <para><function>RemoveImage()
</function> removes the image with the specified name.
</para>
310 <para><function>MarkImageReadOnly()
</function> toggles the read-only flag of an image.
</para>
312 <para><function>SetPoolLimit()
</function> sets an overall quota limit on the pool of images.
</para>
314 <para><function>SetImageLimit()
</function> sets a per-image quota limit.
</para>
316 <para>The
<function>AttachImageWithExtensions()
</function>,
317 <function>DetachImageWithExtensions()
</function> and
318 <function>ReattachImageWithExtensions()
</function> methods take in options as flags instead of
319 booleans to allow for extendability.
<varname>SD_SYSTEMD_PORTABLE_FORCE_ATTACH
</varname> will bypass
320 the safety checks that ensure the units are not running while the image is attached or detached.
321 <varname>SD_SYSTEMD_PORTABLE_FORCE_EXTENSION
</varname> will bypass the check that ensures the
322 <filename>extension-release.
<replaceable>NAME
</replaceable></filename> file in the extension image
323 matches the image name. They are defined as follows:
</para>
326 #define SD_SYSTEMD_PORTABLE_RUNTIME (UINT64_C(
1)
<< 0)
327 #define SD_SYSTEMD_PORTABLE_FORCE_ATTACH (UINT64_C(
1)
<< 1)
328 #define SD_SYSTEMD_PORTABLE_FORCE_EXTENSION (UINT64_C(
1)
<< 2)
333 <title>Properties
</title>
335 <para><varname>PoolPath
</varname> specifies the file system path where images are written to.
</para>
337 <para><varname>PoolUsage
</varname> specifies the current usage size of the image pool in bytes.
</para>
339 <para><varname>PoolLimit
</varname> specifies the size limit of the image pool in bytes.
</para>
341 <para><varname>Profiles
</varname> specifies the available runtime profiles for portable services.
</para>
346 <title>The Image Object
</title>
348 <para>The service exposes the following interfaces on the Image object on the bus:
</para>
350 <programlisting executable=
"systemd-portabled" node=
"/org/freedesktop/portable1" interface=
"org.freedesktop.portable1.Image">
351 node /org/freedesktop/portable1 {
352 interface org.freedesktop.portable1.Image {
354 GetOSRelease(out a{ss} os_release);
355 GetMetadata(in as matches,
359 GetMetadataWithExtensions(in as extensions,
364 out a{say} extensions,
366 GetState(out s state);
367 GetStateWithExtensions(in as extensions,
370 Attach(in as matches,
375 AttachWithExtensions(in as extensions,
383 DetachWithExtensions(in as extensions,
386 Reattach(in as matches,
390 out a(sss) changes_removed,
391 out a(sss) changes_updated);
392 ReattachWithExtensions(in as extensions,
397 out a(sss) changes_removed,
398 out a(sss) changes_updated);
400 MarkReadOnly(in b read_only);
401 SetLimit(in t limit);
403 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
404 readonly s Name = '...';
405 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
406 readonly s Path = '...';
407 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
408 readonly s Type = '...';
409 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
410 readonly b ReadOnly = ...;
411 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
412 readonly t CreationTimestamp = ...;
413 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
414 readonly t ModificationTimestamp = ...;
415 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
416 readonly t Usage = ...;
417 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
418 readonly t Limit = ...;
419 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
420 readonly t UsageExclusive = ...;
421 @org.freedesktop.DBus.Property.EmitsChangedSignal(
"false")
422 readonly t LimitExclusive = ...;
424 interface org.freedesktop.DBus.Peer { ... };
425 interface org.freedesktop.DBus.Introspectable { ... };
426 interface org.freedesktop.DBus.Properties { ... };
430 <!--method GetOSRelease is not documented!-->
432 <!--method GetMetadata is not documented!-->
434 <!--method GetMetadataWithExtensions is not documented!-->
436 <!--method GetState is not documented!-->
438 <!--method GetStateWithExtensions is not documented!-->
440 <!--method Attach is not documented!-->
442 <!--method AttachWithExtensions is not documented!-->
444 <!--method Detach is not documented!-->
446 <!--method DetachWithExtensions is not documented!-->
448 <!--method Reattach is not documented!-->
450 <!--method ReattachWithExtensions is not documented!-->
452 <!--method Remove is not documented!-->
454 <!--method MarkReadOnly is not documented!-->
456 <!--method SetLimit is not documented!-->
458 <!--Autogenerated cross-references for systemd.directives, do not edit-->
460 <variablelist class=
"dbus-interface" generated=
"True" extra-ref=
"org.freedesktop.portable1.Image"/>
462 <variablelist class=
"dbus-interface" generated=
"True" extra-ref=
"org.freedesktop.portable1.Image"/>
464 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetOSRelease()"/>
466 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetMetadata()"/>
468 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetMetadataWithExtensions()"/>
470 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetState()"/>
472 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"GetStateWithExtensions()"/>
474 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"Attach()"/>
476 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"AttachWithExtensions()"/>
478 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"Detach()"/>
480 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"DetachWithExtensions()"/>
482 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"Reattach()"/>
484 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"ReattachWithExtensions()"/>
486 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"Remove()"/>
488 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"MarkReadOnly()"/>
490 <variablelist class=
"dbus-method" generated=
"True" extra-ref=
"SetLimit()"/>
492 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"Name"/>
494 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"Path"/>
496 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"Type"/>
498 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"ReadOnly"/>
500 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"CreationTimestamp"/>
502 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"ModificationTimestamp"/>
504 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"Usage"/>
506 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"Limit"/>
508 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"UsageExclusive"/>
510 <variablelist class=
"dbus-property" generated=
"True" extra-ref=
"LimitExclusive"/>
512 <!--End of Autogenerated section-->
515 <title>Methods
</title>
517 <para>The following methods implement the same operation as the respective methods on the
518 <interfacename>Manager
</interfacename> object (see above). However, these methods operate on the image
519 object and hence does not take an image name parameter. Invoking the methods directly on the Manager
520 object has the advantage of not requiring a
<function>GetImage()
</function> call to get the image object
521 for a specific image name. Calling the methods on the Manager object is hence a round trip
522 optimization. List of methods:
524 <listitem><para>GetOSRelease()
</para></listitem>
526 <listitem><para>GetMetadata()
</para></listitem>
528 <listitem><para>GetMetadataWithExtensions()
</para></listitem>
530 <listitem><para>GetState()
</para></listitem>
532 <listitem><para>Attach()
</para></listitem>
534 <listitem><para>AttachWithExtensions()
</para></listitem>
536 <listitem><para>Detach()
</para></listitem>
538 <listitem><para>DetachWithExtensions()
</para></listitem>
540 <listitem><para>Reattach()
</para></listitem>
542 <listitem><para>ReattachWithExtensions()
</para></listitem>
544 <listitem><para>Remove()
</para></listitem>
546 <listitem><para>MarkReadOnly()
</para></listitem>
548 <listitem><para>SetLimit()
</para></listitem>
549 </itemizedlist></para>
553 <title>Properties
</title>
555 <para><varname>Name
</varname> specifies the image name.
</para>
557 <para><varname>Path
</varname> specifies the file system path where image is stored.
</para>
559 <para><varname>Type
</varname> specifies the image type.
</para>
561 <para><varname>ReadOnly
</varname> specifies whether the image is read-only.
</para>
563 <para><varname>CreationTimestamp
</varname> specifies the image creation timestamp.
</para>
565 <para><varname>ModificationTimestamp
</varname> specifies the image modification timestamp.
</para>
567 <para><varname>Usage
</varname> specifies the image disk usage.
</para>
569 <para><varname>Limit
</varname> specifies the image disk usage limit.
</para>
571 <para><varname>UsageExclusive
</varname> specifies the image disk usage (exclusive).
</para>
573 <para><varname>LimitExclusive
</varname> specifies the image disk usage limit (exclusive).
</para>
577 <xi:include href=
"org.freedesktop.locale1.xml" xpointer=
"versioning"/>
580 <title>History
</title>
582 <title>The Manager Object
</title>
583 <para><function>GetImageStateWithExtensions()
</function> was added in version
251.
</para>
586 <title>The Image Object
</title>
587 <para><function>GetStateWithExtensions()
</function> was added in version
251.
</para>
588 <para><function>ReattachWithExtensions()
</function> was added in version
254.
</para>