Courseiva
Administrative TaskshardMultiple ChoiceObjective-mapped

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

    Even with Restart=always, the service will fail repeatedly if the filesystem is not mounted.

  • Remove the nofail option from /etc/fstab for /var/lib/database

    Why it's wrong here

    Removing nofail may cause the system to fail to boot if the filesystem is missing; not a robust solution.

  • Modify the database.service unit file to add 'After=var-lib-database.mount' and 'Requires=var-lib-database.mount'

    Why this is correct

    This ensures the database service waits for the mount unit to be active before starting.

  • Modify the webapp.service unit file to add 'After=database.service' and 'Requires=database.service'

    Why it's wrong here

    Webapp already requires database; the issue is database failing, not ordering.

About these practice questions

One of 527 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 →

How Courseiva writes practice questions · Editorial policy

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.