Artisan72
Artisan72

Reputation: 3640

Vagrant: syncing folder /var/cache/apt

I want to run some tests with apt-get install ... on a Ubuntu+Vagrant machine and I want to store the /var/cache/apt folder on the host machine to prevent repeating downloads from ubuntu.com

So I added the line

config.vm.synced_folder "/home/egon/DummyPackages/apt", "/var/cache/apt",
    user: "root", group: "root"

to the Vagrantfile.

But then apt-get install does not work anymore, I always get this error:

E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. Current value: 25165824. (man 5 apt.conf)
Reading package lists... Error!
E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Start. Current value: 25165824. (man 5 apt.conf)
E: Error occurred while processing xplanet-images (NewVersion2)
E: Problem with MergeList /var/lib/apt/lists /us.archive.ubuntu.com_ubuntu_dists_vivid_universe_binary-amd64_Packages
E: The package lists or status file could not be parsed or opened.

I've detected, the access rights of the pkgcache will be overriden.

before apt-get:

-rw-r--rw- 1 egon egon 25178732 Nov 11 11:31 pkgcache.bin

after:

-rw-r--r-- 1 egon egon 25178732 Nov 11 11:44 pkgcache.bin

Any ideas how to solve this?

Upvotes: 1

Views: 634

Answers (2)

StephenKing
StephenKing

Reputation: 37630

While not the answer to your question, I hopefully have the solution for your problem :-)

As your problem is pretty common, there is a nice plugin for this: vagrant-cachier. This will cache several types of repository-like data (yum, apt, gems, ...) in so called buckets that are stored in your host's ~/.vagrant.d/cache/ folder. See the usage guide.

Upvotes: -1

Frederic Henri
Frederic Henri

Reputation: 53793

you can try to make the sync_folder as

config.vm.synced_folder "/home/egon/DummyPackages/apt", "/var/cache/apt",
user: "root", group: "root", mount_options: ["dmode=777, fmode=646"]

This mount the folder with directory mode as 777 and files mode as 646. You can adjust the values for your own needs

Upvotes: 0

Related Questions