Linux Labs

Inside the system: resources, kernel, processes / Stage 10 of 12 · step 7 of 8

A service holds up the boot

medium ~25 min
Not running Starting usually ~20 s
Report a problem

Situation

The warehouse server runs two services: the order desk lab-orders (http://127.0.0.1:8090) and the stock store lab-stock. At startup the order desk loads the stock levels from the store — without them it accepts no orders.

After every reboot the server takes half a minute longer to boot, and lab-orders ends up failed — the on-call admin brings the services up by hand later. A colleague insists the service dependencies are set up; the units are in /etc/systemd/system/.

The machine is now as it is after such a boot: lab-orders has just tried to start.

Task

  1. lab-orders starts the lab-stock store itself and starts after it: the dependencies live in its unit (Wants= and After=), with no reverse ordering.
  2. systemd-analyze verify lab-orders.service lab-stock.service prints no warnings.
  3. lab-orders is running, enabled at boot and answering: curl http://127.0.0.1:8090/health.
  4. After a reboot (sudo reboot) lab-orders comes up on its own at the first attempt and holds up the boot for no more than 10 seconds.

Constraints

  • Do not change the application code — /usr/local/bin/order-desk and /usr/local/bin/stock-store.
  • You may reboot the machine as often as you like: the terminal shows the boot and logs in as student again. "Check" looks at a boot that happened after the machine was prepared, so reboot it after your fix.

There is no internet on the machine; everything you need is installed. How the service starts is visible in systemctl status lab-orders and journalctl -u lab-orders; what holds up the boot — in systemd-analyze blame and systemd-analyze critical-chain.

Visible only to you. Saved as you type.

All notes

Lab goals

0 of 4
  • lab-orders starts the lab-stock store itself and starts after it (Wants= and After=), with no reverse ordering — not checked yet
  • systemd-analyze verify lab-orders.service lab-stock.service prints no warnings — not checked yet
  • lab-orders is running, enabled at boot and answers on http://127.0.0.1:8090/health; the application code is unchanged — not checked yet
  • After a reboot (sudo reboot) lab-orders came up on its own at the first attempt and held up the boot for no more than 10 s — not checked yet

Hints

0 of 3 open · they open one at a time
Hint 1
Show the solution after 3 failed checks

Leave the lab?

The machine keeps running for 10 more minutes, then it is removed. Files are lost; completed goals stay.

Loading…