[systemd-devel] ConditionPathExists vs mount unit
Böszörményi Zoltán
zboszor at pr.hu
Mon Aug 10 17:46:35 UTC 2020
Hi,
I have to use the same OS image tarball (created by Yocto)
on several machines with different specifications.
Where they differ is the disk size and partitioning. On the smaller
machine (a Sicom SL20 POS hardware, boots from CF card) the disk size
is too small to have separate partitions for certain purposes that are
on the other hand mandatory on the larger system.
The shipped disks are mass-produced and are pre-formatted with
the same UUIDs across all devices so they are interchangeable.
So, I discovered the mount unit type:
https://www.freedesktop.org/software/systemd/man/systemd.mount.html
This page says that the usual [Unit] section options are applicable.
I was hoping that the missing partitions can be skipped using the
ConditionPathExists= option but it seems it's not the case.
On mount unit looks like this:
====================================================
$ cat var.mount
[Unit]
Description=Variable Data (/var)
ConditionPathExists=/dev/disk/by-uuid/e8282db7-dd6d-4231-b2b1-49887648480c
ConditionPathIsSymbolicLink=!/var
DefaultDependencies=no
Conflicts=umount.target
Before=local-fs.target umount.target
After=swap.target
[Mount]
What=/dev/disk/by-uuid/e8282db7-dd6d-4231-b2b1-49887648480c
Where=/var
Options=noatime
[Install]
WantedBy=local-fs.target
====================================================
This boots properly on the larger system where the extra /var
partition exists but the smaller system fails to boot.
systemctl status var.mount says:
Dependency failed for Variable Data (/var)
var.mount: Job var.mount/start failed with result 'dependency'
Is there a way to describe optional mounts via such Conditions* options?
systemd version is 237.
Best regards,
Zoltán Böszörményi
More information about the systemd-devel
mailing list