[ norboten ]
linux · lab linux-02

The Service That Won't Stay Up

· about 30 minutes · runs on ubuntu-26.04 · unrated

An unrated lab. It runs on your machine with no account and no network, and everything about it — the faults, the checks, the hints and the reference solution — is in the repository. An attempt on it is recorded on your profile and never moves a rating: only rated labs do. Rated and unrated labs.

The briefing

notes is a small internal web app on port 8080. When someone starts it by hand it sometimes comes up — and a few minutes later it is gone again. After a reboot it never comes back at all. Colleagues opening http://<server>:8080/ get an old page that says the service was retired, or nothing.

The app runs as the notes user. Its notes live in /srv/notes. The server runs AppArmor, and security wants it to stay that way.

What is expected, and graded:

  1. notes is running, and starts at boot on its own.
  2. If notes crashes, the system brings it back.
  3. Port 8080 answers with the notes service, listing its notes.
  4. notes can read its notes because AppArmor allows it — not because AppArmor was switched off.

You have root through sudo. Everything must still hold after a reboot.

What is graded

The machine is checked, rebooted, and checked again. A check passes only if it passes both times.

CheckObjective
01_notes_active_and_enabledKeep a systemd service running across crashes and reboots
02_notes_restarts_on_failureKeep a systemd service running across crashes and reboots
03_notes_serves_its_notesDiagnose a failing service from its logs: permissions and port conflicts
04_data_access_confinedFix an AppArmor denial without weakening AppArmor
05_profile_still_enforcedFix an AppArmor denial without weakening AppArmor

Start it

  1. 2Labs
  2. linux-02select this one
  3. udownload it
  4. sstart the machine

Reading

Where the lab's hints send you, level by level, as you ask for them (h, then l opens a journal section in the TUI).

Theory for this lab

4 questions on the same topic, in the lab's Theory tab. They never affect the lab's grade. Three of them, to answer here:

Question 1

What does `Restart=on-failure` do?

Question 2

Why add Restart= in a drop-in instead of editing the unit in /usr/lib/systemd/system?

Question 3

Where do you find AppArmor denials on an Ubuntu system?