Upgrade failed: low disk space -- excess overlay files?

I was running out of space on a 50GB Linode VPS.

Below are some space hogs that haven’t been mentioned yet. Some are Discourse-specific, some are general to Linux systems.

  1. Run ll /lib/modules. I was surprised to see about 15GB of old kernels that apt autoremove didn’t care to remove. Claude thinks they were installed in a non-standard way, and generated a safe removal script. It took about an hour but it worked (run at your own risk, of course) and I was able to run ./launcher rebuild without the no space left on device error.

  2. The script didn’t delete the corresponding headers in /usr/src. For that ChatGPT created another script.

  3. About half a gigabyte of space was taken by useless locales.

  4. Another GB+ was taken by the /var/lib/docker/overlay2/.../merged/home/discourse/.cache directory.

Maybe a stupid question, but what exactly do the merge and diff directories contain? Can one of them be deleted safely at some point?