You are not logged in.

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

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

"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: 16,202

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

#3 2022-05-06 10:10:31

levor
Member
Registered: 2022-05-06
Posts: 1

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

I got this error while trying to install yay. **yay does not like to run as root, or under the /root folder** (directly or indirectly).  The problem was that I tried to do everything under /root directory: cloned the yay git package into /root/downloads, then **chown** the git file (and directory) to user arch, then switched user to arch (su arch), then tried to run makepkg... The solution was simple - **switch to arch user first**:

    su arch
    cd /home/arch
    git clone https://aur.archlinux.org/yay.git
    cd yay
    makepkg -si

Offline

#4 2022-05-06 17:50:12

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 10,711
Website

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

Please do not necrobump.

Closing.


Sakura:-
Mobo: MSI MEG B550 UNIFY // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB