You are not logged in.

#1 2023-06-26 08:35:50

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 205

rm: cannot remove '/tmp/makepkg/<filename>': Permission denied

I have a strange behaviour during the installation of a package by "makepkg -si". I'm renewing the "apx-git" AUR package with the following PKGBUILD:

pkgname=apx-git
_pkgname=apx
pkgver=758.79b408e
pkgrel=1
pkgdesc="Vanilla OS package manager."
arch=('any')
license=("GPL")
depends=('distrobox' 'docker' 'gettext')
makedepends=('git' 'go' 'make')
source=("git+https://github.com/Vanilla-OS/$_pkgname")
sha512sums=('SKIP')

prepare() {
    cd $_pkgname

    git submodule update --init --recursive
}

pkgver() {
  cd $_pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
    cd $_pkgname

    make build
}

package() {
    cd $_pkgname

    make DESTDIR="$pkgdir" install
    make DESTDIR="$pkgdir" install-manpages
}

When I run the first time "makepkg -si", it is installed correctly. If I run it a second time, I get the following error:

==> Making package: apx-git 758.79b408e-1 (Mon 26 Jun 2023 12:31:00 PM CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Cloning apx git repo...
Cloning into bare repository '/home/athena/athena-apx/apx'...
remote: Enumerating objects: 6094, done.
remote: Counting objects: 100% (1495/1495), done.
remote: Compressing objects: 100% (399/399), done.
remote: Total 6094 (delta 1141), reused 1351 (delta 1059), pack-reused 4599
Receiving objects: 100% (6094/6094), 3.98 MiB | 9.33 MiB/s, done.
Resolving deltas: 100% (3690/3690), done.
==> Validating source files with sha512sums...
    apx ... Skipped
==> Extracting sources...
  -> Creating working copy of apx git repo...
Switched to a new branch 'makepkg'
==> Starting prepare()...
==> Starting pkgver()...
==> Removing existing $pkgdir/ directory...
rm: cannot remove '/tmp/makepkg/apx-git/pkg/apx-git/etc/apx/config.json': Permission denied

==> ERROR: An unknown error has occurred. Exiting...
fish: Job 1, 'makepkg -si' terminated by signal SIGUSR1 (User defined signal 1)

Why I get a "Permission denied" error on "/tmp/makepkg/apx-git/pkg/apx-git/etc/apx/config.json" when I try to run it a second time? It forces me to remove that file from "/tmp" manually.

Offline

#2 2023-06-26 13:26:13

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,629

Re: rm: cannot remove '/tmp/makepkg/<filename>': Permission denied

What are the permissions on that file?

Offline

#3 2023-06-26 16:34:25

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 205

Re: rm: cannot remove '/tmp/makepkg/<filename>': Permission denied

.rw-r--r-- root root 116 B Mon Jun 26 18:31:46 2023  /tmp/makepkg/apx/pkg/apx/etc/apx/apx.json

I don't understand why makepkg creates those file as root.

Offline

#4 2023-06-27 10:28:47

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,840

Re: rm: cannot remove '/tmp/makepkg/<filename>': Permission denied

prepare() {
    cd $_pkgname

    git submodule update --init --recursive
}

Not to long ago there were issues with git submodules that look very similar to your issue and required changes to the VCS pacakge guidelines.

Check https://wiki.archlinux.org/title/VCS_pa … submodules for the current method.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2023-06-28 20:32:43

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 205

Re: rm: cannot remove '/tmp/makepkg/<filename>': Permission denied

Thank you for the answer @Lone_Wolf. I tried the approach described on the wiki but I still get the same error. In praticular, I added:

source=("git+https://github.com/Vanilla-OS/$_pkgname"
             "git+https://github.com/89luca89/distrobox")
sha512sums=('SKIP'
            'SKIP')

prepare() {
    cd $_pkgname

    #git submodule update --init --recursive
    git submodule init
    git config submodule.distrobox/distrobox.url "$srcdir/distrobox"
    git -c protocol.file.allow=always submodule update
}

Not sure if I wrote it correctly.

Offline

#6 2023-06-28 23:58:59

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,629

Re: rm: cannot remove '/tmp/makepkg/<filename>': Permission denied

D3vil0p3r wrote:
.rw-r--r-- root root 116 B Mon Jun 26 18:31:46 2023  /tmp/makepkg/apx/pkg/apx/etc/apx/apx.json

I don't understand why makepkg creates those file as root.

That's normal, most packaged files should be owned by root:root, and makepkg uses fakeroot to do that. What about the permissions on the dir that the file is in?

Offline

#7 2023-06-29 15:58:45

D3vil0p3r
Member
Registered: 2022-11-05
Posts: 205

Re: rm: cannot remove '/tmp/makepkg/<filename>': Permission denied

That file is retrieved by "git+https://github.com/Vanilla-OS/$_pkgname", it is not local.

Offline

#8 2023-06-30 09:25:58

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,840

Re: rm: cannot remove '/tmp/makepkg/<filename>': Permission denied

tmp/makepkg/apx/pkg/apx/etc/apx/apx.json

The apx/pkg/apx/etc/apx/apx.json part looks very much like it is under $pkgdir which as far as I know is not accessible during prepare() or build() .
If that's correct that file is copied somewhere to $pkgdir .
Building in /tmp makes it harder to see what really happen.

Please use

$ BUILDDIR=$PWD makepkg ----cleanbuild --syncdeps --rmdeps --log

to build and post the logfiles.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB