LPIC-1 Administrative Tasks Practice Question
A medium-sized company runs a web application on a Linux server. The server uses systemd and has the following configuration: the web application service (webapp.service) is configured to start after network.target and requires a database service (database.service) to be running. The database service has a Restart=on-failure directive. Recently, the server experienced a power outage. Upon reboot, the system administrator notices that the web application fails to start because the database service is in a failed state. The administrator checks the status of database.service and sees 'inactive (dead)' with no recent attempts to restart. The journal shows that the database service failed to start because a required filesystem (mounted at /var/lib/database) was not mounted when the database service tried to start. The filesystem is listed in /etc/fstab with the nofail option. The administrator wants to ensure that in future reboots, the database service starts successfully and the web application comes up without manual intervention. Which of the following is the best course of action?
⚠ Common exam trap
The trap here is that candidates often focus on restart policies (Option A) or fstab options (Option B) without realizing that systemd's dependency system must be used to enforce ordering between services and mount units, especially when nofail is present.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Modify the database.service unit file to add 'After=var-lib-database.mount' and 'Requires=var-lib-database.mount'
The database service failed due to a missing mount at /var/lib/database. By adding 'After=var-lib-database.mount' and 'Requires=var-lib-database.mount' to the database.service unit, systemd will ensure the mount unit is started before the database service and that the database service is stopped if the mount fails. This directly addresses the root cause—the filesystem not being ready—without altering the restart behavior or the fstab nofail option, which is appropriate for allowing the system to boot even if the mount fails.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Change the Restart directive in database.service to 'always'
Why it's wrong here
Restart=always only re-runs the unit after it exits; it cannot retry a start that failed because /var/lib/database was not yet mounted, and systemd already marked the unit failed. It suits services that must survive crashes, not ordering against mount units.
- ✗
Remove the nofail option from /etc/fstab for /var/lib/database
Why it's wrong here
Removing nofail makes boot block until the filesystem mounts, but it does not order database.service after that mount, so the service can still start before the mount completes. nofail is correct when a missing filesystem must not halt boot.
- ✓
Modify the database.service unit file to add 'After=var-lib-database.mount' and 'Requires=var-lib-database.mount'
Why this is correct
Because /var/lib/database is mounted with nofail, boot proceeds without it, so database.service starts before the mount exists and fails. Adding After= and Requires=var-lib-database.mount creates an ordering and dependency link, forcing systemd to mount the filesystem first.
- ✗
Modify the webapp.service unit file to add 'After=database.service' and 'Requires=database.service'
Why it's wrong here
webapp.service already declares Requires and After on database.service, so adding them changes nothing about database.service starting before its filesystem is mounted. This directive pair is correct when a dependent unit must be pulled in and ordered, not when the dependency itself fails.
Go deeper
Related to this question
About these practice questions
One of 402 original LPIC-1 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-1 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-1 exam.