The command sudo apt-get upgrade says


Need to download 105 MB in archives.

After this operation, 2.108 kB disk space will be used

E: Not enough space in /var/cache/apt/archives

(This is translated from a German system. Don't expect it to be 100% correct).

I'm using an 8 GB Micro SD Card and there should be plenty of space left. I checked with df -h.

/dev/root     7.2G     6.0G    869M     88%    /

I understand that 7.2G - 6.0G can be less than 1.2G, because of file system overhead.

However, I don't see why downloading 105M should be a problem.

I was able to solve the problem by freeing additional 540M from the recycle bin, but I'd still like to understand why apt-get complains about disk space when there's enough disk space left (IMHO).

Additional information that was requested:

Yes, all /var and its subdirectories are on /dev/root. It's a default Raspbian installation. I checked all of them with df -P <dir>:

$ df -P /var
/dev/root    7527272   5999148    1158916   84%    /
  • is /var actually mounted under / ? It is possible that it is a separate partition. a full df -h would be helpful to determine that. Good Luck!
    – recklessop
    Jan 31, 2019 at 14:24
  • Yes, /var is on /. I added that information (output of df -P /var) Jan 31, 2019 at 14:30
  • How about /var/cache? Could that be a temporary filesystem? Output from mount or cat /proc/mounts will tell you. Also, it'd be nice if could maybe try sudo apt-get -d upgrade if it happens again to see if the new archives can at least be downloaded. Jan 31, 2019 at 15:55
  • The Why apt-get complains about disk space when there's enough disk space left? is a unix.stackexchange.com question... isn't it?
    – GramThanos
    Jan 31, 2019 at 23:00
  • @GramThanos: yes, maybe. However, the context may help, e.g. it may happen more often due to limited SD card sizes. Also, we can assume the default partition layout. It may especially help people finding a solution when they google for Raspberry + this error message. I feel quite ok leaving the question here, but that's for the community to decide. Feb 1, 2019 at 9:56

2 Answers 2


I prefer to use apt but it has the same functionality than apt-get. Here is a typical upgrade:

rpi ~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 13.3 kB of archives.
After this operation, 73.7 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://archive.raspberrypi.org/debian stretch/ui armhf python3-six all 1.12.0 [13.3 kB]
Fetched 13.3 kB in 6s (2,159 B/s)
Reading changelogs... Done
(Reading database ... 34672 files and directories currently installed.)
Preparing to unpack .../python3-six_1.12.0_all.deb ...
Unpacking python3-six (1.12.0) over (1.10.0-3) ...
Setting up python3-six (1.12.0) ...
2019-01-31 17:18:04 py2deb.hooks[2622] INFO Generated 1 Python bytecode files(s) for python3-six package.

As you can see it is announced
Need to get 13.3 kB of archives.
and exactly this is done with
Fetched 13.3 kB in 6s (2,159 B/s).

Afterwards apt is doing

Preparing to unpack .../python3-six_1.12.0_all.deb ...
Unpacking python3-six (1.12.0) over (1.10.0-3) ...
Setting up python3-six (1.12.0) ...

Unpacking the downloaded package and setup it up needs additional storage space that does not get into count of Need to get 13.3 kB of archives. This is what you give the error message if there is not enough space left.

Btw. doing apt clean before upgrading and using apt full-upgrade will clean up some storage.


Be aware that Ext filesystems reserve 5% of space when partitioned.

(Expanding on my earlier answer per @ThomasWeller request:)

Let's take a look at my 32GB MicroSD card I dd'ed Raspbian on to.

fdisk -l (output truncated) shows of my 32GB card, the root filesystem /dev/mmcblk0p2 occupies 29.7GB:

Output of fdisk -l

df -h thus shows "30G" as total size. However, if we add "Used" + "Avail" this totals only 28.2G:

Output of df on a 32GB MicroSD Card

Are 1.8GB missing?

1.8G/30G total = 6% With rounding, that approximates the size of the 5% reserved space. So "30G" is the absolute TOTAL space and "28.2G" is the effective USABLE space as I can't use that 5% for general purposes.

Also, you can have files that were deleted, but the space they consumed is not thrown back into the storage pot for re-use until the process has been killed (or you reboot which will clear the process). You can analyze situations like this using sudo lsof +L1. Specimen output follows:

Output of sudo lsof +L1

So output of df can be a bit confusing and when trying to free space, files you deleted might not be reflected in the "Avail" total in df results making them even more confusing ;-)

  • 1
    5% of 8G is 400M. 869M free - 400M reserved = 469M. Still enough to download 105M, isn't it? Or did I get something wrong? Jan 31, 2019 at 16:57
  • The 5% isn’t against the 8GB, it’s against that 7.2 GB. That’s the starting point for your calculations of the 5% reserved space
    – F1Linux
    Feb 1, 2019 at 7:12
  • regarding 7.2G: In that case it becomes even less understandable: 5% of 7.2G is only 360M. 869M - 360M = 509M. Feb 1, 2019 at 9:51
  • 1
    Have you tried hunting for files which are deleted, but the system doesn't yet recognize that free space with sudo lsof +L1 as suggested in the second part of my answer? That can throw-off the figures df displays.
    – F1Linux
    Feb 1, 2019 at 10:00
  • No, I haven't. However, since I'm doing hardware development as well (using GPIO), I shutdown the machine often when I make changes. Feb 1, 2019 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.