Bird
0
0

Why does systemd prefer using ExecStart with absolute paths instead of relative paths in service files?

hard🧠 Conceptual Q10 of 15
Raspberry Pi - Automation and Scheduling
Why does systemd prefer using ExecStart with absolute paths instead of relative paths in service files?
ARelative paths are only allowed in [Install] section
BAbsolute paths avoid ambiguity and ensure correct executable is run
Csystemd automatically converts relative to absolute paths
DRelative paths are faster but less secure
Step-by-Step Solution
Solution:
  1. Step 1: Understand path resolution in systemd

    systemd runs services in a minimal environment without a working directory, so relative paths may fail.
  2. Step 2: Reason why absolute paths are preferred

    Absolute paths ensure systemd finds the exact executable without ambiguity.
  3. Final Answer:

    Absolute paths avoid ambiguity and ensure correct executable is run -> Option B
  4. Quick Check:

    Use absolute paths to avoid execution errors [OK]
Quick Trick: Always use absolute paths in ExecStart for reliability [OK]
Common Mistakes:
MISTAKES
  • Assuming systemd converts relative paths
  • Thinking relative paths are allowed anywhere
  • Believing relative paths improve speed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes