old RPMs in /var/cache/zypp/packages

Looking around for cruft to clean up I found the folder /var/cache/zypp/packages. There are sub-folders under here for each repository set up in YaST and then noarch and x86_64 folders under there. Many of them don’t have anything in there, but there are a few random RPMs in some of them. However, the sub-folder repo-oss/suse/x86_64 has about 15 old kernel RPMs. I assume it is safe for me to delete these RPMs? Is there a reason they have been accumulating here?

Hi,

Most probably you have the packages cache enabled on some repos.

When using yast2 you can check the repos.

yast2 repositories

alternatively you can check using the command line.

tail -n +1 /etc/zypp/repos.d/*.repo

The one you’re looking for is the line that has the following entry

keeppackages=1

The command “zypper clean” should clear those out. Removing them manually also works.

How did they get there? As another user has said, you might have told the system to keep packages. However, I think that’s unlikely, or you would have many more of those rpm files.

At some time in the past (or several times) you may have aborted an update after the packages had been downloaded. For example, you might have seen a problem with “checking file conflicts” and aborted.

If you later reran that update, you would use packages already downloaded. And, after installing, they would disappear from that cache. But, in some case, by the time you reran the update some of those packages might have been updated again. And in that case, zypper will download the newer version and the uninstalled older version of the package remains in the package cache.

Ahh, this is sounding familiar. For a while on some updates that ran dracut zypper (or something) would freeze up. I could let it sit for 15 or more minutes and nothing else would happen, so I would end up doing a Ctrl-C to abort those updates and then run zypper again, which would complete the updates. So this makes sense why it is mostly kernel packages in the cache. Eventually this stopped being an issue and there is no “freezing” during updates. I’m guessing this is where the packages came from; I looked in the repository configs and none of them have keeppackages=1.

I’ve cleared it out now, thanks for the information!