Mock: Permission denied

Mike McLean mikem at redhat.com
Wed Mar 31 14:34:22 UTC 2010


On 03/31/2010 05:12 AM, Paul Howarth wrote:
> The /var/lib/mock/dist-foo-build-18-13 directory may be a hangover from
> when things were broken previously. It shouldn't be owned by user "torrent".
>
> I'd do an "ls -l /var/lib/mock" and move any directories owned by user
> "torrent" somewhere else, then try again. If everything then works OK,
> delete the moved directories (mock should re-create these directories as
> needed).

For a number of chroot operations (e.g. building), mock uses an 
unprivileged user it creates in the chroot. By default, the uid/gid for 
this unprivileged user is chosen based on the user running mock (it 
looks at env data from sudo/consolehelper to determine the real user).

So, the builddir in the chroot is going to be owned by that unprivileged 
user. If you run mock as a /different/ user later and attempt to reuse 
the same buildroot, then you will get the errors like the ones you are 
seeing.

Short answer: different mock users cannot share chroots.

Easy fix: run mock clean to clear the old junk out of the buildroot.


More information about the buildsys mailing list