You are not logged in.

#1 2015-12-20 00:34:13

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Wiped Contents of /var/cache/apt/archives

After running dpkg -l, I noticed lines preceded with rc in the resulting output.  Some of those lines were details of packages that I had purged (aptitude purge) a long time ago.  I also had a look in /var/cache/apt/archives and noted debs that I had purged and that didn't even show up on the output of dpkg -l.  So, I did a bit of searching on the 'net and discovered aptitude clean --purge-unused.  I thought that command might remove the unused packages, but it wiped out everything.

So, my first question is, is it okay not to have any of the debs for the installed packages on my system?  If it's not okay, how do I get the debs again?  I've read about a dpkg command that can build debs from installed packages, but I'm not sure if that would be the correct method.

My second question is, in the future what is the best/correct method of removing unused deb files?  Would deborphan work?

Offline

#2 2015-12-20 00:49:42

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Wiped Contents of /var/cache/apt/archives

KrunchTime wrote:

is it okay not to have any of the debs for the installed packages on my system?

Yes, as long as your system is running fine at the moment and any recent upgrades have not introduced any bugs.

The .debs in /var/cache/apt/archives are from packages you have already installed and are only useful for emergency downgrading after a dist-upgrade leaves a buggy new package on the system.

As long as there are no new bugs introduced after an upgrade, it is safe to clean the cache.

This isn't so critical in Debian anyway as different package versions can be pulled from other repositories with careful use of APT pinning.

Offline

#3 2015-12-20 00:50:04

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Wiped Contents of /var/cache/apt/archives

You have just done what `apt-get clean` does.

See `man apt-get` for other things apt-get can do. (`update` should repopulate the cache, I think)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#4 2015-12-20 00:56:33

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: Wiped Contents of /var/cache/apt/archives

@HoaS:  System is running fine and it's Debian Stable, so an upgrade introducing bugs shouldn't happen with the possible exception of installs from Backports and gdebi installs of a smattering of debs.

@damo:  I realize that apt-get has a similar command.  I prefer to use aptitude under Debian Stable, but I do use apt-get under my BL install tracking Debian Unstable.  I tried aptitude update, but that didn't re-download the deb files.

I thank both of you for your input.

Last edited by KrunchTime (2015-12-20 00:57:08)

Offline

#5 2015-12-20 01:00:12

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Wiped Contents of /var/cache/apt/archives

KrunchTime wrote:

@HoaS:  System is running fine and it's Debian Stable, so an upgrade introducing bugs shouldn't happen with the possible exception of installs from Backports and gdebi installs of a smattering of debs.

Oh OK, I thought you were running sid hmm

In that case, yes it's fine to clear the cache regularly.

Having said that, it doesn't take up much space...

Offline

#6 2015-12-20 01:04:23

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: Wiped Contents of /var/cache/apt/archives

I do run Sid, on a separate partition.  However, I wiped the cache under my BL stable install.  wink

The reason I started looking at my package list is the other day I installed Lyx to take it for a test drive.  I quickly decided I didn't want to keep it, so I purged lyx which left a boat load of packages that weren't purged.  Perhaps I should have purged lyx-common.  In any case, I ended up having to individually purge practically all of the packages that came with the lyx install, but my used drive space afterwards wasn't down to where it was prior to the install.

I also tried using aptitude autoclean, but that didn't clear out the unused debs either.

One other oddity, dpkg -l still shows package detail lines preceeeded with rc, even though I no longer have any debs under /var/cache/apt/archives.  From my understanding, rc means the configuration files for the package haven't been removed, but I've manually deleted the config files under ~/.confighmm

Last edited by KrunchTime (2015-12-20 01:17:16)

Offline

#7 2015-12-20 04:58:48

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,746

Re: Wiped Contents of /var/cache/apt/archives

There seems to be a lot of stuff to configure in /etc/cron.daily/apt considering cache size (I haven't test any), a thread
http://unix.stackexchange.com/questions … t-archives

Offline

#8 2015-12-22 02:40:22

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,652
Website

Re: Wiped Contents of /var/cache/apt/archives

KrunchTime wrote:

One other oddity, dpkg -l still shows package detail lines preceeeded with rc, even though I no longer have any debs under /var/cache/apt/archives.  From my understanding, rc means the configuration files for the package haven't been removed, but I've manually deleted the config files under ~/.confighmm

If you run 'apt-get purge <packagename>' those 'rc' entries should disappear.

That command removes the package's own config files (usually under /etc) but no system commands will remove a user's personal config files. (It would be rather rude of a system admin to delete every user's config files for some package.) Also dpkg has no knowlege of what you have under ~/.

The apt cache does no harm at all except for taking up disk space. Occasionally those deb files can be handy, but they have no effect on the working of apt. 'apt-get clean' (not autoclean which is different) will remove them.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#9 2015-12-22 10:40:53

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: Wiped Contents of /var/cache/apt/archives

@johnraff:  I believe aptitude purge <pkg name> does the same thing and that's what I used.  However, the rc lines for packages I purged quite awhile ago still appear in the output of dpkg -l.

Edit:  I created a text file containing the output of dpkg -l and went through the list and purged each package name with an rc next to it.  I now understand what I did wrong.  For example, I purged vim-common long ago, but that only removed vim-tiny.  Purging vim-tiny, technically just removing the configuration file(s), results in the package not showing up in the output of a later dpkg -lroll

Last edited by KrunchTime (2015-12-22 11:59:14)

Offline

#10 2015-12-22 15:37:14

porkpiehat
Member
Registered: 2015-10-27
Posts: 31

Re: Wiped Contents of /var/cache/apt/archives

http://www.commandlinefu.com/commands/v … ed-systems

and the one I use (this will probably work with "aptitude purge", but I have not tested it):

sudo apt-get purge $(dpkg -l | awk '/^rc/ { print $2 }')

Last edited by porkpiehat (2015-12-22 15:38:06)

Offline

#11 2015-12-25 12:02:08

KrunchTime
Member
Registered: 2015-09-29
Posts: 857

Re: Wiped Contents of /var/cache/apt/archives

^ Thank you very much for the link.  I think I'll try the aptitude purge ~c command the next time I run into the rc issue.

Last edited by KrunchTime (2015-12-25 12:02:31)

Offline

Board footer

Powered by FluxBB