手上專案用到 Yocto 當作 Framework, 在新增一個元件 ksmbd-tools 的時候, 遇到 libglib-2.0 無法正常 install rootfs 的問題. log 如下:
WARNING: core-image-1.0-r0 do_rootfs: libglib-2.0-0.postinst returned 126, marking as unpacked only, configuration required on target.
ERROR: core-image-1.0-r0 do_rootfs: Postinstall scriptlets of ['libglib-2'] have failed. If the intention is to defer them to first boot, then please place them into pkg_postinst_ontarget_${PN} (). Deferring to first boot via 'exit 1' is no longer supported.
Details of the failure are in /home/lily/build/tmp/work/k-distro-linux-musl/core-image/1.0-r0/temp/log.do_rootfs.
ERROR: Logfile of failure stored in: /home/lily/build/tmp/work/k-distro-linux-musl/core-image/1.0-r0/temp/log.do_rootfs.27578
一開始完全沒有頭緒, Yocto 給出的建議有跟沒有一樣.
Google 所有關鍵字, 找到的文章, 要嘛沒有人回應, 要嘛回應的作法跟我遇到的問題無關.
最後只好硬著頭皮看 log: "/home/lily/build/tmp/work/k-distro-linux-musl/core-image/1.0-r0/temp/log.do_rootfs"
Log 裡面搜尋 glib, 看到如下訊息:
/home/lily/build/tmp/work/k-distro-linux-musl/core-image/1.0-r0/rootfs//var/lib/opkg/info/libglib-2.0-0.postinst: line 4: /home/lily/build/tmp/work/k-distro-linux-musl/core-image/1.0-r0/intercept_scripts-d488f44e3055645f044198b3d91612186d1ffb5bb926320b07b99ff8c208a402/postinst_intercept: Permission denied
很好, 至少是個我能解決的問題.
搜尋了一輪, 發現這是個 script, 而且是從 Yocto 標準 script pool 複製過來的. 位置如下:
/scripts/postinst-intercepts/postinst_intercept
把這個檔案用 chmod 改成可執行: chmod 777 postinst-intercepts/postinst_intercept
然後 commit/push, 從此解掉這個問題.