Skip to content
Latchkey

apt-get: "No space left on device" Installing Packages

An apt-get operation failed because downloading or unpacking .deb files hit ENOSPC. The apt cache plus unpacked files outgrew the runner disk.

What this error means

Install fails with No space left on device during download or dpkg unpack. Clearing the apt cache or freeing other space lets it complete with no change to the package list.

shell
E: Failed to fetch ... No space left on device
dpkg: error processing archive (--unpack):
 cannot copy extracted data: No space left on device

Common causes

Apt cache plus unpacked files exhaust the disk

Downloaded .deb archives and their unpacked contents can be large; on a near-full runner they push the disk over the edge.

Disk already heavily used by the build

Checkout, tooling, and prior steps may leave little headroom for an apt install.

How to fix it

Free space and clean the apt cache

Reclaim room, then install with cache cleanup.

shell
df -h
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update && sudo apt-get install -y --no-install-recommends <pkg>

Install fewer or smaller packages

  1. Use --no-install-recommends to skip optional dependencies.
  2. Remove large preinstalled SDKs you do not need.
  3. Move the job to a larger-disk runner if installs are big.

How to prevent it

  • Run apt-get clean after installs in long jobs.
  • Prefer --no-install-recommends.
  • Right-size disk for package-heavy setup steps.

Frequently asked questions

What causes "apt-get out of disk"?
Downloaded .deb archives and their unpacked contents can be large; on a near-full runner they push the disk over the edge.
How do I fix apt-get out of disk?
Reclaim room, then install with cache cleanup.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card