mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-07-12 18:19:42 -07:00
6ce926d537
User reported on a freshly flashed R36S:
archr:~ # pacman
error: failed to initialize alpm library:
(root: /, dbpath: /var/lib/pacman/)
could not find or read directory
The package.mk created /var/lib/pacman as a real directory in
post_makeinstall_target (mkdir -p), then in post_install ran
`ln -sf /storage/.pacman/db ${INSTALL}/var/lib/pacman`. When LINK is
an existing directory, ln -sf does not replace it — it creates
LINK/$(basename TARGET). So the installed image ended up with:
/var/lib/pacman/ ← real, empty dir (rootfs, ro)
/var/lib/pacman/db -> /storage/.pacman/db ← child symlink
Pacman reads dbpath=/var/lib/pacman/ from pacman.conf, looks for
local/ and sync/ inside it, finds nothing, and bails.
Fix: install /var/lib/pacman directly as a symlink to
/storage/.pacman/db in one shot, no intermediate mkdir. Same for
/var/cache/pacman/pkg. Move both into post_makeinstall_target so the
file layout is decided in one place; post_install now only enables
the pacman-init service.
Runtime escape hatch on already-installed systems (since the rootfs
is squashfs-ro and can't be patched):
mount --bind /storage/.pacman/db /var/lib/pacman
mount --bind /storage/.pacman/cache /var/cache/pacman/pkg
This commit fixes the build so the next image flashes correctly.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>