You are not logged in.

#1 2017-10-10 14:46:42

jaaan
Member
Registered: 2016-04-22
Posts: 7

pacstrap fails with shared /var/cache/pacman

I'm auto-building a bunch of virtual machines (Qemu) running Archlinux.
To speed up pacstrap, I set up a folder that serves as shared pacman cache. I share this folder via Qemu's 9p-virtio, so all VMs access the same folder on the host.

When I install lots of VMs in parallel, pacstrap produces errors like

error: could not rename /var/cache/pacman/pkg/bash-4.4.012-2-x86_64.pkg.tar.xz.part to /var/cache/pacman/pkg/bash-4.4.012-2-x86_64.pkg.tar.xz (No such file or directory)

I guess this is a race condition: When finishing the download, the file gets renamed. If another process is doing the same, one process must fail.

So it looks like you shouldn't have several pacman processes access the same pacman cache folder at the same time. However, the Archwiki says:

In order to share packages between multiple computers, simply share /var/cache/pacman/ using any network-based mount protocol.

Is the Archwiki wrong? Am I wrong assuming that this is a race condition?

Offline

#2 2017-10-10 16:55:14

progandy
Member
Registered: 2012-05-17
Posts: 5,196

Re: pacstrap fails with shared /var/cache/pacman

That is a race.
The archwiki assumes that you are upgrading the computers manually in sequence and not automated in parallel.

If you are creating the same VM multiple times, you probably should create the first one to fill the cache and then you can do the other in parallel afterwards.

You might also be interested in pacserve: https://bbs.archlinux.org/viewtopic.php?id=117094

Last edited by progandy (2017-10-10 16:56:09)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2017-10-10 17:28:29

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: pacstrap fails with shared /var/cache/pacman

Or just create a fresh base image every time you kick-off the auto-build script and then copy/snapshot/use as a backing image for all of the VM's (depending on your workflow).


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

Board footer

Powered by FluxBB