I am building an image for an embedded Linux based on Debian. I did use apt-get update
before on the device that I want to use as a base for that image, so the lists under /var/lib/apt/lists
are quite large (almost 100 MB in size).
I want to keep apt-get
functionality (so I don't want to remove apt repositories) but I want to free the space used up in these lists (the lists almost double the size of the image).
Does anyone know how to do that? Can I just delete the files under /var/lib/apt/lists
?
Best Answer
You can just use:
This will remove the package lists. No repositories will be deleted, they are configured in the config file in
/etc/apt/sources.list
. All that can happen is that tools likeapt-cache
cannot get package information unless you updated the package lists. Alsoapt-get install
will fail withE: Unable to locate package <package>
, because no information is available about the package.Then just run:
to rewrite those lists and the command will work again.
Anyway, it's recommended to run
apt-get update
before installing anything.