Skip to content

fix(session): mask a decoy disk's noauto line whatever pulls it in - #254

Merged
WitteShadovv merged 30 commits into
nextfrom
fix/noauto-decoy-mask
Nov 26, 2026
Merged

WitteShadovv merged 30 commits into
nextfrom
fix/noauto-decoy-mask

Conversation

@WitteShadovv

Copy link
Copy Markdown
Owner

Choices I made first:

  1. A noauto line counts as the decoy's disk when it is a local filesystem the decoy does not mount now and NAILS reads all its options, binds and ZFS datasets too. A hidden generation's noauto lines get the same mask, as NAILS cannot tell their disks from the decoy's.
  2. Such a line is masked, mount and automount, whatever pulls it in. No unit mounts the disk then. A unit that requires the mount by name does not start, which fails closed.
  3. Where NAILS reads the pull, from an fstab line or now a mount, swap or automount unit in a target's .requires directory, it keeps the line off like a line the boot mounts. It is skipped when its device is there and masked with a warning when not. The warning says the target will not be reached, and nails status lists the mask, where the last step to the mount names it with x-systemd.requires=, Requires=, BindsTo= or a link in a .requires directory, also through a service, or the line's own unit is linked in .requires. Where every pull goes through a path, or a target only may require the line, it says may and lists nothing. The same goes for a skip that gets masked after all, and for the older warning that a skipped unit needs a masked mount, where a chain that names the mount wins wherever the walk finds it. This changes some of next's own warnings too. Two rare shapes say will not though systemd reaches the target, with no disk mounted: a step for a path, such as RequiresMountsFor= or a mount point below, into a unit masked only later, and a link to /dev/null in a .requires directory on the way.
  4. A unit file with the line's name in /etc/systemd/system or /run/systemd/system is what systemd loads, so where a target links it the mask yields to the decision for that file, and the lists say the line is left to that file. Another line or unit file of that name left to the hidden systemd keeps the mask, as NAILS cannot tell which one systemd reads. Activation warns of it, and nails check where both are the decoy's own.
  5. A /usr line counts as one its target requires whatever x-systemd.wanted-by= and required-by= say. The warning says to attach the device or remove the line.
  6. A noauto line kept off as one nothing requires gets the needed handling also below the hidden root, led there by a link, or on a network share. A noauto line with an option NAILS does not read stays masked, and now warns as in choice 3 where a target requires a line that needs its mount.

A tmpfs unit with Requires= on a noauto mount, linked into local-fs.target, had the hidden systemd mount the disk read-write. Now it stays untouched. A /usr mask no longer records usr.automount. The check and activation lists now say skipped where the session skips a noauto line, and masked where it masks a skip after all.

I checked the systemd side on a VM with systemd 260.5. A tmpfs with Requires= on a masked mount did not start. A service with RequiresMountsFor= on one, a tmpfs below one and a tmpfs with x-systemd.requires-mounts-for= on one started without the mount, and local-fs.target was reached. No disk was mounted and no disk hash changed.

Two things I left alone, as next does them too. Where a unit file shadows a noauto line, the fstab generator's .requires links for that line, like systemd-makefs@ for x-systemd.makefs, still apply to the unit file's mount. And when a skipped unit requires a masked mount by name, nails status lists the skip but not the unreached target.

Each change has a unit test that fails without it. In the fstab policy E2E test a tmpfs unit linked in .wants that requires a noauto disk does not start. Linked in .requires, the mount of another such disk and its fsck are skipped and the tmpfs starts. Both disks keep their hashes.

Every commit passed fmt, clippy, the tests and one rotating shuffle seed, and the tip the full just check with the kernel tests.

On this head E2E all (45617742123), Distro E2E all (45617746612) and staged (45617750681) passed, and the oracle passed with every image (45622898937). Two E2E tests, snapshot-diff and faults-hidden-disk-removed, ran into the 750 s limit on their first try and passed on the retry in 68 s and 28 s. This head changes only text from cad6b8d, whose runs (45615219155, 45615225127, 45615229937, oracle 45619883803) passed with no retry.

The fstab policy is close to the file size limit. What the hidden
session keeps from starting for all decisions (runtime_units, KeptOff
and the masks) moves unchanged into a module of its own, so the
policy has room for the noauto mask.
A noauto fstab line of a local filesystem the decoy does not mount now
was left to the hidden systemd as never mounted. A unit outside the
fstab could still pull it in: a tmpfs mount unit with Requires= on it,
linked into local-fs.target, has systemd mount that disk read-write.
Reading every place that can pull a unit in is more than NAILS reads.

Such a line is now masked, mount and automount, as a line the boot
mounts is. A unit that requires its mount by name (Requires=) does not
start in the hidden session. Where NAILS reads the pull it decides as
before: a line of the fstab that needs the mount keeps it off as a
needed line, a skip whose pulls reach it is masked with a warning, and
a unit a target links for the line itself is decided as a unit of its
own. Its skip keeps the line off in place of the mask where it waits
for the line's device.
A line for /usr that names a unit with x-systemd.wanted-by= or
x-systemd.required-by= was read as one nothing requires, or one that
unit requires. systemd's fstab generator ignores both there and links
usr.mount into local-fs.target.requires, so a line not mounted now was
masked with no warning and no record. It is now read as one its boot
target requires: skipped where its device is there, masked with the
warning and recorded where it is not. The warning no longer says to
give it nofail, which systemd ignores on /usr, and its mask no longer
masks and records usr.automount, which systemd never makes there.

A backslash on a line in the middle of a chain made every step through
it a may, so nails status did not list the mask. It now makes only a
target's own step to that line a may: a line that surely requires it
still requires it, and it requires what it names before its first
option with a backslash. An option after one, which systemd may join
to it, names the mount only as a may.

A needed skip of which NAILS reads only that a target may require it,
masked because another fstab's line disagrees, was recorded as a mask
a target requires. It is warned of and no longer recorded.

A noauto line kept off at or below the hidden root, or on a network
filesystem, was masked with no warning and no record where a line the
boot starts needs it. It is kept off as a needed line now: skipped
where its device is there, or masked with a warning.
The fstab policy test gets a noauto disk at /srv/ra and a tmpfs mount
unit outside the fstab that requires its mount, linked into
local-fs.target.wants. On the decoy, starting the tmpfs mounts the
disk. In the hidden session the disk's mount is masked, the boot does
not start the tmpfs, a start of it fails, and the disk stays unmounted
and unchanged. check lists the line as masked, and the mask is gone
after the way back.
The configuration reference, the operator guide and the decoy
requirements said that a noauto line is left to the hidden systemd,
and that a unit outside the fstab that pulls it in mounts it
read-write. They now say that such a line is masked whatever pulls it
in, that a unit which requires its mount by name does not start, and
where NAILS warns of that, and the residue row of decoy filesystems names
such lines. They also say how a line for /usr is read, how a backslash
on the way to a needed noauto line counts, and which masks nails
status lists. The changelog has entries for each.
…not read

A noauto line with an option NAILS does not read is masked, as the option
may have the boot mount it. Where a line the boot starts needs its mount,
such as a tmpfs below it, and a boot target requires that line, the mask
had no warning and no record. The mask stays, and now names that target:
activation and nails check warn of it, and nails status lists the mount,
not the automount, where NAILS reads that the target requires it.
The mask of a noauto line of a decoy disk held whatever the units outside
the fstab said, and three of its outcomes had no warning:

- A mount unit linked in a boot target's .requires directory that requires
  the noauto mount, a tmpfs with Requires= on it, could not start, and the
  target was not reached. Where NAILS reads that chain of requirements, the
  line is now kept off as a line the boot mounts: skipped where its device
  is there, so that the unit and the target start, and masked with a warning
  and a record where it is not.
- A unit file of the line's name in a unit directory systemd reads before
  the fstab generator's is what that name loads. The mask now yields to the
  decision for that file where a target links it, as next started it.
- Another fstab line or unit file of the same name left to the hidden
  systemd, such as a tmpfs line of a hidden fstab for the same mount point,
  was masked with no warning. NAILS cannot tell which of them the hidden
  systemd reads, so the mask stays, with a warning, and with a record where
  a boot target requires that line or unit file.
…kipped

session-fstab-policy gets a second noauto disk at /srv/rq and a tmpfs mount
unit outside the fstab with Requires= on its mount, linked into
local-fs.target.requires. In the hidden session the mount and its fsck are
skipped, the tmpfs starts, local-fs.target is reached, and the disk stays
unmounted with its hash unchanged.
The operator guide, the configuration reference, the decoy requirements,
the decoy-filesystems residue row and the CHANGELOG now say that a noauto
line of a decoy disk is skipped where NAILS reads that a boot target
requires it through a mount unit linked in its .requires directory, that a
unit file of its name systemd reads first is decided in its place, that
another line or unit file of its name keeps it masked with a warning, that
a hidden generation's noauto lines get the same mask, and that a needed
noauto line with an option NAILS does not read is warned of.
A unit that requires a masked noauto mount by name (Requires=,
x-systemd.requires=) does not start, and the boot target that requires
that unit is not reached. One that requires it only as the mount for a
path (RequiresMountsFor=, x-systemd.requires-mounts-for=, a mount point
below it, a source) gets no requirement of a masked mount unit: systemd
260.5 started such a service and such a tmpfs without the mount, and
reached local-fs.target. The warning for a needed noauto line, for a
mount unit a target requires that needs one, and for a needed noauto
line with an option NAILS does not read still said that the target will
not be reached there, and nails status listed the mask.

The step from the unit or line that needs the mount now tells which:
by name, the warning says the target will not be reached and the mask
is recorded as before; only for a path, the warning says the target may
not be reached, and the mask is not recorded. A chain of lines counts
by that first step, and a step by name wins over one for a path. The
decisions stay as they were.
The fstab-policy row of nails check described the decision for a noauto
line of a decoy disk as masked, also where the hidden session skips its
mount in place of the mask: where a mount unit a boot target links in its
.requires directory requires it, or where a skip of the same unit waits
for its device. The row now names such a line skipped, as activation
keeps it off. The check's list of the decoy filesystems and activation's
own list still say masked here.
The fstab-policy row of nails check named a noauto line whose mount the
hidden session skips in place of its mask as skipped, but the check's
list of the decoy filesystems, which activate --dry-run prints too, and
activation's own list still said masked, as the decision for the line
alone does. Both lists now describe such a mask as skipped, through one
Decision::describe_kept that the row uses as well.
Where kept_off has to mask a skip after all (a drop-in of the decoy's
undoes it, NAILS cannot tell what it pulls in, or its pulls reach a mount
the hidden systemd would make), it warned that the hidden session will not
reach the boot target that requires it, and recorded the mask for nails
status. It did so also for the skip of a noauto mount that a unit a target
requires needs only as the mount for a path (RequiresMountsFor=, a mount
point below it), and for the skip of a noauto line that fstab lines need
only for a path (a tmpfs below it, x-systemd.requires-mounts-for=).
systemd 260.5 starts such units without the masked mount, so the target
may be reached. It did so too for the skip of a line that a target only
may require, through an option NAILS cannot read or a backslash.

runtime_units and needed_noauto now keep those skips in KeptOff::unsure,
as they already knew which they were, and kept_off says may for them and
records nothing. A skip that the line or unit it was made for requires by
name still says will not and is recorded. Where another unit a target
requires names the mount of such a skip by Requires=, it still says may
here, which a later commit fixes.
A skipped unit that requires a unit the session masks got the warning
that the hidden systemd cannot start it, so the boot target that requires
it is not reached. That holds where the last step of the chain names the
masked unit (Requires=, x-systemd.requires=). Where it needs it only as
the mount for a path, such as the mount of an unmounted parent directory
with nofail, systemd 260.5 starts the unit without the mount, so the
warning now says that the target may not be reached.

pulls::walk now returns each masked unit once with whether its chain ends
in a step for a path, and a chain that names the unit, found later, wins
over one for a path.
…kept

The fstab-policy row of nails check, the check's list of the decoy
filesystems and activation's list described the mask of a noauto line
as masked also where it yields to a unit file of the line's name that a
boot target links and that systemd reads before the fstab generator's
unit: the session masks nothing there, and the unit file is decided as a
unit of its own. They now say that the line is left to that unit file.

They described a skip that kept_off masks after all (a drop-in of the
decoy's undoes it, or its pulls cannot be read or reach a mount) as
skipped. They now say masked rather than skipped.

Decision::describe_kept now takes the masks as well as the skips, and
lives with KeptOff in policy/kept.rs.
The configuration reference said that a skipped unit that requires a
masked unit, such as the mount of an unmounted parent directory with
nofail, does not start, and that the warning for a skip masked after all
says the target will not be reached. Both now say may where the unit
needs the mount only for a path, and that nails status then lists
nothing. The changelog says so too, and names the list fixes.
…ount

A noauto line that fstab lines need only for a path (a tmpfs below it,
x-systemd.requires-mounts-for=), or that a target only may require, is
skipped as an unsure one, so where its skip is masked after all the
warning says may and nothing is recorded. That is wrong where a mount,
swap or automount unit linked in a target's .requires directory names
the mount (Requires=, BindsTo=), itself or as the last step of a chain
of requirements, through a service too, or the line's own unit is linked
there: systemd refuses that unit, or the target's own requirement, while
the mount is masked, and the target is not reached. The same held where
the device is not there, or NAILS cannot tell what the line is (an
option it does not read, say), and the policy masks the line for the
path: it warned may and recorded nothing.

kept_off now weighs those skips and masks against the mount, swap and
automount units a target links in its .requires directory
(noauto::weigh_unsure). Where one names the mount, as the link does or
through a chain of requirements NAILS reads whose last step names it,
the skip leaves KeptOff::unsure, so a skip masked after all says will
not and is recorded. A mask made for the path is recorded, with its
device where it is not there, and its warning says will not and names
that unit: KeptOff::warning, which activation and check now use for the
decisions' warnings, drops the policy's may warning for it. The may
warning of a skip masked after all says that NAILS reads no unit a
target requires that names it.

Two rare shapes get will not and the record too, where systemd ignores
a step and reaches the target, with no disk mounted in either: a chain
with a RequiresMountsFor= step into a unit that kept_off masks only
after weigh_unsure ran, as a skip it masks after all, and a link of the
line's own name in a .requires directory that points to /dev/null.
A noauto line that a line with a backslash in its options needs only as
the mount for a path, such as a tmpfs below it, got the warning that
local-fs.target may require it, and that where it does the hidden
session will not reach it. Where its skip was masked after all, the
warning said the target may not be reached. One line had two wordings,
and the first claimed too much: systemd 260.5 starts a line below a
masked mount without it.

needed_below now reads by_path where a target only may require the mount
too: where no line on the way names it, or may through an option NAILS
cannot read, the warning says the target may require it through a line
that needs it only for a path, so it may not be reached.
…f so

pulls::walk notes each masked unit a skip requires once, reads a unit it
reaches again, and lets a chain found later that names it win over one
for a path. No test held either: with the second reach or the later win
left out, every test passed. The new test reaches n.mount for a path and
by name through a service, by name two services deep after the path is
noted, and first by a want and then by name, and checks that the warning
says the skip cannot start.
The configuration reference said that a mask NAILS reads only for a path,
or only as one a target may require, gets the warning that the target may
not be reached, and that nails status lists nothing. Where a mount, swap
or automount unit linked in a target's .requires directory names the
mount, or the line's own unit is linked there, the warning now says will
not and status lists the mask, with one warning where the policy masks it
already. The reference and the operator guide say so, and the reference
says that a line with a backslash below the mount gives the may warning
too.

The changelog says the same, and that a skip of a line a target only may
require, masked after all, moved from will not and a record to may and
none. It quotes the walk warnings for a skipped unit that requires a
masked unit, says that a chain that names the unit wins wherever the walk
finds it, and that nails status does not say that the target of such a
skip is not reached.
…et requires

Two branches of noauto::weigh_unsure had no test that fails without
them. A mount unit of a disk of its own, linked in
local-fs.target.requires, whose Requires= names the mount of a noauto
line that fstab lines need only for a path, is skipped, and a skipped
unit gets its start job too: it counts as a unit the target starts, so a
skip of the line masked after all says will not and is recorded. And a
noauto line with an option NAILS does not read, masked for a line below
it, is weighed too: where such a unit names its mount, the mask is
recorded and the unit pass's warning stands in place of the policy's.
…ystemd ignores

The texts on the will not warning for a mask that fstab lines need only
for a path said a unit, or something, where NAILS reads only the mount,
swap and automount units linked in a target's .requires directory, and
named Requires= alone, where a BindsTo= step and a chain through a
service count too. They now name those, and the changelog's only where
names the step that counts: the last one of the chain names the mount.

They also said that systemd refuses that unit or the target's own
requirement. Two rare shapes get the will not warning, and the record,
where systemd ignores a step and reaches the target: a chain with a
RequiresMountsFor= step into a unit that kept_off masks only after
weigh_unsure ran, as a skip it masks after all, and a link of the line's
own name in a .requires directory that points to /dev/null. No disk is
mounted in either. The texts now name both as limits. No code changes.
The two shapes where the warning says will not though systemd reaches the
target are wider than the earlier texts and the messages of a2e8670 and
cad6b8d say: any step for a path into a unit masked only later, not only
RequiresMountsFor=, and any link to /dev/null in a .requires directory on
the way, not only the line's own. A link in the .requires directory of a
unit on the chain names the mount too. The CHANGELOG also names the mask
recorded as undetermined where NAILS cannot read an option of the line.
The mask of a noauto line holds its mount and its automount. Where a
line the boot starts needs the mount, needed_below kept the line off as
one the boot mounts, but with the mount alone: the skip, or the mask
where the device is not there or targets only want the line, dropped
the automount. A unit that pulls that automount in would have started
the mount on access. The fstab_crypttab fuzz target found it:
var-cache.automount was neither masked nor skipped for a noauto
/var/cache that a line with a backslash in its options needs.

needed_below now keeps the rest of the mask, the automount, masked with
the mount: in the skip's masked units, or after the mount in the mask.
It is never recorded as a unit a target requires, as a needed mask
records only its first unit.

A ten minute run of the target then found that its property refused a
decided skip: the mask of a noauto line kept off for another reason, a
network share here, yields its mount to a skip where a line the boot
starts needs it, as the mask of a noauto line of a decoy disk does. The
property now allows that for the mount alone. The crash inputs and a
seed with the mount below, CRLF line ends and x-systemd.requires= are
added to the target's seeds. The configuration reference and the
changelog say that the automount stays masked.
The automount the decision for a needed noauto line carries since
a047323 went in as a plain mask. The line's own mask lets each of its
units yield: to a skip of the same unit that waits for the line's device,
and to a unit file of its name that a boot target links. The carried
automount lost that. With an automount unit file r-a.automount linked in
local-fs.target.requires, or a second fstab line for /r/a with
x-systemd.automount, its skip was masked over, recorded as one the lines
disagree about, and local-fs.target was not reached. Without a line that
needs the mount, the automount yielded and was skipped.

Decision::noauto_held names the units only the mask of a noauto line
nothing NAILS reads holds: all of that mask, and the automount the needed
decision of such a line carries. runtime_units, yield_masks and
covered_units now go by it instead of by is_noauto_mask alone. The
comments say why the automount stays masked: so that no autofs goes over
the mount point, as for every noauto line of a decoy disk, not because
the mount would start on access.
…rule

fstab_crypttab let the mask of any noauto line yield its mount to a skip
where a line the boot starts needs it. A line with an option NAILS does
not read stays masked, so a mutant of needed_below that skips such a line
passed the target. The rule now holds only for lines whose options NAILS
reads all, and its comment no longer names lines at or below the hidden
root, which decide refuses.

A new seed has the hidden session's odd lines with /mnt/My Disk mounted,
so that its x-systemd.requires-mounts-for=/a\040b, an option with a
backslash, needs every noauto line.
…d by

The configuration reference said that a noauto line is kept off as one
the boot mounts where a mount unit linked in a target's .requires
directory requires it. That does not hold where the lines of the fstab
only want the mount, such as a tmpfs below it with nofail: the line is
masked, NAILS does not weigh that mask against the units outside the
fstab, and such a unit does not start, with no warning. The reference and
the changelog now say so.

The reference also gave the wrong reason for the automount of a needed
line staying masked: it is so that no autofs goes over the mount point,
not because the mount would start on access.
The configuration reference and the changelog said that the automount
of a needed noauto line stays masked either way. Since 6bce5b5 it
yields as the line's own mask does: it is skipped where a second fstab
line gives x-systemd.automount, where a unit a target links requires it,
and where a linked automount unit file is decided as a skip. They also
said that NAILS does not weigh the mask of a line that fstab lines only
want. It weighs the automount of that mask, only not the mount, and
what does not start is a unit that requires the mount by name. Nothing
warns only where the session leaves that unit, as a skipped one gets the
warning that it requires a masked unit.

The changelog names two cases that now fail closed with a warning and a
record: the needed line's mount masked as one the lines disagree about
where an automount line's generated units outlive the line without a
daemon-reload, and a skipped unit that only wants the carried automount.
The reference points at the right row for the automount, and the code
comments that named is_noauto_mask alone name noauto_held.
…mits

The rebase of this branch onto next after #252 kept only its first seven
commits. Without the later ones the decision for a needed noauto line
again dropped the line's automount, and the fstab_crypttab fuzz job found
srv-crlf.automount neither masked nor skipped (run 45739865655). The
later commits are back on top, unchanged. The crash input is a seed, so
the target checks that shape from its first run.
…tests

The in-diff mutants of #254's shard 0 left five alive. keep_units_off
returned no warnings and filled no plan with every test passing, since
the tests that reach it build a hidden root and need a user namespace,
which the mutants lane does not have. And two negations in kept_off went
unseen: the one that adds the noauto mounts skipped in the unit pass to
what the walk reads as kept off, and the one that takes only the masked
skip's own units out of the unsure ones.

A test now runs keep_units_off on a scratch next root with the hidden
volume in place already: a disk unit a target requires, its device not
there, is masked, recorded and warned of, and a noauto line is masked
with its automount. A skipped disk unit that requires a noauto mount the
session skips too keeps its skip, and two path skips masked after all
both say may and record nothing.
@WitteShadovv
WitteShadovv merged commit e5e7c36 into next Nov 26, 2026
64 checks passed
@WitteShadovv
WitteShadovv deleted the fix/noauto-decoy-mask branch November 26, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant