All versions - There are over 500,000 zypp directories in /var/tmp - a fix

I noticed that my backups keep getting bigger - I went to figure out why.

I have migrated from 41 > to 15.2 over the years - it turns out that zypp.xxxxx directories never get deleted. I have them back to 2009.

So I created this script to delete all but today’s zypp files - If the start count is 0 then there were too many for the shell to count.

They seem to be created every 10 minutes by packagekit.

# cat zippclean
DTE=`date | cut -c5-10`
cd /var/tmp
echo start count 
ls -l zypp* | wc -l
ls -ltr | grep -v ":" | awk '{print $9}' | xargs -n1 rm -rf
echo count after deleting past years
ls -l zypp* | wc -l
ls -ltr | grep -v "$DTE" | awk '{print $9}' | xargs -n1 rm -rf
echo count after delete all but todays
ls -l zypp* | wc -l
#

to create it I used vi - you can use any editor
to run it** sudo sh zippclean**

Please, when you make a script, then always start it with a “shebang”. Thus when this is ment to be a bash script:

#!/bin/bash

You think this is done by PackageKit. Then I am not touched, never install it :wink:

Checking here, I have only 5 such directories. And the newest has a date of Jul 14.

Checking on another system, I notice 40 directories. On that system, I am allowing the desktop updater to run. On my main desktop (using KDE), I disabled that in tray settings.

I guess the update applet is responsible for many of those directories.

I got rid of most of those 40 using:


find . -name 'zypp.*' -mtime +7 -print0 | xargs -0 /usr/bin/rm -rf

You wouldn’t need to restore data from {,/var}/tmp.

Perhaps, but PK isn’t alone in that. Due to the prefix it’s likely libzypp, so possibly zypper as well.

I backup /var - /var/tmp is a part of it.

Everyone should do an “ls /var/tmp” - I was shocked that it could not display it - it was too big.


ls /var/tmp
systemd-private-747227c44ede4594811092716e4a6471-chronyd.service-AbTRVv
systemd-private-747227c44ede4594811092716e4a6471-colord.service-j4MmZJ
systemd-private-747227c44ede4594811092716e4a6471-ModemManager.service-kowgX3
systemd-private-747227c44ede4594811092716e4a6471-rtkit-daemon.service-ezPhq4
systemd-private-747227c44ede4594811092716e4a6471-upower.service-Kl6ucV
zypp.0MgH2z
zypp.dVt06H
zypp.eUGwqM
zypp.pwfG0E
zypp.ZEw3CQ

Not very big here.

henk@boven:~> ls -l /var/tmp
total 116
drwx------ 5 henk   users 4096 Jun 18 14:36 kdecache-henk
drwx------ 2 kdm    kdm   4096 Mar 17  2017 kdecache-kdm
drwx------ 2 marian wij   4096 Jan 22  2020 kdecache-marian
drwx------ 2 marian users 4096 Apr 15  2017 kdecache-test
drwx------ 2 mysql  mysql 4096 Dec 21  2018 mysql-protected.1AYbRU
drwx------ 2 mysql  mysql 4096 Dec  2  2018 mysql-protected.21TlOp
drwx------ 2 mysql  mysql 4096 Oct 19  2018 mysql-protected.Cqb5th
drwx------ 2 mysql  mysql 4096 Nov  3  2018 mysql-protected.PYCAVU
drwx------ 2 mysql  mysql 4096 Nov 25  2018 mysql-protected.Qfm3bU
drwx------ 2 mysql  mysql 4096 Dec 22  2018 mysql-protected.SDKcnz
drwx------ 2 mysql  mysql 4096 Dec 25  2018 mysql-protected.T0K5yG
drwx------ 2 mysql  mysql 4096 Dec 21  2018 mysql-protected.UvriYB
drwx------ 2 mysql  mysql 4096 Oct 19  2018 mysql-protected.Wz3MmX
drwx------ 2 mysql  mysql 4096 Dec 26  2018 mysql-protected.ddChvf
drwx------ 2 mysql  mysql 4096 Oct 19  2018 mysql-protected.fRsXtT
drwx------ 2 mysql  mysql 4096 Nov  3  2018 mysql-protected.lL4nsj
drwx------ 2 mysql  mysql 4096 Dec  8  2018 mysql-protected.le6lNn
drwx------ 2 mysql  mysql 4096 Nov 25  2018 mysql-protected.w1BD7f
drwx------ 3 root   root  4096 Aug 14 09:47 systemd-private-c2fa9be939df4d37a8ba7c8d116498fb-apache2.service-edHji2
drwx------ 3 root   root  4096 Aug 14 09:47 systemd-private-c2fa9be939df4d37a8ba7c8d116498fb-ntpd.service-WMofYZ
drwx------ 3 root   root  4096 Aug 14 09:47 systemd-private-c2fa9be939df4d37a8ba7c8d116498fb-rtkit-daemon.service-mmvwtA
drwx------ 5 root   root  4096 Jan 31  2018 zypp.RvH04k
drwx------ 5 root   root  4096 Dec 29  2017 zypp.XNGgyi
drwx------ 5 root   root  4096 Dec 27  2017 zypp.dLOJFn
drwx------ 5 root   root  4096 Dec 27  2017 zypp.kBTtAy
drwx------ 5 root   root  4096 Dec 30  2017 zypp.nZDYgD
drwx------ 5 root   root  4096 Jan 31  2018 zypp.oTEk2h
drwx------ 5 root   root  4096 Jan  7  2018 zypp.sJeHkn
drwx------ 5 root   root  4096 Dec 30  2017 zypp.uzg1Ai
henk@boven:~> 

And I did not cheat.

I wonder if it is MATE that leaves these here? I run MATE desktop.

I had zypp.xxxx files back to 2010 this is after cleaning

llrainey@VM1:~> ls -ltr /var/tmp
total 396
drwx------ 5 root root 4096 Aug 14 00:07 zypp.D91cbY
drwx------ 4 root root 4096 Aug 14 00:17 zypp.kxdKkE
drwx------ 4 root root 4096 Aug 14 00:27 zypp.LI4YcD
drwx------ 4 root root 4096 Aug 14 00:37 zypp.vDfm4o
drwx------ 4 root root 4096 Aug 14 00:47 zypp.TOFhyi
drwx------ 4 root root 4096 Aug 14 00:57 zypp.d2Yc0l
drwx------ 4 root root 4096 Aug 14 01:07 zypp.Hdap22
drwx------ 4 root root 4096 Aug 14 01:17 zypp.aPUR9F
drwx------ 4 root root 4096 Aug 14 01:27 zypp.mKF2TK
drwx------ 4 root root 4096 Aug 14 01:37 zypp.eBvuSy
drwx------ 4 root root 4096 Aug 14 01:47 zypp.wYAsyl
drwx------ 4 root root 4096 Aug 14 01:57 zypp.bTF3iq
drwx------ 4 root root 4096 Aug 14 02:07 zypp.uonGJ6
drwx------ 4 root root 4096 Aug 14 02:17 zypp.puY9IJ
drwx------ 4 root root 4096 Aug 14 02:27 zypp.EeC1Qw
drwx------ 4 root root 4096 Aug 14 02:37 zypp.jIss6x
drwx------ 4 root root 4096 Aug 14 02:47 zypp.Cnxxen
drwx------ 4 root root 4096 Aug 14 02:57 zypp.cb6RXq
drwx------ 4 root root 4096 Aug 14 03:07 zypp.9nLwFa
drwx------ 4 root root 4096 Aug 14 03:17 zypp.f5I5ZZ
drwx------ 4 root root 4096 Aug 14 03:27 zypp.itP3tY
drwx------ 4 root root 4096 Aug 14 03:37 zypp.MFbA6M
drwx------ 4 root root 4096 Aug 14 03:47 zypp.cOw2jA
drwx------ 4 root root 4096 Aug 14 03:57 zypp.A69scF
drwx------ 4 root root 4096 Aug 14 04:07 zypp.SAdSQp
drwx------ 4 root root 4096 Aug 14 04:17 zypp.IGMF3a
drwx------ 4 root root 4096 Aug 14 04:27 zypp.8xhSFa
drwx------ 4 root root 4096 Aug 14 04:37 zypp.ZiZzkW
drwx------ 4 root root 4096 Aug 14 04:47 zypp.5t28MG
drwx------ 4 root root 4096 Aug 14 04:57 zypp.3SppzG
drwx------ 4 root root 4096 Aug 14 05:07 zypp.4v1K5m
drwx------ 4 root root 4096 Aug 14 05:17 zypp.fCad98
drwx------ 4 root root 4096 Aug 14 05:27 zypp.4hh7ab
drwx------ 4 root root 4096 Aug 14 05:37 zypp.gVwzp6
drwx------ 4 root root 4096 Aug 14 05:47 zypp.T3QaQQ
drwx------ 4 root root 4096 Aug 14 05:57 zypp.t3iwfB
drwx------ 4 root root 4096 Aug 14 06:07 zypp.cKo7fm
drwx------ 4 root root 4096 Aug 14 06:17 zypp.ZFqfJ9
drwx------ 4 root root 4096 Aug 14 06:27 zypp.kTXlFg
drwx------ 4 root root 4096 Aug 14 06:37 zypp.VkPMT9
drwx------ 4 root root 4096 Aug 14 06:47 zypp.eLsgPI
drwx------ 4 root root 4096 Aug 14 06:57 zypp.E7ePpN
drwx------ 4 root root 4096 Aug 14 07:07 zypp.U5F4vv
drwx------ 4 root root 4096 Aug 14 07:17 zypp.S6fsZc
drwx------ 4 root root 4096 Aug 14 07:27 zypp.pxRBLg
drwx------ 4 root root 4096 Aug 14 07:37 zypp.8tB24k
drwx------ 4 root root 4096 Aug 14 07:47 zypp.RjYm5X
drwx------ 4 root root 4096 Aug 14 07:57 zypp.VvWNd3
drwx------ 4 root root 4096 Aug 14 08:07 zypp.5tTa6H
drwx------ 4 root root 4096 Aug 14 08:17 zypp.O73qQq
drwx------ 4 root root 4096 Aug 14 08:27 zypp.utF6Gv
drwx------ 4 root root 4096 Aug 14 08:37 zypp.8eFOEp
drwx------ 4 root root 4096 Aug 14 08:47 zypp.hmFxo8
drwx------ 4 root root 4096 Aug 14 08:57 zypp.NkCsza
drwx------ 4 root root 4096 Aug 14 09:07 zypp.EOg15I
drwx------ 4 root root 4096 Aug 14 09:17 zypp.y0Nfcv
drwx------ 4 root root 4096 Aug 14 09:27 zypp.0Eavst
drwx------ 4 root root 4096 Aug 14 09:37 zypp.HXeevm
drwx------ 4 root root 4096 Aug 14 09:47 zypp.fB27E8
drwx------ 4 root root 4096 Aug 14 09:57 zypp.nXZq87
drwx------ 4 root root 4096 Aug 14 10:17 zypp.zzjbLz
drwx------ 4 root root 4096 Aug 14 10:27 zypp.fH67IK
drwx------ 4 root root 4096 Aug 14 10:37 zypp.kLS4os
drwx------ 4 root root 4096 Aug 14 10:47 zypp.Plw7I3
drwx------ 4 root root 4096 Aug 14 10:57 zypp.t83Gb7
drwx------ 5 root root 4096 Aug 14 11:07 zypp.4lmkGO
drwx------ 4 root root 4096 Aug 14 11:27 zypp.1emsuH
drwx------ 4 root root 4096 Aug 14 11:37 zypp.0n7imB
drwx------ 4 root root 4096 Aug 14 11:47 zypp.dYU9Nc
drwx------ 4 root root 4096 Aug 14 11:57 zypp.PytNye
drwx------ 4 root root 4096 Aug 14 12:07 zypp.3lryxZ
drwx------ 4 root root 4096 Aug 14 12:17 zypp.pBQhhQ
drwx------ 4 root root 4096 Aug 14 12:27 zypp.YuN1pR
drwx------ 4 root root 4096 Aug 14 12:37 zypp.GoKXds
drwx------ 4 root root 4096 Aug 14 12:47 zypp.YLCES8
drwx------ 4 root root 4096 Aug 14 12:57 zypp.4aDpid
drwx------ 4 root root 4096 Aug 14 13:07 zypp.BpWwIW
drwx------ 4 root root 4096 Aug 14 13:17 zypp.vvMCxW
drwx------ 4 root root 4096 Aug 14 13:27 zypp.ckEBhD
drwx------ 4 root root 4096 Aug 14 13:37 zypp.kapX0t
drwx------ 5 root root 4096 Aug 14 13:47 zypp.avobZ9
drwx------ 4 root root 4096 Aug 14 13:53 zypp.hcBmCW
drwx------ 4 root root 4096 Aug 14 13:57 zypp.pg0Oda
drwx------ 4 root root 4096 Aug 14 14:07 zypp.uYfcHZ
drwx------ 4 root root 4096 Aug 14 14:17 zypp.i5MReK
drwx------ 4 root root 4096 Aug 14 14:27 zypp.Tb0XNR
drwx------ 4 root root 4096 Aug 14 14:37 zypp.O5Cmqz
drwx------ 4 root root 4096 Aug 14 14:47 zypp.Oub03i
drwx------ 4 root root 4096 Aug 14 14:57 zypp.Dufmkj
drwx------ 4 root root 4096 Aug 14 15:07 zypp.2ngcic
drwx------ 4 root root 4096 Aug 14 15:17 zypp.cTbdrO
drwx------ 4 root root 4096 Aug 14 15:27 zypp.LhKBrR
drwx------ 4 root root 4096 Aug 14 15:37 zypp.QuImWF
drwx------ 4 root root 4096 Aug 14 15:47 zypp.pEmQdr
drwx------ 4 root root 4096 Aug 14 15:57 zypp.Tzfoes
drwx------ 5 root root 4096 Aug 14 16:07 zypp.BJ0Gme
drwx------ 4 root root 4096 Aug 14 16:17 zypp.2Hkfs2
drwx------ 4 root root 4096 Aug 14 16:27 zypp.qA86p1
drwx------ 3 root root 4096 Aug 14 16:30 systemd-private-083fabdb7ce64490a0ef18d68e0e094f-ntpd.service-F2gNDN
llrainey@VM1:~> 

I think you were right earlier, when you suggested that it is packagekit.

I have very few, because I disable the desktop update applet in KDE. So packagekit does not normally run.

I occasionally login to Gnome, and I have not found a way of disabling the update applet there. So the few entries that I see may be due to the Gnome update applet. Or maybe running some other update software occasionally leaves something. But the most recent directory for me is 1 month old, so most of what I do is not creating those directories.

On another Leap 15.2 system (this one a virtual machine), there are recent directories. I never use packagekit to update. But the update applet is enabled so that it can report when there are updates. And the most recent directory has today’s date, so just checking for updates (with the desktop applet) seems to have created a directory.

An additional comment.

I just did

pkcon refresh

from the command line. And that did create a new "/var/tmp/zypp.* directory.

That’s another pointer to packagekit being the problem.

I think it happens because packagekit keeps its own copy of metadata, instead of merging that into the data cached by “zypper”. Perhaps it does this to avoid lock conflicts.

I’m not a Gnome user either, I note that the update applet can be used as a notifier only, if desired it packagekit can be inhibited…

sudo systemctl stop packagekit.service
sudo systemctl disable packagekit.service
sudo systemctl mask packagekit.service

Seems right.

However, if you disable packagekit, then you won’t be able to use Gnome software.

That would be fine for me, because I don’t use it. But it would be nice to just disable the update applet without removing the ability to use Gnome software. For example, in KDE I am able to disable the update applet, but still use Discover if I want to use that (which I don’t, but some people do).

As root, I did:


cd /etc/tmpfiles.d
cp /usr/lib/tmpfiles.d/tmp.conf  .

I then edited “tmp.conf” and modified the line for “/var/tmp”. I changed the “-” at the end of that line to “14d”. I think it is now supposed to delete anything older than 14 days. I’m not sure if it does anything until next boot, or until I restart the service.

I will see what happens.

I did not change the line for “/tmp” because that is using “tmpfs” here, so is emptied at every boot.

Exactly.

That would be fine for me, because I don’t use it. But it would be nice to just disable the update applet without removing the ability to use Gnome software.

The notifier can be disabled via Settings > Package Updater > Notifications (turn off), and if you launch the ‘Package Updater’, there is an option to remove it, although I haven’t invoked that.

I have a single directory named “zypp.xxxxxx”, and from what I could gather, it’s from a day zypper never exited. There’s many subsequent messages about other zypper processes being locked out by the first one, which kept quiet until shutdown (timestamp of shutdown coincides with modify timestamp). The content is related to KeyRing, so gpg keys stuff. Not really a bug in my case, but in your case it could be the process is being killed.

https://bugzilla.opensuse.org/show_bug.cgi?id=1175301

Shouln’t that be: … at every shutdown? :wink:

You don’t miss a trick Henk. :smiley:

Well, over time, it struck me that many people say things like this (this happens on reboot) where in fact it happens on shutdown and the effect will be noted on next boot (not only on re-boot).

One can of course take it for granted that most of these people in fact know how it is in reality, but I am afraid that a number of people do not understand the way these things happen and will not learn anything from this faulty way of explaining.

All I can say is +1 to that.