From: Jörg Sommer <[email protected]>

The origin of this code is “systemd: arrange for volatile
/etc/resolv.conf” [1] to provide a symlink to /run for resolv.conf to allow
updates on read-only rootfs, because sysvinit did so, too. But this
conflicted with packages like connman [YOCTO #11331], [YOCTO #6700] they
also provide a resolv.conf and resulted in an update-alternative handling
for resolv.conf; “systemd: enable resolved and networkd” [2]. Later, the
installation of the alternatives was made depending on resolved; “systemd:
Expose resolv-conf alternative only when resolved is built” [3].

So, now, when you install systemd without resolved on a read-only rootfs,
you get /etc/resolv-conf.systemd which is unused, because no
update-alternatives run, no resolv.conf, and a warning from tmpfiles that
resolv.conf cannot be created:

    systemd-tmpfiles[114]: symlink(../run/systemd/resolve/resolv.conf, 
/etc/resolv.conf) failed: Read-only file system

Hence, do nothing with resolv.conf if resolved is not installed. A sane
fallback for resolv.conf with ro rootfs support should be provided by
base-files.

[1] 7f087f161e8942bcd35f88999dfca418f01cd7fa
[2] d9b6d538e3d81ab0d5e7b7b6adecef555d782217
[3] 91efc50723229672b6e8187b69b183cba525f199

Signed-off-by: Jörg Sommer <[email protected]>
---
 meta/recipes-core/systemd/systemd_259.5.bb | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd_259.5.bb 
b/meta/recipes-core/systemd/systemd_259.5.bb
index 447974373f..1f988e8177 100644
--- a/meta/recipes-core/systemd/systemd_259.5.bb
+++ b/meta/recipes-core/systemd/systemd_259.5.bb
@@ -324,12 +324,7 @@ do_install() {
           ! ${@bb.utils.contains('PACKAGECONFIG', 'networkd', 'true', 'false', 
d)}; then
                echo 'd /run/systemd/netif/links 0755 root root -' 
>>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
        fi
-       if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', 
d)}; then
-               echo 'L! ${sysconfdir}/resolv.conf - - - - 
../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
-               echo 'd /run/systemd/resolve 0755 root root -' 
>>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
-               echo 'f /run/systemd/resolve/resolv.conf 0644 root root' 
>>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
-               ln -s ../run/systemd/resolve/resolv.conf 
${D}${sysconfdir}/resolv-conf.systemd
-       else
+       if ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', 
d)}; then
                rc="../run/systemd/resolve/${@bb.utils.contains('RESOLV_CONF', 
'stub-resolv', 'stub-', '', d)}resolv.conf"
                sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - 
- $rc%" ${D}${exec_prefix}/lib/tmpfiles.d/systemd-resolve.conf
                ln -s $rc ${D}${sysconfdir}/resolv-conf.systemd
-- 
2.53.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#240337): 
https://lists.openembedded.org/g/openembedded-core/message/240337
Mute This Topic: https://lists.openembedded.org/mt/120144284/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to