Linux Labs

Inside the system: resources, kernel, processes / Stage 2 of 12 · step 8 of 9

A build runs out of memory

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

Situation

Every night the lab-build.timer timer starts the search index build of the docs site — the lab-build service. The build is given 192 MiB of RAM: the site and the database need the rest. There are more pages now, and the index has not been updated for several nights in a row. The build can be started in the daytime too: sudo systemctl start lab-build.

The build cannot be given more RAM. The decision is to give the machine swap: whatever does not fit into 192 MiB goes to the disk — the build runs slower, but it finishes.

Task

  1. The swap is a file of exactly 512 MiB, and it is on. Process memory ends up in swap, so only root may read and write the file (mode 600).
  2. After a reboot the swap comes on by itself, and the swap lines in /etc/fstab cause no errors at boot.
  3. The system is reluctant to send memory to swap: vm.swappiness = 10 now and after a reboot, and the setting is written as a file in /etc/sysctl.d.
  4. The sudo systemctl start lab-build build passes — the check will start it itself. Do not change the build unit or its memory limit.

The machine has no internet access; the programs you need are already installed.

Visible only to you. Saved as you type.

All notes

Lab goals

0 of 4
  • A swap file of exactly 512 MiB is on, owned by root with mode 600 — not checked yet
  • The swap file is listed in /etc/fstab, and there are no swap lines for files that do not exist — not checked yet
  • vm.swappiness = 10 now and after a reboot, from a file in /etc/sysctl.d — not checked yet
  • The nightly lab-build build passes within the same 192 MiB memory limit — 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…