Services, Packages, and systemd

Inspect provenance, separate runtime from startup policy, and test a bounded owned unit.

Package presence is not service health

Observation Interface on Debian/Ubuntu
Installed version dpkg-query
Candidate and priorities apt-cache policy
Proposed package operation apt-get -s
Current service state systemctl show / is-active
Startup links systemctl is-enabled

Queries and simulation do not perform or certify a real install. Actual package changes require the authorized VM change workflow.

Load, activity, and enablement differ

LoadState=loaded
ActiveState=inactive
SubState=dead
UnitFileState=enabled

This is a synthetic interpretation fixture. It describes a loaded, inactive unit with startup enablement. Enabled does not mean running now.

Unsupported tools or denied access are collection outcomes, not inactive-service evidence.

Install and serve a web server on your VM

sudo apt install apache2
systemctl is-active apache2      # active
sudo ss -tlnp | grep ':80 '      # apache2 on 0.0.0.0:80
curl -sI http://localhost        # HTTP/1.1 200 OK

Installed, running, listening, and answering are four separate checks.
~/public_html returns 403 until chmod 711 ~: www-data needs search on your home.

Dependencies and ordering answer different questions

Wants/Requires express dependency relationships. After expresses ordering when both units participate.

After alone does not pull in a prerequisite. A network target or startup ordering does not prove a remote application is ready.

The lesson captures user-manager state and bounded default-target dependencies without changing a real system service.

Journal queries need scope and limits

journalctl --user --no-pager -n 5 -o short-iso

Capture stdout, diagnostics, and status separately. Add unit/time/boot/priority filters according to the question.

No accessible retained matches does not prove no event happened. Review exports before sharing: logs can include private data.

The practice worker is explicit and bounded

[Service]
Type=oneshot
ExecStart=/usr/bin/echo thinkbash_fixture
RemainAfterExit=yes
NoNewPrivileges=yes

It runs under the current user's manager. Active (exited) after success differs from a long-lived active (running) service.

A simple service must keep its supervised worker in the foreground.

The runtime lifecycle is actually checked

unique unit -> syntax validation -> runtime enable -> start
  -> active + main status 0 -> known journal marker
  -> stop -> inactive -> disable and cleanup

Verified on systemd 249/Bash 5.1 and systemd 255/Bash 5.2. The complete downloadable script owns its unit name and cleanup.

No sudo, /etc edits, system-service changes, lingering, or persistent startup change is required.

Privileges need a concrete review

Inspect executable trust, the account, writable paths, credentials, capabilities, network access, restart policy, and dependencies.

NoNewPrivileges is one defense, not a complete sandbox. System-unit User accounts and required directories must exist before installation.

Runtime user enablement does not verify persistent boot behavior or privileged system deployment.

Apply the distinction on your Linux VM

The graded lab walkthrough ends with a test unit that fails on purpose. Record actual versions, transitions, logs, and cleanup.

macOS does not emulate these Linux interfaces. Portable synthetic interpretation fixtures are checked separately. Canonical assignment availability is unchanged.

Sources: APT and systemd manuals linked in the lessons; original fixtures extend the Linuxize-guided chapter sequence.

Real change on the student's own VM, unlike the observation-only cells. The 403 ties back to directory search in Section 3.2; ask why 711 rather than 755.