Configuring Systemd Boot Order for 389 Directory Server and Samba Dependency Management on Fedora


1 views

When running multiple network services on Fedora, proper boot sequencing becomes critical. The 389 Directory Server (LDAP) must initialize before Samba since Samba may require LDAP authentication. Here's how to implement this dependency chain:


# Check current service status
systemctl status smb.service
systemctl status dirsrv@example.service

Before modifying dependencies, verify which targets your services currently belong to:


systemctl list-dependencies smb.service
systemctl list-dependencies dirsrv.target

The proper approach involves creating explicit dependencies between services. Edit the Samba service unit file:


sudo systemctl edit smb.service

Add these directives to the override file:


[Unit]
After=dirsrv.target network-online.target
Requires=dirsrv.target network-online.target

After applying changes, verify the boot sequence:


systemd-analyze critical-chain smb.service
systemd-analyze plot > boot-sequence.svg

For administrators preferring graphical tools, Fedora provides systemd-manager (install via dnf install systemd-manager). Key features:

  • Visual dependency graphs
  • Drag-and-drop service ordering
  • Real-time unit file editing

For environments running multiple 389 DS instances:


# Create drop-in directory for Samba
sudo mkdir -p /etc/systemd/system/smb.service.d/
sudo nano /etc/systemd/system/smb.service.d/dependencies.conf

Add instance-specific dependencies:


[Unit]
After=dirsrv@ldap1.service dirsrv@ldap2.service
Wants=dirsrv@ldap1.service dirsrv@ldap2.service

For complex deployments, consider using template units:


[Unit]
After=network-online.target %i.service
Requires=%i.service

# Check service startup time
systemd-analyze blame

# Verify specific service dependencies
systemctl show -p Requires,Wants,After,Before smb.service

When dealing with multiple services on a Fedora system, proper boot sequencing becomes crucial. The 389 Directory Server (LDAP) and Samba (SMB/CIFS) services often need to start in a specific order, particularly when Samba relies on LDAP for authentication.

As you've mentioned, both services are already enabled in systemd:

systemctl enable smb.service
systemctl enable dirsrv.target

However, enabling them doesn't control their startup sequence. We need to establish proper dependencies.

First, let's check the current dependencies and boot timing:

systemd-analyze critical-chain smb.service
systemd-analyze critical-chain dirsrv.target

We have several approaches to control the startup sequence:

Method 1: Using Requires and After Directives

Create or edit the Samba service unit file to explicitly declare dependencies:

[Unit]
Description=Samba SMB/CIFS Server
After=network.target dirsrv.target
Requires=dirsrv.target

Method 2: Creating Drop-in Files (Recommended)

A better approach is to use systemd drop-in files without modifying the original service file:

mkdir -p /etc/systemd/system/smb.service.d
cat > /etc/systemd/system/smb.service.d/order.conf <

Method 3: Target-based Sequencing

For more complex setups, create a custom target:

cat > /etc/systemd/system/multi-user.target.wants/custom.target <

After making changes, always reload systemd and verify:

systemctl daemon-reload
systemd-analyze verify smb.service
systemd-analyze verify dirsrv.target

While the command line offers the most control, Fedora does provide some GUI tools:

  • systemd-manager (available in repositories)
  • cockpit (web-based administration tool)
  • system-config-services (legacy tool, limited functionality)

Potential problems and solutions:

# If services start in wrong order:
journalctl -u smb.service -u dirsrv.target --since "1 hour ago"

# If dependency cycles occur:
systemd-analyze critical-chain

For even more control, consider socket activation:

[Socket]
ListenStream=389
ListenStream=445