I have an ArchLinux installation with systemd. I am trying to run a hook immediately after my encrypted data device is mounted in order to put flashcache on top of it. I have scripts that work, however I cannot make them load in right order. Here's what I did:file: /usr/lib/systemd/system/flashcache.service[Unit]Description=FlashCacheRequires=systemd-cryptsetup@cdata.service[Service]Type=oneshotRemainAfterExit=noExecStart=/usr/local/bin/flashcache_startup_script[Install]WantedBy=dev-mapper-data_cached.deviceAfter creating file, I ran systemctl enable flashcache.service.However, on boot it does not start, the dev-mapper-data_cached times out, after which I can get into a root shell and run flashcache_startup_script manually. I examined output of journalctl -b, and determined that FlashCache service does not load before timeout occurs.Another option I tried without success is Requires=dev-mapper-vg1-data.deviceWhat am I doing wrong?
How do I start service in systemd right after cryptsetup?
systemd
I tried all sorts of things, mainly using following resource. I am not exactly sure why it worked, but following unit file solved the issue:[Unit]Description=FlashCacheBindsTo=dev-vg1-data.deviceAfter=dev-vg1-data.deviceDefaultDependencies=no[Service]Type=oneshotRemainAfterExit=noExecStart=/usr/local/bin/flashcache_startup_script[Install]WantedBy=sysinit.target