copying /var/cache/pkg between machines

Matthew Seaman matthew at
Thu Sep 8 09:17:46 UTC 2016

On 2016/09/08 09:51, Coert wrote:
> I have a few FreeBSD machines running with KDE installed.
> When I copy /var/cache/pkg to another machine, it downloads all packages
> again anyway.
> I tried rsync, tar, made sure the symlinks with checksums are preserved,
> but to no avail.
> What is the recommended way to sync /var/cache/pkg between machines?

Sync'ing /var/cache/pkg like that isn't something that has been
considered as 'normal' usage of pkg(8), so there's no guarantee that it
will work.

However, what you can do is create a local package repo from
/var/cache/pkg by:

   pkg repo /var/cache/pkg

This can be served to your other machine by HTTP or even copied over to
the other machine by rsync.  eg.

   rsync -avx /var/cache/pkg/ othermachine:/var/myrepo/

and then on othermachine add in /usr/local/etc/pkg/repos/myrepo.conf:

   myrepo: {
     url: file:///var/myrepo
     priority: 10

othermachine will still be able to use the default FreeBSD pkg
repositories, but it will prefer 'myrepo' as far as possible.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 972 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the freebsd-questions mailing list