teluzia.Cloud Engineer · Day 10
CHAPTER 02 · LINUX ADMINISTRATION AND SHELL SCRIPTING

Packages, logs and service troubleshooting

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

Combine package inspection, journal evidence and service diagnosis. A service failure can come from missing software, invalid configuration or runtime conditions, so you will collect evidence before deciding which layer needs repair. The lab avoids installing or restarting system services. Ubuntu’s APT resolves packages from configured repositories, while dpkg records installed package state. apt update refreshes available-package metadata; it does not upgrade installed software. apt install changes the system and may run service setup. Read-only commands let you understand versions and sources before deciding whether a change is needed. Logs describe events, but useful investigation requires the right service, time interval and boot. journalctl -u filters a systemd unit and --since narrows time. Traditional files under /var/log may also exist depending on the service and configuration. Missing logs do not prove nothing happened.

Think of it this way

Package metadata is the delivery receipt; service status is the machine indicator; logs are the maintenance diary.

TOPIC 01 / 03Step by step

Packages and repositories

Ubuntu’s APT resolves packages from configured repositories, while dpkg records installed package state. apt update refreshes available-package metadata; it does not upgrade installed software. apt install changes the system and may run service setup. Read-only commands let you understand versions and sources before deciding whether a change is needed. Use dpkg -s bash and apt-cache policy bash to compare installed package metadata with available repository candidates without changing the machine. Inspecting package state first distinguishes an absent executable from a service configuration problem and prevents unnecessary reinstalls during troubleshooting of an otherwise healthy dependency. Treating apt update as an installed-software upgrade misunderstands metadata refresh; inspect the command’s purpose and plan actual upgrades separately with their operational impact.

WORKED EXAMPLE
Use dpkg -s bash and apt-cache policy bash to compare installed package metadata with available repository candidates without changing the machine.
Why this matters

Inspecting package state first distinguishes an absent executable from a service configuration problem and prevents unnecessary reinstalls during troubleshooting of an otherwise healthy dependency.

A common trap

Treating apt update as an installed-software upgrade misunderstands metadata refresh; inspect the command’s purpose and plan actual upgrades separately with their operational impact.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Packages and repositories

Ubuntu’s APT resolves packages from configured repositories, while dpkg records installed package state. apt update refreshes available-package metadata; it does not upgrade installed software. apt install changes the system and may run service setup. Read-only commands let you understand versions and sources before deciding whether a change is needed. Use dpkg -s bash and apt-cache policy bash to compare installed package metadata with available repository candidates without changing the machine. Inspecting package state first distinguishes an absent executable from a service configuration problem and prevents unnecessary reinstalls during troubleshooting of an otherwise healthy dependency. Treating apt update as an installed-software upgrade misunderstands metadata refresh; inspect the command’s purpose and plan actual upgrades separately with their operational impact.

WORKED EXAMPLE
Use dpkg -s bash and apt-cache policy bash to compare installed package metadata with available repository candidates without changing the machine.

Why this matters

Inspecting package state first distinguishes an absent executable from a service configuration problem and prevents unnecessary reinstalls during troubleshooting of an otherwise healthy dependency.

A common trap

Treating apt update as an installed-software upgrade misunderstands metadata refresh; inspect the command’s purpose and plan actual upgrades separately with their operational impact.

Logs and time windows

Logs describe events, but useful investigation requires the right service, time interval and boot. journalctl -u filters a systemd unit and --since narrows time. Traditional files under /var/log may also exist depending on the service and configuration. Missing logs do not prove nothing happened. On a systemd machine, journalctl -u UNIT --since "1 hour ago" --no-pager reads recent unit records; replace UNIT with an existing service. Time-scoped evidence reduces noise and lets you connect a specific failed operation with its diagnostic message rather than unrelated historical warnings from earlier sessions. Searching all logs without identifying the service or incident time encourages unrelated-error chasing; begin with a bounded timeline and the component actually involved today.

WORKED EXAMPLE
On a systemd machine, journalctl -u UNIT --since "1 hour ago" --no-pager reads recent unit records; replace UNIT with an existing service.

Why this matters

Time-scoped evidence reduces noise and lets you connect a specific failed operation with its diagnostic message rather than unrelated historical warnings from earlier sessions.

A common trap

Searching all logs without identifying the service or incident time encourages unrelated-error chasing; begin with a bounded timeline and the component actually involved today.

Layered service troubleshooting

Start with observed symptoms, then inspect process state, configuration validation, logs and dependencies. Distinguish failure to start from a process that runs but cannot answer requests. systemctl status may include an exit code but is not a full diagnostic history. Preserve the original error before changing configuration. A missing unit name produces Unit could not be found; compare it with systemctl list-unit-files rather than reinstalling packages immediately. A layered method reduces unnecessary changes and makes each repair explainable through before-and-after evidence, which is more reliable than restarting everything until symptoms disappear. Restarting services before preserving evidence can erase useful state and disrupt users; inspect read-only status and logs before selecting a narrowly justified corrective action.

WORKED EXAMPLE
A missing unit name produces Unit could not be found; compare it with systemctl list-unit-files rather than reinstalling packages immediately.

Why this matters

A layered method reduces unnecessary changes and makes each repair explainable through before-and-after evidence, which is more reliable than restarting everything until symptoms disappear.

A common trap

Restarting services before preserving evidence can erase useful state and disrupt users; inspect read-only status and logs before selecting a narrowly justified corrective action.

KEEP THESE WITH YOU

Today’s takeaways

Inspect packages before reinstalling.

Bound log searches by component and time.

Preserve evidence before changes.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed