You are not logged in.

#1 2021-03-19 08:24:04

pxeger
Member
Registered: 2020-08-26
Posts: 1

"Failed to create the directory $BUILDDIR: /tmp/xxx" but xxx exists

I'm trying to install an AUR package in an automated script (specifically, libcgroup). Here is the relevant code:

cd "$(mktemp -d)"
git clone https://aur.archlinux.org/libcgroup.git
chown -R nobody:nobody libcgroup
cd libcgroup
sudo -u nobody makepkg
pacman -U libcgroup-*.pkg.tar.zst

The script is run as root, so I switch to the nobody user to run makepkg. However, I get this error:

==> ERROR: Failed to create the directory $BUILDDIR (/tmp/tmp.A5deoAF5dp/libcgroup).
    Aborting...

This is particularly weird because the referenced BUILDDIR already exists (it's the current directory). Can anyone help me?

Offline

#2 2021-03-19 08:40:08

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 12,507

Re: "Failed to create the directory $BUILDDIR: /tmp/xxx" but xxx exists

you'll want to switch to the nobody user earlier, you can't access the tmp directory you've created as root from the nobody user. It can't create the libcgroup directory which is the error you get. mktemp creates directories/files that only the executing/current user can access.

Last edited by V1del (2021-03-19 08:46:04)

Offline

Board footer

Powered by FluxBB