Linux Labs

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

dmesg and the kernel log

Not running Starting usually ~20 s
Leave the lesson

Step 2 of 8 · on a machine · 4 min

The kernel buffer

The cat and touch errors tell what happened, but the kernel knows why: it writes about such events itself.

Disks, filesystems, memory and crashing processes are all handled by the kernel. It writes what it notices as lines into a ring buffer — a fixed-size area of memory: when it fills up, new lines overwrite the oldest ones. The buffer starts at boot and is gone at power-off.

dmesg reads the buffer. Ubuntu closes it to ordinary users, so you need sudo. The time at the start of a line is seconds since boot, and the -T option turns it into a date and time. Fresh lines are at the end, hence tail.

Exercise · look

Read what the kernel wrote

Open the July orders in /mnt/archive once more, then read the last lines of the kernel buffer — first without sudo, then with sudo.

First, predict

The kernel records which process ran into the error. Which program will it name?

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
Ubuntu 24.04
Loading…