'/var/db/pkg/' - Clean up old catalogue etc. files?
Matthew Seaman
matthew at FreeBSD.org
Wed Sep 21 16:07:06 UTC 2016
On 21/09/2016 16:25, zhaghzhagh at openmailbox.org wrote:
> Hello
>
> Looking in to my host's '/var/db/pkg/' directory I spot a few catalogue,
> metadata etc. files that belong to already removed repositories.
>
> Is there any documented (or manual but safe) way to remove these files?
> Looking into the manual pages of 'pkg' did not bring much luck. Removing
> downloaded package binaries I can, 'pkg clean', removing old repository
> related files, not.
>
> Directory looks like this, for example, all 'myrepo...s' should be gone
> (to save some disk space):
>
> [root at domain /var/db/pkg]# ls -l
> total 608532
> -rw-r--r-- 1 root wheel 246 Sep 15 09:24 FreeBSD.meta
> drwxr-xr-x 2 root wheel 512 Apr 4 22:05 apr-1.5.2.1.5.4
> drwxr-xr-x 2 root wheel 512 Apr 4 22:02 db5-5.3.28_3
> drwxr-xr-x 2 root wheel 512 Apr 4 22:03 expat-2.1.0_3
> drwxr-xr-x 2 root wheel 512 Apr 4 20:46 gettext-runtime-0.19.7
> drwxr-xr-x 2 root wheel 512 Apr 4 20:50 gettext-tools-0.19.7
> drwxr-xr-x 2 root wheel 512 Apr 4 22:06 help2man-1.43.3_1
> -rw-r--r-- 1 root wheel 246 Sep 15 09:24 latest.meta
> -rw-r--r-- 1 root wheel 9178112 Sep 15 18:52 local.sqlite
> -rw-r--r-- 1 root wheel 246 Mar 26 02:58 myrepo.meta
> -rw-r--r-- 1 root wheel 246 Apr 13 18:30 myrepo2.meta
> -rw-r--r-- 1 root wheel 246 Apr 13 18:33 myrepo3.meta
> -rw-r--r-- 1 root wheel 246 Apr 13 18:33 myrepo4.meta
> -rw-r--r-- 1 root wheel 246 Jun 14 06:57 myrepo5.meta
> drwxr-xr-x 2 root wheel 512 Apr 4 22:05 p5-Locale-gettext-1.06
> drwxr-xr-x 2 root wheel 512 Apr 4 21:57 perl5-5.20.3_8
> drwxr-xr-x 2 root wheel 512 Apr 4 21:20 perl5.20-5.20.3_8
> -rw-r--r-- 1 root wheel 246 Sep 15 07:31 quarterly.meta
> -rw-r--r-- 1 root wheel 246 Aug 6 13:15 release_1.meta
> -rw-r--r-- 1 root wheel 246 Aug 6 13:15 release_2.meta
> -rw-r--r-- 1 root wheel 246 Aug 6 13:15 release_3.meta
> -rw-r--r-- 1 root wheel 47077376 Sep 15 18:49 repo-FreeBSD.sqlite
> -rw-r--r-- 1 root wheel 47077376 Sep 15 18:49 repo-latest.sqlite
> -rw-r--r-- 1 root wheel 78458880 Apr 18 18:06 repo-myrepo.sqlite
> -rw-r--r-- 1 root wheel 42881024 Apr 18 18:06 repo-myrepo2.sqlite
> -rw-r--r-- 1 root wheel 43790336 Apr 18 18:06 repo-myrepo3.sqlite
> -rw-r--r-- 1 root wheel 44890112 Apr 18 18:06 repo-myrepo4.sqlite
> -rw-r--r-- 1 root wheel 46038016 Jun 14 12:31 repo-myrepo5.sqlite
> -rw-r--r-- 1 root wheel 46558208 Sep 15 18:49 repo-quarterly.sqlite
> -rw-r--r-- 1 root wheel 78751744 Aug 6 13:15 repo-release_0.sqlite
> -rw-r--r-- 1 root wheel 43214848 Aug 6 13:15 repo-release_1.sqlite
> -rw-r--r-- 1 root wheel 44131328 Aug 6 13:15 repo-release_2.sqlite
> -rw-r--r-- 1 root wheel 45265920 Aug 6 13:15 repo-release_3.sqlite
> -rw-r--r-- 1 root wheel 408576 Sep 14 19:20 repo-repository.sqlite
> -rw-r--r-- 1 root wheel 246 Sep 14 19:21 repository.meta
> -r--r--r-- 1 root wheel 4627951 Sep 20 03:43 vuln.xml
There isn't a 'clean up the pkgdb' command as such. You'll just have to
make do with trusty rm(1).
In fact, there is only one file in the pkgdb that you can't easily
replace by downloading a fresh copy. That's local.sqlite which is the
database of what is actually installed on your system. Everything else
you should be able to pull down again by a combination of 'pkg update
-f' and 'pkg audit -f'
However, to avoid unnecessary downloads, and assuming you have 'FreeBSD'
and 'myrepo' repositories configured (check the output of 'pkg -vv' to
confirm), then these are the files you should keep:
FreeBSD.meta
local.sqlite
myrepo.meta
repo-FreeBSD.sqlite
repo-myrepo.sqlite
vuln.xml
That, at least is whay pkg(8) needs under /var/db/pkg. If you use
portmaster(1) you'll find it does create some old-style pkgname-version
sub directories. IIRC, the content there is not critical.
Cheers,
Matthew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-pkg/attachments/20160921/be4c919f/attachment.sig>
More information about the freebsd-pkg
mailing list