[systemd-devel] Antw: [EXT] [systemd‑devel] How to sychronize service START with STOP of mount units?
Ulrich Windl
Ulrich.Windl at rz.uni-regensburg.de
Wed Feb 16 13:04:52 UTC 2022
>>> "Manuel Wagesreither" <ManWag at FastMail.FM> schrieb am 16.02.2022 um 13:28
in
Nachricht <acd7f33f-29c4-4197-b1e6-0b1703c2d88a at www.fastmail.com>:
> 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.
As for the recent "firmware flashing" thread I think it would be best to
handle that via some boot parameter and something like a "boot once" boot entry
that adds that specific parameter.
I also think the clearing should be best done in initrd before the real root
filesystem is mounted. That should be most flexible.
>
> Thanks in advance and best regards,
> Manuel
More information about the systemd-devel
mailing list