I'm trying to set up a new service (under Debian Jessie) that needs to set up some mounts where the network configuration is stored and thus this service must complete before networking.service starts.
I tried the following:
[Unit]
Description=mount/repair remaining filesystems (all persistent fs beyond "/")
#Before=network-pre.target
Before=networking.service
[Service]
Type=oneshot
ExecStart=/opt/intermodul-mounts/start.sh
TimeoutSec=0
RemainAfterExit=yes
[Install]
RequiredBy=networking.service
Using systemd-analyze plot
I can see that my service starts, but networking.service
starts about 3 seconds earlier:
Apparently my config is wrong, but I'm having a hard time finding the problem... Any help greatly appreciated..
Update
I currently solved it by changing the service config to start before local-fs.target
instead of networking.service
:
[Unit]
DefaultDependencies=no
Description=mount/repair remaining filesystems (all persistent fs beyond "/")
Before=local-fs.target
[Service]
Type=oneshot
ExecStart=/opt/intermodul-mounts/start.sh
TimeoutSec=0
RemainAfterExit=yes
[Install]
RequiredBy=local-fs.target
Still, I'd like to understand why my first configuration didn't work as expected...?
/etc/network/interfaces
has references toip-up
scripts that reside in another partition. That partition is mounted by a complex script/opt/intermodul-mounts/start.sh
that must be run before networking is being set up. Currently, theip-up
scripts effectively don't start because they are not accessible at boot time. Runningservice networking restart
afterwards brings up all interfaces correctly. – Udo G Sep 11 '15 at 15:20Before=local-fs.target
andRequiredBy=local-fs.target
which leads to the system not booting anymore. I don't understand how this stupid system is supposed to work. Why is that a cyclic dependency? – Julian F. Weinert Oct 14 '22 at 03:04