Skip to main content
deleted 29 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 238

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.

Being a newbie to systemd, 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:

enter image description here

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...?

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.

Being a newbie to systemd, 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:

enter image description here

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...?

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:

enter image description here

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...?

Tweeted twitter.com/StackUnix/status/660787857750163456
added 560 characters in body
Source Link
Udo G
  • 1.2k
  • 3
  • 14
  • 27

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.

Being a newbie to systemd, 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:

enter image description here

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...?

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.

Being a newbie to systemd, 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:

enter image description here

Apparently my config is wrong, but I'm having a hard time finding the problem... Any help greatly appreciated..

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.

Being a newbie to systemd, 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:

enter image description here

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...?

Source Link
Udo G
  • 1.2k
  • 3
  • 14
  • 27

how to start a systemd service before networking starts?

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.

Being a newbie to systemd, 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:

enter image description here

Apparently my config is wrong, but I'm having a hard time finding the problem... Any help greatly appreciated..