Systemd dependencies and boot order

Solution 1:

Use systemctl edit smb.service to update the dependencies. - Will ensure the smb.service is started after

For robustness, (which will be worth while if you're tinkering with this stuff) you may also wish to include some of the following: - Activate when smb.service is activated. Will cause smb.service to fail if fails. - Activate when smb.service is activated. Won't cause smb.service to fail if fails. - If is deactivated, deactivate smb.service.


systemd-ui provides a GUI for systemd. Gives a good view of the state of systemd but you'll still have to use a text editor to modify the unit files.

Solution 2:

Do two things:

  1. Edit the /lib/systemd/system/smb.service unit file, to specify the dependency. The [unit] section contains an After= line which specifies what services/targets should be reached before this one. nmb.service winbind.service

    Change it to: nmb.service winbind.service
  2. Report this dependency back to Fedora as a bug, so that it can be incorporated in future releases.

Solution 3:

you maybe need to change or include a line with the Requires directive in the [Unit] section of the /usr/lib/systemd/system/smb.service file.


Solution 4:

There are two alternatives to modifying the service file in /usr/lib/systemd/system (see Example 2. Overriding vendor settings):

  1. Copy the file to /etc/systemd/system and perform the modifications on the copy. This file will completely override the file in /usr/lib.

  2. Create the file /etc/systemd/system/smb.service.d/local.conf. The contents of the file should be something like the example below. This selectively overrides the "Requires" and "After" options in the vendor provided service file.

Each of these (including modifying the file in /usr/lib) offers advantages and disadvantages. The best choice may depend on the service and the nature of the modifications.

While it may work, it is not sufficient to only add the "After" option (see [Unit] Section Options). "After" controls order, but not dependencies. If is not started in some other way, specifying an order will not start it. Use of the "Requires" or "Wants" option will force to be started.


NB: I don't know if this approach was available when this question was originally asked.