When I get the message for a Software Update and click to install I get a message "Insufficienct space" telling me to empty trash and remove temporary files using sudo apt-get clean
. I have emptied the trash but I still get the same message and don't know what temporary files to remove or what sudo apt-get clean
is.
Asked
Active
Viewed 1.2e+01k times
22
2 Answers
24
sudo apt-get clean
clears out the local repository of retrieved package files.It removes everything but the lock file from /var/cache/apt/archives/
and /var/cache/apt/archives/partial/.
Source : man apt-get
Another possibility to see what happens when we use the command sudo apt-get clean
is to simulate the execution with the -s
-option.
~$ apt-get -s clean
NOTE: This is only a simulation!
apt-get needs root privileges for real execution.
Keep also in mind that locking is deactivated,
so don't depend on the relevance to the real current situation!
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/lib/apt/lists/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin
~$ sudo apt-get -s clean
[sudo] password for mook:
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/lib/apt/lists/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin
Thanks to @jarno for the suggestion.

mook765
- 15,925
-
2You could simulate the command to show what it would do by running
apt-get -s clean
as regular user. It seems to delete a couple of files in /var/cache/apt/ besides the above mentioned ones. – jarno Mar 20 '17 at 10:00 -
1
4
If you receive the message "Insufficienct space" and the command sudo apt-get clean
is insufficient, try this:
Open a terminal,
Press Ctrl+Alt+T
Run it:
sudo -i # (Allows you to execute commands with the privileges of the superuser.)
KERNELCUR=$(uname -r | sed 's/-*[a-z]//g' | sed 's/-386//g')
PKGLINUX="linux-(image|headers|ubuntu-modules|restricted-modules)"
METAPKGLINUX="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
KERNELSOLD=$(dpkg -l | awk '{print $2}' | grep -E "$PKGLINUX" | grep -vE "$METAPKGLINUX" | grep -v "$KERNELCUR")
apt-get purge "$KERNELSOLD" # (Remove old kernels.)
CONFOLD=$(dpkg -l | grep '^rc' | awk '{print $2}')
apt-get purge "$CONFOLD" # (Removes configuration files from deb packages that have been uninstalled.)
apt-get autoremove # (Deletes orphaned packages, or dependencies that remain installed after you have installed an application and then deleted it.)
apt-get clean # (Removes all packets from the cache.)
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null # (Empty the trash from all users.)
rm -rf /root/.local/share/Trash/*/** &> /dev/null # (Empty the trash from root.)
-
It would purge metakernel "linux-image-generic" in my system, if the depending kernel is not the current one thus preventing further kernel updates from being shown. – jarno Mar 20 '17 at 10:22
-
-
1
lsb_release -r
in terminal) – jarno Mar 20 '17 at 09:48sudo apt-get clean
and emptying trash would probably not help , if your system has a separate partition for /boot. – jarno Mar 20 '17 at 10:08