Linux Labs

Packages, services, and logs / Stage 7 of 13

Diagnosing a failed service

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 8 · on a machine · 6 min

The journal of the attempt

systemd writes every start attempt into the journal. This step shows how to find the records of the latest attempt and what to look for in them.

The start error itself suggests two commands: systemctl status and journalctl -xeu. The journal is easier to read without a pager and for the current boot only, with the -b option:

bash
sudo journalctl -u lab-worker -b -n 10 --no-pager  # this boot
sudo journalctl -xeu lab-worker                    # with notes

The -x option adds systemd's notes to the records, and -e opens the journal in the pager at the latest records; q leaves the pager. Records of earlier attempts stay in the journal, so check the time.

In the journal an attempt begins with a Starting record and, on failure, ends with Failed to start. In between is the exit status, and sometimes a separate record with the cause from systemd or from the program itself. 203/EXEC has no such record: you check the path from ExecStart yourself, against the unit file and the disk.

Exercise · look

Records of the attempt

Read the lab-worker journal records for the current boot and the service's unit file, then check whether the program from ExecStart is on disk.

First, predict

What will ls -l /usr/bin/sleeeep print?

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
Ubuntu 24.04
Loading…