You are not logged in.

#1 2025-07-06 13:02:20

s_pouya_sh
Member
Registered: 2025-07-06
Posts: 1

makepkg corrupting pre-compiled binary

Hello Community,

I'm trying to create a pacman package for a pre-compiled binary named ekoslive to host in a local repository. I'm encountering a consistent issue where the ekoslive binary becomes corrupted during the makepkg process itself, leading to an Exec format error when I try to run it after installation.

Problem Description:

I have a known-good ekoslive binary with a specific SHA256 checksum. When I run makepkg (with or without --install), the resulting ekoslive file inside the package (and subsequently in /opt/ekoslive after installation) has a different SHA256 checksum, indicating corruption. The file size is reduced: original: 290MB, makepkg corrupted one: 45MB (the ekoslive.service is fine and has no issues both on size and checksum)

When attempting to run the installed corrupted binary, I receive:

Pkg: Error reading from file.

The application, when run directly from the original, uncorrupted binary, works perfectly.

Details of my setup and steps:

System: Arch Linux (fully up-to-date, pacman -Syu run regularly).

Binary: ekoslive (a pre-compiled executable, not built from source).

Goal: Create an Arch package (.pkg.tar.zst) for ekoslive and its systemd service file (ekoslive.service).

Original ekoslive checksum (known good):

ac4279fecfc514709261ac743882704f2a8aebaaa3b6b8e6afce9605efcb7360  ekoslive
My PKGBUILD (simplified, focusing on the relevant parts):

# PKGBUILD for ekoslive
pkgname=ekoslive
pkgver=0.1.0
pkgrel=1
pkgdesc="EkosLive daemon"
arch=('x86_64')
url="https://www.stellarmate.com/"
license=('custom')
depends=('systemd')
source=("ekoslive" "ekoslive.service")
sha256sums=('ac4279fecfc514709261ac743882704f2a8aebaaa3b6b8e6afce9605efcb7360'
            'SKIP')

package() {
  mkdir -p "$pkgdir/opt/ekoslive/"

  install -Dm755 "$srcdir/ekoslive" "$pkgdir/opt/ekoslive/ekoslive"
  install -Dm644 "$srcdir/ekoslive.service" "$pkgdir/usr/lib/systemd/system/ekoslive.service"
}
What I've observed and tried:

Checksum Mismatch:
Running makepkg (and after manual read pause in package()), the sha256sum of the file copied to $pkgdir/opt/ekoslive/ekoslive does not match the original:

1c6b0f820988df471b36a45e088c346ae78d24ae1024e41cc575ae7f602979ba  /tmp/makepkg/ekoslive/pkg/ekoslive/opt/ekoslive/ekoslive
This is different from ac4279fecfc514709261ac743882704f2a8aebaaa3b6b8e6afce9605efcb7360.

Manual cp workaround (works, but not for makepkg):
If I manually perform the copy outside of makepkg (i.e., sudo cp /path/to/good/ekoslive /opt/ekoslive/ekoslive), the checksum is correct, and the binary runs fine. This confirms the original binary is not the issue, and the target filesystem (/opt) is writable and healthy.

Attempted cp inside package():
I modified package() to use cp and chmod instead of install -Dm755 for the ekoslive binary; the corruption persists even with cp within the makepkg package() function.


Any insights or debugging suggestions would be greatly appreciated. I need to get a clean package built for my local repository.

Thank you in advance for your time and help!

Offline

#2 2025-07-06 13:08:44

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,898

Re: makepkg corrupting pre-compiled binary

By default, makepkg strips binaries. This can be overridden in the PKGBUILD's options array. https://man.archlinux.org/man/PKGBUILD. … DIRECTIVES

Offline

Board footer

Powered by FluxBB