Share downloaded packages among VMs?

What you are doing is mimicking the pacman -Syuw - which is a download only.

If you disconnect your host from the internet you will not be able to install the packages - by simply running pacman -Syu as the metadata needs to be available.

The original topic did not specify if internet connection was avaiable or not - so assuming it is not.

If internet connection is not available the method will not work.

If internet connection is available - metadata will be fetched and if the packages copied from another system matches the metadata - then you are right - it will work.

Simply sharing the packages on a shared folder will not work.

And the approach assumes that systems are identical - package wise.

It’s available, but very slow. Sometimes like < 100kb/s

I did not assume that.
In fact, I relied on a network connection, to fetch the specific packages for each flavor of Manjaro (Xfce4, Gnome, Plasma …)

Perhaps that is the limitation to be aware of with this approach.

It works for me.

I have not had any problems - and I even have switched branches on my Xfce4 install (from stable to unstable and back to stable)

Because:
it is just a package cache, no?
what is needed, but is not there, will need to be fetched/downloaded
what is already there … will be used
No?

When you say - simply copy the cache from one system to another - your advise is incomplete and will cause confusion if one thinks it will work witout a network connection.

What you are doing is technically

  • on the host
    • sudo pacman -Syuw
  • on the guest
    • copy the pacman cache from the host to the guest
    • execute sudo pacman -Syu on the guest
    • the guest fetches the new metadata
    • the guest checks the cache
      • uses the cache if version matches

And it will work - but you are not describing the process - thus leaving out important information - that this will not work if the guest has no internet connection or a bad connection not able to download the the relatively small databases - and in such case - no dice.

If you copy the pair /var/cache/pacman and /var/lib/pacman then you would make a full offline update possible - unless of course - there is packages in the guest which is not in the host.

But all this is really just monkey patching …

That was never my intention.

My intention was: save space and bandwidth by only downloading stuff once instead of for each instance separately.

probably

How does the cleanup work when you do it that way? How do you avoid that one vm deletes files that it no longer needs, but another vm still needs?

I don’t.
More precisely:
I don’t care.
And even more precisely:
I do not even know what is happening or what is supposed to happen,
when you issue some pacman clean cache command - whether that is somehow specific

paccache -rk0

Maybe there is some residue (which is only needed by a different Manjaro version, but not by the one where the command is launched from).

I never cared.
Just try and look and see.

In /etc/pacman.conf you can set many previous packages need to stay in the cache, so you can set that to say 4, then there will be 4 previous versions kept, along with the current one. So if you do that on the PC and the VMs, the chances of something necessary getting deleted is slim.

I’ll try and see how it goes.

that’s the spirit :slightly_smiling_face:

1 Like