[systemd-devel] How to sychronize service START with STOP of mount units?

Manuel Wagesreither ManWag at FastMail.FM
Wed Feb 16 12:28:12 UTC 2022


Hi all,

We'd like to implement a factory reset for an embedded device we are working on.

I think the cleanest approach would be a factory-reset.target which WANTS/REQUIRES reboot.target + a factory-reset.service which wipes the persistent storage.

The thing is, START of factory-reset.service would need to be synchronized with the STOPs of some mount units which got started during system boot.

For easier understanding:

System start:
1. Start path-to-first.mount
2. Start path-to-second.mount

System halt:
1. Stop path-to-second.mount
2. Stop path-to-first.mount

Factory reset:
1. Stop path-to-second.mount
2. Start factory-reset.service, wiping /path/to/first/*
3. Stop path-to-first.mount

I currently have no idea how to express this in systemd terms. If someone on this list could provide some advice, it would be much appreciated.

Thanks in advance and best regards,
Manuel


More information about the systemd-devel mailing list