Subject: Can't recognize local repository

From: Jim Pryor <[email-masked]>
Date: Fri, 14 Mar 2025 16:31:02 -0400

I have an issue where `apk` can't see a local repository. I have an
unprivileged user who created some packages, created an APKINDEX file and
signed the index. That user's public key is installed in `/etc/apk/keys`.
The unprivileged user and root both belong to the `abuild` group. As best I
can tell, the permissions on the repository, index, and package files look
correct. But when I do `apk update` I get a message that the
repository `/var/lib/packages` can't be found. Any ideas?

main0:~# ls -l /etc/apk/keys/bob*

-rw-r--r--    1 root     root           800 Mar 14 15:44
/etc/apk/keys/bob-67d48136.rsa.pub

main0:~# ls -l /home/bob/.abuild/

total 12

-rw-r--r--    1 bob      wheel           80 Mar 14 16:19 abuild.conf

-rw-------    1 bob      wheel         3272 Mar 14 15:19 bob-67d48136.rsa

-rw-r--r--    1 bob      wheel          800 Mar 14 15:19
bob-67d48136.rsa.pub

main0:~# id root

uid=0(root) gid=0(root)
groups=0(root),0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video),300(abuild)

main0:~# id bob

uid=1000(bob) gid=300(abuild) groups=300(abuild),10(wheel)

main0:~# ls -ld /var

drwxr-xr-x   12 root     root          4096 Mar  9 13:15 */var*

main0:~# ls -ld /var/lib

drwxr-xr-x    6 root     root          4096 Mar 14 16:15 */var/lib*

main0:~# ls -ld /var/lib/packages

drwxrwxr-x    2 root     abuild        4096 Mar 14 16:21 */var/lib/packages*

main0:~# ls -l /var/lib/packages/

total 532

-rw-r--r--    1 bob      abuild        1786 Mar 14 16:21 APKINDEX.tar.gz

-rw-r--r--    1 bob      abuild      314101 Mar 14 15:27
micropython-1.24.1-r1.apk

-rw-r--r--    1 bob      abuild      157669 Mar 14 15:27
micropython-cross-1.24.1-r1.apk

-rw-r--r--    1 bob      abuild       63295 Mar 14 15:27
micropython-doc-1.24.1-r1.apk

main0:~# cat /etc/apk/repositories

http://dl-cdn.alpinelinux.org/alpine/v3.21/main

http://dl-cdn.alpinelinux.org/alpine/v3.21/community

/var/lib/packages

main0:~# id -un

root

main0:~# apk update -v

fetch http://dl-cdn.alpinelinux.org/alpine/v3.21/main/armv7/APKINDEX.tar.gz

fetch
http://dl-cdn.alpinelinux.org/alpine/v3.21/community/armv7/APKINDEX.tar.gz

WARNING: opening /var/lib/packages: No such file or directory

v3.21.3-159-gdab69828342 [http://dl-cdn.alpinelinux.org/alpine/v3.21/main]

v3.21.3-161-gf15e577c644 [
http://dl-cdn.alpinelinux.org/alpine/v3.21/community]

OK: 23811 distinct packages available

---

From: "Sertonix" <[email-masked]>
Date: Fri, 14 Mar 2025 21:01:23 +0000

> micropython-doc-1.24.1-r1.apk

The path of the repository contains the arch. So you need to place the
files in /var/lib/packages/armv7.

---

From: Jim Pryor <[email-masked]>
Date: Fri, 14 Mar 2025 18:34:18 -0400

I tried that (experimentally) and then `apk update -v` just ignored the
directory (but no longer any warning).