You can't use templates with .mount units because .mount units need to be named exactly after their mount point. That's probably not explicitly documented, but might be a good idea to add.
For your use-case, I would probably use a generator (man systemd.generator) to solve that... It might not solve your problem, since we don't know when exactly do the mount themselves happen but it would work for the simple, mount at boot, case HtH Jeremy Le jeu. 23 janv. 2020 à 18:30, Marcel Partap <[email protected]> a écrit : > Salut, > for our live debian USB stick distro for students ( > https://github.com/fsfw-dresden/usb-live-linux ), we want to minimize on > flash writes by putting several paths into a tmpfs overlay. So there is a > [email protected] with > > > [Unit] > > Description=Prepare writable overlay on %f > > DefaultDependencies=no > > RequiresMountsFor=/run > > > > [Service] > > Type=oneshot > > ExecStart=/bin/mkdir -p '/run%f' > > ExecStart=/bin/mount -t tmpfs -o noatime tmpfs '/run%f' > > ExecStart=/bin/mkdir -p '/run%f/work' '/run%f/rw' > > and f.e. a var-lib-apt-lists.mount with > > [Unit] > > Description=tmpfs overlay of %f > > Conflicts=umount.target > > Wants=pre-overlay@%p.service > > After=pre-overlay@%p.service > > > > [Mount] > > What=overlay > > Type=overlay > > Where=%f > > Options=lowerdir=%f,upperdir=/run%f/rw,workdir=/run%f/work > > > > [Install] > > WantedBy=local-fs.target > > Currently, the file is just cloned for multiple paths, which is working > but not very elegant. I tried changing it into an instanced unit file > [email protected], which did not work ("Unit type mount cannot be > templated" in journal only, nothing from systemd-analyze verify or the > systemd.mount man page).. Neither did calling the file > tmpfs-overlay.mount.unit and symlinking to it as var-lib-apt-lists.mount, > var-cache-apt.mount etc. > > So what would be a more elegant way to not have multiple copies of the > very same file? > > Best Regards, > #marcel > _______________________________________________ > systemd-devel mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/systemd-devel > -- [image: SMILE] <http://www.smile.eu/> 20 rue des Jardins 92600 Asnières-sur-Seine *Jérémy ROSEN* Architecte technique [image: email] [email protected] [image: phone] +33 6 88 25 87 42 [image: url] http://www.smile.eu [image: Twitter] <https://twitter.com/GroupeSmile> [image: Facebook] <https://www.facebook.com/smileopensource> [image: LinkedIn] <https://www.linkedin.com/company/smile> [image: Github] <https://github.com/Smile-SA> [image: Découvrez l’univers Smile, rendez-vous sur smile.eu] <https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature>
_______________________________________________ systemd-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/systemd-devel
