Loading...

Lab 142: Printing, Journald, and Time Workflow

Apply updated mail aliases with newaliases, write and verify an incident note in journald using systemd-cat, clear a stuck CUPS job, submit a test print, and perform a controlled time change for a maintenance window. Finish by confirming system time state with timedatectl and pulling recent kernel messages from journalctl -k.

cups printing journald

Scenario

You updated /etc/aliases and must apply it. You also need to log evidence into journald, clear a stuck print job, submit a test print, and adjust system time for a maintenance window.

Ops habit

Treat this like a short incident checklist: apply changes, record what you did in logs, validate services with real evidence, and confirm time signals before you leave the box.

Objective

  • Apply alias changes using newaliases.
  • Write an incident note to journald with systemd-cat and verify it by tag.
  • Inspect the print queue, cancel a stuck job, and submit a test print.
  • Set system time to a specific timestamp using date -s and verify with timedatectl.
  • Pull recent kernel messages using journalctl -k.

Concepts

  • Alias changes require compilation via newaliases before mail services use them.
  • Journald evidence logging with systemd-cat and retrieval with journalctl -t .
  • CUPS queue triage using lpstat and job cancellation using cancel .
  • “Real” service validation by submitting a test print via lp and confirming queue acceptance.
  • Manual time setting using date -s and confirmation of system time state with timedatectl .
  • Kernel context capture via journalctl -k during incident review.

Walkthrough

Step 1: Rebuild the aliases database.
Command
sudo newaliases

Postfix reads a compiled alias database. After editing /etc/aliases, you must rebuild it.

/etc/aliases: 86 aliases, longest 52 bytes, 948 bytes total
Step 2: Write an incident note to journald.
Command
echo 'aliases rebuilt and printing/time checks in progress' | systemd-cat -t lab142

systemd-cat writes directly into the journal. Using a consistent tag makes the note easy to find.

Step 3: Verify the note by tag.
Command
journalctl -t lab142 -n 3

Confirm the entry exists so your evidence trail is complete before moving on.

Jan 25 07:19:02 lab142 lab142[1822]: aliases rebuilt and printing/time checks in progress
Step 4: Show pending print jobs.
Command
lpstat -o

Identify the job name you need to cancel. This is the fastest “what is stuck” view for CUPS queues.

Office_Printer-31  lab  1024  Sun 25 Jan 2026 07:16:55 AM EST
Step 5: Cancel the stuck job.
Command
cancel Office_Printer-31

This removes the pending job so the queue can proceed normally.

Step 6: Submit a test print.
Command
lp /etc/hosts

Use a real file so the test mirrors actual printing behavior and permissions.

request id is Office_Printer-32 (1 file(s))
Step 7: Confirm the new job is queued.
Command
lpstat -o

You want a clean signal that the queue is accepting jobs after cleanup.

Office_Printer-32  lab  1024  Sun 25 Jan 2026 07:19:31 AM EST
Step 8: Set system time for the maintenance window.
Command
sudo date -s '2026-01-25 07:25:00'

This is a controlled time change. In production you usually avoid manual time edits while NTP is active, but the lab focuses on command accuracy and verification.

Sun Jan 25 07:25:00 EST 2026
Step 9: Verify time state with timedatectl.
Command
timedatectl

Confirm the local time, time zone, and synchronization state after the change.

Time zone: America/New_York (EST, -0500)
System clock synchronized: yes
NTP service: active
Step 10: Show kernel messages from journald.
Command
journalctl -k -n 5

Kernel logs provide context during service issues and audits. Grabbing the last few kernel lines is a strong incident habit.

Jan 25 06:58:31 lab142 kernel: e1000e 0000:00:03.0 eth0: Link is Up 1000 Mbps Full Duplex
Jan 25 07:18:09 lab142 kernel: audit: type=1100 audit(...): ... unit=cups comm="systemd"

Common breakpoints

Alias forwarding still not working

/etc/aliases changes are not active until you run newaliases . Rebuild the database and retry.

cancel fails: “job not found”

The job may have completed or the job ID was mistyped. Re-run lpstat -o and copy the exact job name.

lp submits but nothing prints

Queue acceptance is only one signal. In real work you would also check printer state and CUPS logs if jobs stall.

Manual time edits behave unexpectedly

If NTP is active, time may be corrected shortly after a manual change. Use timedatectl to confirm sync state and current time signals.

Cleanup checklist

If you changed system time only for the lab, return the host to normal time-sync behavior and leave the print queue clean.

Commands
timedatectl status
lpstat -o || true
journalctl -t lab142 -n 3

Reference

  • newaliases : Rebuilds the aliases database used by mail services.
  • systemd-cat -t <tag> : Writes a tagged message into journald.
    • -t <tag>: Sets the SYSLOG_IDENTIFIER tag.
  • journalctl -t <tag> : Queries journal entries by tag.
    • -t <tag>: Filters by SYSLOG_IDENTIFIER.
    • -n <n>: Shows the last n lines.
  • lpstat -o : Shows queued print jobs.
    • -o: Output jobs in the print queue.
  • cancel <jobid> : Cancels a specific print job by ID.
  • lp <file> : Submits a print job for a file.
  • date -s 'YYYY-MM-DD HH:MM:SS' : Manually sets the system time.
    • -s: Sets time described by the provided string.
  • timedatectl : Displays time, timezone, and NTP synchronization state.
    • status: Shows detailed time status (optional subcommand).
  • journalctl -k -n <n> : Shows the last n kernel messages.
    • -k: Limits output to kernel messages.
    • -n <n>: Limits output to the last n entries.