Linux Labs

Packages, services, and logs / Stage 7 of 13

Diagnosing a failed service

Not running Starting usually ~20 s
Leave the lesson

Step 4 of 8 · on a machine · 5 min

Fix and apply

The cause is found: a typo in the unit file. Here you fix it so that systemd sees the fix.

Administrators keep the files of their own services in /etc/systemd/system, while packages install theirs into /usr/lib/systemd/system. A unit file is edited with sudo vim, like any settings file. Fix the program path, save the file and start the service again; the commands are on the card.

Exercise · do it

Fix the launch

Fix the typo in the program path in /etc/systemd/system/lab-worker.service and get the service to start. Leave the other lines of the file and the disabled autostart as they are.

First, predict

You fixed the path in the file, saved it and ran sudo systemctl start lab-worker straight away. What happens?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in

Goals · 0 of 3

  • Fix the program path in ExecStart not done yet
  • Start the service not done yet
  • Keep autostart off not done yet

systemd reads unit files at boot and on the daemon-reload command, and in between it works with the copy it has loaded. That is why start after the edit ran the old description with the typo, and status warned: The unit file … changed on disk. Run 'systemctl daemon-reload'. After any change to a unit file: sudo systemctl daemon-reload, then the start.

Step goals

0 of 3
  • Fix the program path in ExecStart — not done yet
  • Start the service — not done yet
  • Keep autostart off — not done yet
Ubuntu 24.04

Step goals

0 of 3
  • Fix the program path in ExecStart — not done yet
  • Start the service — not done yet
  • Keep autostart off — not done yet
Loading…