A laptop with broken screen that I access via SSH. The sudo apt-get autoremove command gives me the following errors

cp: error writing ‘/tmp/mkinitramfs_zN6ZvT//lib/x86_64-linux-gnu/libpthread.so.0’: No space left on device
cp: failed to extend ‘/tmp/mkinitramfs_zN6ZvT//lib/x86_64-linux-gnu/libpthread.so.0’: No space left on device
cp: error writing ‘/tmp/mkinitramfs_zN6ZvT//sbin/modprobe’: No space left on device
cp: failed to extend ‘/tmp/mkinitramfs_zN6ZvT//sbin/modprobe’: No space left on device
cp: error writing ‘/tmp/mkinitramfs_zN6ZvT//sbin/rmmod’: No space left on device
cp: failed to extend ‘/tmp/mkinitramfs_zN6ZvT//sbin/rmmod’: No space left on device

I get similar errors from various other commands but gparted tells me there is more than 20GB space left on the (single) partition on the laptop. Here is the output of df

$ df -i
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
udev            502644    484  502160    1% /dev
tmpfs           505433    503  504930    1% /run
/dev/sda1      7331840 214087 7117753    3% /
none            505433      2  505431    1% /sys/fs/cgroup
none            505433      3  505430    1% /run/lock
none            505433      4  505429    1% /run/shm
none            505433     16  505417    1% /run/user
overflow        505433    401  505032    1% /tmp


$ df -k
Filesystem     1K-blocks     Used Available Use% Mounted on
udev             2010576       12   2010564   1% /dev
tmpfs             404348     1284    403064   1% /run
/dev/sda1      115247656 83994028  25809372  77% /
none                   4        0         4   0% /sys/fs/cgroup
none                5120        0      5120   0% /run/lock
none             2021732      204   2021528   1% /run/shm
none              102400       16    102384   1% /run/user
overflow            1024     1024         0 100% /tmp

Error started after I ran sudo apt-get upgrade.

  • Please remove unneeded files with: sudo apt autoremove and recheck your space May 28, 2017 at 15:53
  • Have you tried sudo apt autoclean?
    – Ravexina
    May 28, 2017 at 16:01
  • 1
    Ehmm in the question it is mentioned that autoremove gives me errors. autoclean does not do anything.
    – Reza
    May 28, 2017 at 16:20

5 Answers 5


At some point in the past, your root filesystem filled up, and a small, temporary /tmp was created to allow boot to succeed. This small /tmp was never deleted, so now, even though you have room on /, you still are filling up the small /tmp and seeing your problem. Simply unmount it:

sudo umount /tmp

and of course, try to ensure your / is as clean as possible.

Normally, /tmp is just a part of the root (/) filesystem, no separate mount is needed, unless there are special circumstances, like running out of root filespace (when some daemon creates the one you see), or maybe you have / on a very slow media (like an USB flash stick) and want /tmp in ram for performance, even with limited space.

  • OK I did so using -l option and ran autoremove. How do I mount it back now?
    – Reza
    May 28, 2017 at 23:29
  • 5
    it gives me umount: /tmp: not mounted. what should i do ?
    – mrid
    Sep 27, 2017 at 6:51
  • You have a different problem, so ask your own question and provide your specific information.
    – ubfan1
    Sep 27, 2017 at 15:12

If you run into this problem, where you get errors that seem to indicate that the disk is full when it's not, make sure to also check the inode utilization.

You can use df -i to get a quick report on the used/available inodes for each mount point.

If you see that you are running very low, or out of, inodes then the next step is to identify which folder is holding up most inodes. Since each file and directory uses an inode, you could have a folder with hundreds of thousands of tiny, or empty files that are using up all the inodes. Usual suspects include: temp directory, website cache directories, package cache directories etc.

Use this command to get an ordered list of the subdirectories with the most inodes used:

sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n

Run this in your root folder, then drill down until you find your culprit.


I believe you have a lot of unused files remove them with:

sudo apt autoremove

Then re-check your space with df command

  • I run into this No space on disk issue, then I run rebootfrom terminal. Now the system cannot starts. After reboot, no the login screen isn't displayed but a dark screen. How do I fix it please.
    – arilwan
    Mar 8, 2020 at 8:51

Your /tmp directory is set to overflow, so there is not enough disk space in that directory to perform apt-get operations

you can for your terminal session change the location of tmp for apt-get in order to perform the operation

mkdir -p /home/<user>/tmp
export TMPDIR=/home/<user>/tmp


To see how many inodes per folder:

du * -s --inodes

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .