CompTIA XK0-006 (CompTIA Linux+) Practice Test 27

Question 260

An application unit already orders startup with After=database.service. Which additional directive pulls the database unit into the transaction and makes the application depend on successful database activation?

  1. .target unit
  2. ExecStart=/usr/local/bin/worker
  3. Requires=database.service
  4. data.mount
  5. .timer unit
  6. Wants=logger.service

Explanation

Correct Answer

C:

Requires adds a strong dependency on the named unit, with failure propagation under the applicable startup conditions. Ordering may separately require After.

Incorrect Answers

A:

A target groups and synchronizes systemd units to express boot states; the requirement is expressing a mandatory unit dependency, outside the effect of this choice.

B:

ExecStart defines the command systemd launches for a service; it does not deliver expressing a mandatory unit dependency, which is decisive in this scenario.

D:

systemd converts mount-point paths into unit names such as data.mount; the task involves expressing a mandatory unit dependency, whereas this addresses another subsystem.

E:

A timer unit activates an associated service on its configured schedule; its scope differs from expressing a mandatory unit dependency, so it cannot meet the stated requirement.

F:

Wants is a weaker activation dependency than Requires; that is not equivalent to expressing a mandatory unit dependency.

Question 261

A systemd service must start immediately but not change its boot enablement. Which command is correct?

  1. systemctl daemon-reload
  2. systemctl enable app.service
  3. systemctl restart app.service
  4. systemctl start app.service

Explanation

Correct Answer

D:

start activates the unit now without writing enablement symlinks. It has no implication that the service will run after a reboot.

Incorrect Answers

A:

daemon-reload refreshes systemd manager configuration and dependency state; that is not equivalent to activating a service in the current boot.

B:

enable creates the installation symlinks needed to pull in a unit at startup; the administrator instead needs activating a service in the current boot; this option serves a different purpose.

C:

restart stops and starts the unit, causing its main process to reinitialize; it answers a neighboring question rather than activating a service in the current boot.

Question 262

A .service file should run /usr/local/bin/worker as its principal process. Which directive specifies that executable?

  1. ExecStart=/usr/local/bin/worker
  2. After=database.service
  3. Restart=on-failure
  4. network-online.target

Explanation

Correct Answer

A:

ExecStart defines the command systemd launches for a service. Service Type settings determine how its startup lifecycle is tracked.

Incorrect Answers

B:

After controls relative startup ordering when both units participate in a transaction; using it would leave defining the program launched by a service unit unresolved.

C:

Restart=on-failure restarts a service after selected failure conditions; the requirement is defining the program launched by a service unit, outside the effect of this choice.

D:

network-online.target denotes an online network condition only when the distribution's wait-online services provide it. network.target alone does not promise usable connectivity; it does not deliver defining the program launched by a service unit, which is decisive in this scenario.

Question 263

A stopped service should no longer start automatically at boot but remain manually startable. Which action fits?

  1. systemctl enable app.service
  2. systemctl daemon-reload
  3. systemctl disable app.service
  4. systemctl restart app.service

Explanation

Correct Answer

C:

disable removes symlinks created by enablement while leaving the unit available for explicit starts. It does not necessarily stop a currently running instance.

Incorrect Answers

A:

enable creates the installation symlinks needed to pull in a unit at startup; the task involves removing automatic service startup without masking, whereas this addresses another subsystem.

B:

daemon-reload refreshes systemd manager configuration and dependency state; its scope differs from removing automatic service startup without masking, so it cannot meet the stated requirement.

D:

restart stops and starts the unit, causing its main process to reinitialize; the administrator instead needs removing automatic service startup without masking; this option serves a different purpose.

Question 264

A service should wait until the network is considered online rather than merely when network management starts. Which dependency target is commonly relevant?

  1. .target unit
  2. ExecStart=/usr/local/bin/worker
  3. After=database.service
  4. network-online.target

Explanation

Correct Answer

D:

For units requiring configured network reachability, network-online.target can act as an ordering point with a suitable wait-online service. network.target alone does not promise usable connectivity.

Incorrect Answers

A:

A target groups and synchronizes systemd units to express boot states; that changes a different part of the system; the requested outcome is depending on a network-ready boot milestone.

B:

ExecStart defines the command systemd launches for a service; this does not achieve depending on a network-ready boot milestone on the system described.

C:

After controls relative startup ordering when both units participate in a transaction; it will not provide depending on a network-ready boot milestone under these conditions.

Question 265

A server must mount /data via a systemd unit whose name corresponds to that path. Which unit name is generated?

  1. Restart=on-failure
  2. data.mount
  3. After=database.service
  4. Requires=database.service
  5. WantedBy=multi-user.target

Explanation

Correct Answer

B:

systemd converts mount-point paths into unit names such as data.mount. The mount unit models the mounted filesystem and its dependencies.

Incorrect Answers

A:

Restart=on-failure restarts a service after selected failure conditions; it does not deliver naming a mount unit for /data, which is decisive in this scenario.

C:

After controls relative startup ordering when both units participate in a transaction; the task involves naming a mount unit for /data, whereas this addresses another subsystem.

D:

Requires adds a strong dependency on the named unit, with failure propagation under the applicable startup conditions; its scope differs from naming a mount unit for /data, so it cannot meet the stated requirement.

E:

An install directive such as WantedBy defines the target's enablement symlink; that is not equivalent to naming a mount unit for /data.

Question 266

A custom service should restart after an unexpected failure but not after a normal administrative stop. Which setting is suitable?

  1. Restart=on-failure
  2. Wants=logger.service
  3. Requires=database.service
  4. network-online.target

Explanation

Correct Answer

A:

Restart=on-failure restarts a service after selected failure conditions. Explicit stops and clean exits are generally not considered failures.

Incorrect Answers

B:

Wants is a weaker activation dependency than Requires; it answers a neighboring question rather than restarting a failed service automatically.

C:

Requires adds a strong dependency on the named unit, with failure propagation under the applicable startup conditions; that changes a different part of the system; the requested outcome is restarting a failed service automatically.

D:

A network-online.target dependency affects startup ordering when a wait-online implementation is active; it does not replace a restart policy. network.target alone does not promise usable connectivity; this does not achieve restarting a failed service automatically on the system described.

Question 267

The team wants to find which unit startup operations consumed the longest wall-clock time. Which command lists them?

  1. hostnamectl set-hostname app01
  2. systemd-analyze blame
  3. timedatectl status
  4. systemd-analyze time

Explanation

Correct Answer

B:

systemd-analyze blame ranks unit activation durations. It does not always identify the true critical path, because many units can start concurrently.

Incorrect Answers

A:

hostnamectl configures host naming through systemd-hostnamed on supported systems; using it would leave ranking slow unit activations unresolved.

C:

timedatectl reports local time, time zone and synchronization indicators under systemd; it does not deliver ranking slow unit activations, which is decisive in this scenario.

D:

systemd-analyze time reports time spent in firmware, loader, kernel and userspace where available; the evidence calls for ranking slow unit activations, not merely this separate operation.

Question 268

A change manager needs to see whether a unit is running, failed or inactive, including recent log lines. Which command provides a summary?

  1. systemctl status app.service
  2. systemctl start app.service
  3. systemctl daemon-reload
  4. systemctl mask app.service

Explanation

Correct Answer

A:

status combines unit state with process and recent journal information. It is for inspection, not a promise of future enablement.

Incorrect Answers

B:

start activates the unit now without writing enablement symlinks; that is not equivalent to checking service runtime state and recent failures.

C:

daemon-reload refreshes systemd manager configuration and dependency state; the administrator instead needs checking service runtime state and recent failures; this option serves a different purpose.

D:

Masking links the unit name to /dev/null, preventing normal activation by systemd; it answers a neighboring question rather than checking service runtime state and recent failures.

Question 269

A service should pull in a logging helper when available without failing if the helper cannot start. Which relationship is appropriate?

  1. Restart=on-failure
  2. .timer unit
  3. network-online.target
  4. Wants=logger.service

Explanation

Correct Answer

D:

Wants is a weaker activation dependency than Requires. It starts the related unit but generally does not require it to succeed.

Incorrect Answers

A:

Restart=on-failure restarts a service after selected failure conditions; this does not achieve declaring an optional activation dependency on the system described.

B:

A timer unit activates an associated service on its configured schedule; it will not provide declaring an optional activation dependency under these conditions.

C:

network-online.target can delay dependent unit startup for network readiness, provided a working online-wait service is present. network.target alone does not promise usable connectivity; using it would leave declaring an optional activation dependency unresolved.

Question 270

A server clock is wrong, and the operator needs to check time zone and NTP synchronization state. Which command reports both?

  1. hostnamectl set-hostname app01
  2. systemd-analyze time
  3. timedatectl status
  4. systemd-analyze blame

Explanation

Correct Answer

C:

timedatectl reports local time, time zone and synchronization indicators under systemd. It does not replace an NTP daemon's detailed peer statistics.

Incorrect Answers

A:

hostnamectl configures host naming through systemd-hostnamed on supported systems; the evidence calls for inspecting system time-zone and synchronization settings, not merely this separate operation.

B:

systemd-analyze time reports time spent in firmware, loader, kernel and userspace where available; the task involves inspecting system time-zone and synchronization settings, whereas this addresses another subsystem.

D:

systemd-analyze blame ranks unit activation durations; that is not equivalent to inspecting system time-zone and synchronization settings.

CompTIA Linux+ (XK0-006) Practice Tests