dissect: optionally allow attaching images that do not qualify as DDIs with --attach (#43583)

It's nice to use --attach since it validates our images. So far, it
strictly insisted on checking that the image was a DDI however, which
limits its use for certain usecases.

Add "--relax" to address this limitation.

Fixes: #43605
This commit is contained in:
Yu Watanabe
2026-09-23 08:54:29 +09:00
committed by GitHub
6 changed files with 76 additions and 23 deletions
+14 -1
View File
@@ -209,7 +209,8 @@
of <command>losetup --find --show --partscan</command>, but will validate the image as DDI before
attaching, and derive the correct sector size to use automatically. Moreover, it ensures the
per-partition block devices are created before returning and attempts to enable direct IO mode, if
possible. Takes a path to a disk image file.</para>
possible. Takes a path to a disk image file. Use <option>--relax</option> to attach images that do
not qualify as DDI.</para>
<para>If combined with <option>--quiet</option> output of the block device name is suppressed.</para>
@@ -541,6 +542,18 @@
<xi:include href="version-info.xml" xpointer="v258"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--relax</option></term>
<listitem><para>If combined with <option>--attach</option>, skips validation of the image and
attaches it to the loopback block device as it is, even if it does not qualify as DDI. If this
switch is used, no image dissection takes place, and thus it is not guaranteed that the
per-partition block devices are created before the command returns. May not be combined with any
other command than <option>--attach</option>.</para>
<xi:include href="version-info.xml" xpointer="v263"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--mtree-hash=no</option></term>
+1 -1
View File
@@ -33,7 +33,7 @@
<citerefentry><refentrytitle>systemd-escape</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
<option>--path</option> to properly escape a file system path.</para>
<para>This unit invokes <command>systemd-dissect --attach --quiet --loop-ref-auto</command> on the
<para>This unit invokes <command>systemd-dissect --attach --relax --quiet --loop-ref-auto</command> on the
specified files, see
<citerefentry><refentrytitle>systemd-dissect</refentrytitle><manvolnum>1</manvolnum></citerefentry> for
details.</para>