Linux Labs

Inside the system: resources, kernel, processes / Stage 2 of 12

Memory, swap and the OOM killer

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 9 · on a machine · 4 min

A service restarts by itself

What you will learn

  • Read free -h and tell free memory from available memory.
  • Find an OOM kill in the service log and in journalctl -k.
  • Change a service's memory ceiling MemoryMax= with a unit drop-in file.

Users complain that picture previews on the site appear only every other time. The lab-thumbs service that makes them seems to be running. Look at it and at the machine's memory.

Exercise · look

Look at the preview service

Look at the state of the lab-thumbs service, the last lines of its log and the machine's memory.

First, predict

The preview service keeps being restarted. How much memory will free show for the machine in the available column?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

The lab-thumbs process was killed. What does systemd do next, according to the service log?

  • Then status would say failed. Here it says activating (auto-restart), and the log has Scheduled restart job.

  • The machine keeps running: the service log says Scheduled restart job, restart counter is at … — only the service restarts.

systemd starts the service again a few seconds later, and the restart counter grows.

Ubuntu 24.04
Loading…