From d06e18a2ad52052e5c0e2d456497aa0d3af9d3d6 Mon Sep 17 00:00:00 2001 From: Douglas Teles Date: Wed, 24 Jun 2026 02:44:45 -0300 Subject: [PATCH] =?UTF-8?q?gaps:=20ampla=20varredura=20de=20bugs=20herdado?= =?UTF-8?q?s=20+=20pr=C3=A9-pacman=20repo-stable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A varredura via SSH no R36S rodando a 20260624 expôs várias divergências entre rootfs estagiado e tmpfs/runtime. Cada arquivo deste commit resolve um gap encontrado na investigação. archr/tmpfiles.d/z_02_archr-fhs-bridges.conf (NEW): /var é tmpfs (busybox/system.d/var.mount), então todos os bridges FHS instalados como symlinks no rootfs eram apagados pelo mount. Republicar a estrutura via systemd-tmpfiles após var.mount. Resolve /var/lib/pacman, /var/cache/archr/*, /var/lib/archr/{config,data, games,backup}, /var/lib/{samba/private,tailscale,bluetooth}, /var/spool/cron, /var/cache/pacman/pkg. Inclui também os targets em /storage (cron, locpath, tailscale, samba, .local/share, fstrim.run, journald.conf.d, request-key.d) que estavam ausentes. ui/emulationstation/package.mk: ln -sf usava \${INSTALL}/usr/config/... como alvo, vazando o caminho absoluto do builder para o symlink /etc/emulationstation/es_systems.cfg no SO final. Trocar pelo path do target. archr/system.d/timers.target.wants/{rocknix→archr}-report-stats.timer: Symlink apontava para um arquivo inexistente (rocknix-report-stats); o timer real chama-se archr-report-stats. Renome. misc/modules/sources/images/install-{rocknix→archr}.svg: gamelist.xml já referenciava install-archr.svg; o arquivo se chamava install-rocknix.svg, quebrando o asset. emulators/.../gamepads/ROCKNIX→ArchR Gamepad.cfg: Conteúdo já estava com input_device="ArchR Gamepad"; rename casa o nome de arquivo com a string de matching. archr/package.mk + profile.d/005-locale: LANG="" no SO rodando, todas LC_*=POSIX. glibc gera en_US.UTF-8. Criar /etc/locale.conf e profile.d que source-a para shells de login e SSH (que não herdam LANG via systemd env). sysutils/systemd/scripts/userconfig-setup + freej2me-lr/freej2me.sh: /storage/jdk caiu como arquivo vazio em algumas builds antigas e transforma o symlink /opt/jdk em "Not a directory". Saneamento duplo: a cada boot e antes do download do JDK. devel/crossguid/package.mk + standalone/hypseus-singe/package.mk: cmake_install.cmake / crossguid-config.cmake embutiam o BUILD path do host. Remover dos pacotes target (não rodam em runtime). tools/pyFDT/package.mk + network/samba/package.mk: setuptools e waf escrevem o python3 do TOOLCHAIN no shebang dos entry-points (pydtc, samba-gpupdate). Reescrever pra /usr/bin/python3. sysutils/systemd/package.mk: systemd-sysroot-fstab-check é um symlink para systemd-fstab-generator, que removemos para fora dos generators. Apagar o link junto. Strip também a regra do legacy.conf que cria /var/log/README apontando para /usr/share/doc (não embarcamos docs). sysutils/udevil/package.mk: /etc/udevil/udevil-user-root.conf é symlink para /storage/.config/udevil.conf que nunca era populado. Copiar a conf também para /usr/config/udevil.conf, daí o rsync do userconfig-setup o semeia no primeiro boot. Co-Authored-By: Claude Opus 4.7 --- packages/devel/crossguid/package.mk | 7 +++ packages/sysutils/systemd/package.mk | 14 ++++++ packages/sysutils/udevil/package.mk | 5 ++ projects/ArchR/packages/archr/package.mk | 5 ++ .../ArchR/packages/archr/profile.d/005-locale | 16 +++++++ .../archr-report-stats.timer | 1 + .../rocknix-report-stats.timer | 1 - .../tmpfiles.d/z_02_archr-fhs-bridges.conf | 47 +++++++++++++++++++ .../libretro/freej2me-lr/freej2me.sh | 9 ++++ ...{ROCKNIX Gamepad.cfg => ArchR Gamepad.cfg} | 0 .../standalone/hypseus-singe/package.mk | 6 +++ ...{install-rocknix.svg => install-archr.svg} | 0 .../ArchR/packages/network/samba/package.mk | 12 +++++ .../sysutils/systemd/scripts/userconfig-setup | 8 ++++ .../ArchR/packages/tools/pyFDT/package.mk | 11 +++++ .../packages/ui/emulationstation/package.mk | 5 +- 16 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 projects/ArchR/packages/archr/profile.d/005-locale create mode 120000 projects/ArchR/packages/archr/system.d/timers.target.wants/archr-report-stats.timer delete mode 120000 projects/ArchR/packages/archr/system.d/timers.target.wants/rocknix-report-stats.timer create mode 100644 projects/ArchR/packages/archr/tmpfiles.d/z_02_archr-fhs-bridges.conf rename projects/ArchR/packages/emulators/libretro/retroarch/retroarch-joypads/gamepads/{ROCKNIX Gamepad.cfg => ArchR Gamepad.cfg} (100%) rename projects/ArchR/packages/misc/modules/sources/images/{install-rocknix.svg => install-archr.svg} (100%) diff --git a/packages/devel/crossguid/package.mk b/packages/devel/crossguid/package.mk index 45a0c78be3..a26feeaf50 100644 --- a/packages/devel/crossguid/package.mk +++ b/packages/devel/crossguid/package.mk @@ -13,3 +13,10 @@ PKG_LONGDESC="minimal, cross platform, C++ GUID library" PKG_CMAKE_OPTS_TARGET="-DCROSSGUID_TESTS=OFF \ -Wno-dev" + +post_makeinstall_target() { + # crossguid is a build-time-only dependency; its CMake config files + # embed the host's build-dir path and serve no runtime purpose. Drop + # the entire share tree to keep the rootfs free of host-paths. + rm -rf ${INSTALL}/usr/share/crossguid +} diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk index d04e2d1de8..e9b4d5bc0e 100644 --- a/packages/sysutils/systemd/package.mk +++ b/packages/sysutils/systemd/package.mk @@ -174,6 +174,12 @@ post_makeinstall_target() { ;; esac done + # systemd-sysroot-fstab-check is a symlink into systemd-fstab-generator + # (deleted above), so it always dangles on the target. Remove the + # dangling link from both /usr/lib and /usr/lib32 to keep the rootfs + # symlink-clean. + safe_remove ${INSTALL}/usr/lib/systemd/systemd-sysroot-fstab-check + safe_remove ${INSTALL}/usr/lib32/systemd/systemd-sysroot-fstab-check # remove catalog safe_remove ${INSTALL}/usr/lib/systemd/catalog @@ -277,6 +283,14 @@ post_makeinstall_target() { # journald ln -sf /storage/.cache/journald.conf.d ${INSTALL}/usr/lib/systemd/journald.conf.d + + # legacy.conf seeds /var/log/README as a symlink to + # /usr/share/doc/systemd/README.logs, but ArchR doesn't ship the + # /usr/share/doc tree, so the README ends up dangling on every boot. + # Strip the line, keep the rest of the legacy rules. + if [ -f ${INSTALL}/usr/lib/tmpfiles.d/legacy.conf ]; then + sed -i '/\/var\/log\/README/d' ${INSTALL}/usr/lib/tmpfiles.d/legacy.conf + fi } post_install() { diff --git a/packages/sysutils/udevil/package.mk b/packages/sysutils/udevil/package.mk index b489817583..deef14f495 100644 --- a/packages/sysutils/udevil/package.mk +++ b/packages/sysutils/udevil/package.mk @@ -26,6 +26,11 @@ post_makeinstall_target() { cp ${PKG_DIR}/config/udevil.conf ${INSTALL}/etc/udevil ln -sf /storage/.config/udevil.conf ${INSTALL}/etc/udevil/udevil-user-root.conf + # Seed /storage/.config/udevil.conf via the userconfig rsync. Without + # this copy the user-root symlink above dangles until first manual edit. + mkdir -p ${INSTALL}/usr/config + cp ${PKG_DIR}/config/udevil.conf ${INSTALL}/usr/config/ + mkdir -p ${INSTALL}/usr/bin cp -PR src/udevil ${INSTALL}/usr/bin diff --git a/projects/ArchR/packages/archr/package.mk b/projects/ArchR/packages/archr/package.mk index f241aefe3e..07e8883453 100644 --- a/projects/ArchR/packages/archr/package.mk +++ b/projects/ArchR/packages/archr/package.mk @@ -153,6 +153,11 @@ EOF ### Take a backup of the system configuration on shutdown enable_service save-sysconfig.service + ### System locale. glibc/package.mk only generates en_US.UTF-8; without + ### this file LANG stays empty and every shell falls back to POSIX, + ### which breaks UTF-8 input, pacman messages and emulator menus. + echo "LANG=en_US.UTF-8" > ${INSTALL}/etc/locale.conf + sed -i "s#@DEVICENAME@#${DEVICE}#g" ${INSTALL}/usr/config/system/configs/system.cfg ### Defaults for non-main builds. diff --git a/projects/ArchR/packages/archr/profile.d/005-locale b/projects/ArchR/packages/archr/profile.d/005-locale new file mode 100644 index 0000000000..c656b7669b --- /dev/null +++ b/projects/ArchR/packages/archr/profile.d/005-locale @@ -0,0 +1,16 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2026-present ArchR + +# systemd already publishes LANG into its session environment, but ssh +# logins and busybox shells do not inherit that, so they end up under +# POSIX with empty LANG. Source the canonical /etc/locale.conf at shell +# startup so every interactive session sees the same locale. + +if [ -r /etc/locale.conf ]; then + # shellcheck disable=SC1091 + . /etc/locale.conf + export LANG + [ -n "${LANGUAGE}" ] && export LANGUAGE + [ -n "${LC_ALL}" ] && export LC_ALL +fi diff --git a/projects/ArchR/packages/archr/system.d/timers.target.wants/archr-report-stats.timer b/projects/ArchR/packages/archr/system.d/timers.target.wants/archr-report-stats.timer new file mode 120000 index 0000000000..15095ecbf1 --- /dev/null +++ b/projects/ArchR/packages/archr/system.d/timers.target.wants/archr-report-stats.timer @@ -0,0 +1 @@ +../archr-report-stats.timer \ No newline at end of file diff --git a/projects/ArchR/packages/archr/system.d/timers.target.wants/rocknix-report-stats.timer b/projects/ArchR/packages/archr/system.d/timers.target.wants/rocknix-report-stats.timer deleted file mode 120000 index 4ae66d6f74..0000000000 --- a/projects/ArchR/packages/archr/system.d/timers.target.wants/rocknix-report-stats.timer +++ /dev/null @@ -1 +0,0 @@ -../rocknix-report-stats.timer \ No newline at end of file diff --git a/projects/ArchR/packages/archr/tmpfiles.d/z_02_archr-fhs-bridges.conf b/projects/ArchR/packages/archr/tmpfiles.d/z_02_archr-fhs-bridges.conf new file mode 100644 index 0000000000..ab8e0cdfa2 --- /dev/null +++ b/projects/ArchR/packages/archr/tmpfiles.d/z_02_archr-fhs-bridges.conf @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2026-present ArchR + +# /var is a tmpfs (see busybox/system.d/var.mount), so symlinks staged +# at install time into the read-only rootfs are hidden by the mount and +# never reach userspace. This file republishes the FHS bridge surface +# into the tmpfs after var.mount has run. Substrate paths stay on the +# rw /storage overlay. + +d /var/cache/archr 0755 root root - - +d /var/cache/pacman 0755 root root - - +d /var/lib/archr 0755 root root - - +d /var/lib/samba 0755 root root - - +d /var/spool 0755 root root - - + +L+ /var/cache/mesa - - - - /storage/.cache/mesa_shader_cache +L+ /var/cache/archr/kernel-overlays - - - - /storage/.cache/kernel-overlays +L+ /var/cache/archr/locpath - - - - /storage/.cache/locpath +L+ /var/cache/archr/fstrim.run - - - - /storage/.cache/fstrim.run +L+ /var/cache/archr/update - - - - /storage/.update +L+ /var/cache/pacman/pkg - - - - /storage/.pacman/cache + +L+ /var/lib/archr/services - - - - /storage/.cache/services +L+ /var/lib/archr/config - - - - /storage/.config +L+ /var/lib/archr/data - - - - /storage/.local/share +L+ /var/lib/archr/games - - - - /storage/roms +L+ /var/lib/archr/backup - - - - /storage/backup +L+ /var/lib/samba/private - - - - /storage/.cache/samba +L+ /var/lib/tailscale - - - - /storage/.cache/tailscale +L+ /var/lib/pacman - - - - /storage/.pacman/db +L+ /var/lib/bluetooth - - - - /storage/.cache/bluetooth + +L+ /var/spool/cron - - - - /storage/.cache/cron + +# Storage-backed targets for symlinks staged at install time. Without +# these dirs the symlinks dangle and the consumer code treats the path +# as missing. f for the lone-file bridges (fstrim.run is a stamp), d +# for the directory bridges. +d /storage/.config/request-key.d 0755 root root - - +d /storage/.cache/journald.conf.d 0755 root root - - +d /storage/.cache/cron 0755 root root - - +d /storage/.cache/locpath 0755 root root - - +d /storage/.cache/tailscale 0755 root root - - +d /storage/.cache/samba 0700 root root - - +d /storage/.local 0755 root root - - +d /storage/.local/share 0755 root root - - +f /storage/.cache/fstrim.run 0644 root root - - diff --git a/projects/ArchR/packages/emulators/libretro/freej2me-lr/freej2me.sh b/projects/ArchR/packages/emulators/libretro/freej2me-lr/freej2me.sh index 33c1668e14..bdd7c4b170 100644 --- a/projects/ArchR/packages/emulators/libretro/freej2me-lr/freej2me.sh +++ b/projects/ArchR/packages/emulators/libretro/freej2me-lr/freej2me.sh @@ -15,6 +15,15 @@ fi JDKDEST="/opt/jdk" JDKNAME="zulu11.48.21-ca-jdk11.0.11" +# /opt/jdk -> /storage/jdk; if anything left a non-directory there the +# mkdir/tar steps below would fail with "Not a directory". +if [ -L /opt/jdk ]; then + jdk_target=$(readlink /opt/jdk) + if [ -e "${jdk_target}" ] && [ ! -d "${jdk_target}" ]; then + rm -f "${jdk_target}" + fi +fi + mkdir -p ${JDKDEST} # Check if the jdk does not already exists diff --git a/projects/ArchR/packages/emulators/libretro/retroarch/retroarch-joypads/gamepads/ROCKNIX Gamepad.cfg b/projects/ArchR/packages/emulators/libretro/retroarch/retroarch-joypads/gamepads/ArchR Gamepad.cfg similarity index 100% rename from projects/ArchR/packages/emulators/libretro/retroarch/retroarch-joypads/gamepads/ROCKNIX Gamepad.cfg rename to projects/ArchR/packages/emulators/libretro/retroarch/retroarch-joypads/gamepads/ArchR Gamepad.cfg diff --git a/projects/ArchR/packages/emulators/standalone/hypseus-singe/package.mk b/projects/ArchR/packages/emulators/standalone/hypseus-singe/package.mk index f3f4284f9c..a20e717c2b 100644 --- a/projects/ArchR/packages/emulators/standalone/hypseus-singe/package.mk +++ b/projects/ArchR/packages/emulators/standalone/hypseus-singe/package.mk @@ -26,4 +26,10 @@ post_makeinstall_target() { cp -rf ${PKG_BUILD}/doc/hypinput.ini ${INSTALL}/usr/config/game/configs/hypseus/ ln -fs /storage/.config/game/configs/hypseus/hypinput.ini ${INSTALL}/usr/share/daphne/hypinput.ini cp ${PKG_BUILD}/start_hypseus.sh ${INSTALL}/usr/bin + # CMake leaves cmake_install.cmake / CMakeCache.txt sprinkled across + # the install tree; they embed the host build path and are useless at + # runtime, so strip them. + find ${INSTALL}/usr/share/daphne -name 'cmake_install.cmake' -delete 2>/dev/null || true + find ${INSTALL}/usr/share/daphne -name 'CMakeCache.txt' -delete 2>/dev/null || true + find ${INSTALL}/usr/share/daphne -name 'CMakeFiles' -type d -exec rm -rf {} + 2>/dev/null || true } diff --git a/projects/ArchR/packages/misc/modules/sources/images/install-rocknix.svg b/projects/ArchR/packages/misc/modules/sources/images/install-archr.svg similarity index 100% rename from projects/ArchR/packages/misc/modules/sources/images/install-rocknix.svg rename to projects/ArchR/packages/misc/modules/sources/images/install-archr.svg diff --git a/projects/ArchR/packages/network/samba/package.mk b/projects/ArchR/packages/network/samba/package.mk index a1454a6831..4dca4a57e8 100644 --- a/projects/ArchR/packages/network/samba/package.mk +++ b/projects/ArchR/packages/network/samba/package.mk @@ -187,5 +187,17 @@ post_makeinstall_target() { cp -PR bin/default/source3/utils/smbpasswd ${INSTALL}/usr/bin fi + + # waf install writes Python scripts whose shebang points at the build + # host's python3 (TOOLCHAIN/bin/python3). Rewrite to /usr/bin/python3 + # so they actually run on the target. samba-gpupdate is the survivor + # of the broad rm -rf above; protect against future ones too. + if [ -d ${INSTALL}/usr/sbin ]; then + find ${INSTALL}/usr/sbin -maxdepth 1 -type f | while read -r script; do + if head -c 200 "$script" 2>/dev/null | head -1 | grep -q '^#!.*python'; then + sed -i '1s|^#!.*python.*|#!/usr/bin/python3|' "$script" + fi + done + fi } diff --git a/projects/ArchR/packages/sysutils/systemd/scripts/userconfig-setup b/projects/ArchR/packages/sysutils/systemd/scripts/userconfig-setup index 99e7479012..3493e4e149 100755 --- a/projects/ArchR/packages/sysutils/systemd/scripts/userconfig-setup +++ b/projects/ArchR/packages/sysutils/systemd/scripts/userconfig-setup @@ -77,3 +77,11 @@ then ln -sf /usr/share/locale /storage/.config/emulationstation/locale fi fi + +### /opt/jdk is a symlink to /storage/jdk that freej2me-lr fills on first +### launch. Older builds left a stray /storage/jdk file (0 bytes) that +### turns the symlink into a non-directory and breaks every JDK consumer. +### Run this saneamento every boot, not just under the .configured guard. +if [ -e "/storage/jdk" ] && [ ! -d "/storage/jdk" ]; then + rm -f /storage/jdk +fi diff --git a/projects/ArchR/packages/tools/pyFDT/package.mk b/projects/ArchR/packages/tools/pyFDT/package.mk index 28ee7e17f5..d8b0943c2e 100644 --- a/projects/ArchR/packages/tools/pyFDT/package.mk +++ b/projects/ArchR/packages/tools/pyFDT/package.mk @@ -23,3 +23,14 @@ make_target() { makeinstall_target() { python3 setup.py install --root=${INSTALL} --prefix=/usr } + +post_makeinstall_target() { + # setuptools writes the build-host python3 path into entry-point + # shebangs, which then point at /media/.../toolchain/bin/python3 on + # the target and refuse to run. Rewrite to /usr/bin/python3 (the + # target's interpreter). + for s in ${INSTALL}/usr/bin/pydtc; do + [ -f "$s" ] || continue + sed -i '1s|^#!.*python.*|#!/usr/bin/python3|' "$s" + done +} diff --git a/projects/ArchR/packages/ui/emulationstation/package.mk b/projects/ArchR/packages/ui/emulationstation/package.mk index 174c540a38..0657d1032a 100644 --- a/projects/ArchR/packages/ui/emulationstation/package.mk +++ b/projects/ArchR/packages/ui/emulationstation/package.mk @@ -107,7 +107,10 @@ makeinstall_target() { EOF fi - ln -sf ${INSTALL}/usr/config/emulationstation/es_systems.cfg ${INSTALL}/etc/emulationstation/es_systems.cfg + # Symlink target must be an in-target path (/usr/config/...), not the + # host's ${INSTALL} build dir, otherwise the staged symlink points to + # the builder's filesystem and breaks on the device. + ln -sf /usr/config/emulationstation/es_systems.cfg ${INSTALL}/etc/emulationstation/es_systems.cfg ln -sf /storage/.cache/system_timezone ${INSTALL}/etc/timezone