When booting into a read-only image with systemd as init system, ldconfig.service fails with: Jul 10 19:00:39 intel-corei7-64 ldconfig[461]: /sbin/ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Read-only file system Jul 10 19:00:39 intel-corei7-64 systemd[1]: [[0;1;39mldconfig.service: Main process exited, code=exited, status=1/FAILURE[[0m Jul 10 19:00:39 intel-corei7-64 systemd[1]: [[0;1;31mFailed to start Rebuild Dynamic Linker Cache.[[0m Jul 10 19:00:39 intel-corei7-64 systemd[1]: [[0;1;39mldconfig.service: Unit entered failed state.[[0m Jul 10 19:00:39 intel-corei7-64 systemd[1]: [[0;1;39mldconfig.service: Failed with result 'exit-code'.[[0m I think (but haven't checked again) that ld.so.cache also gets re-generated unnecessarily when booting into a read/write image. Avoiding unnecessary re-generation might be the right solution. However, I don't know how one would check the "unnecessary" part. If that can't be done, then the situation might have to stay the same for read/write (always re-generate) and for read-only the service needs to be disabled. Can be reproduced with refkit-image-installer under qemu. See also bug #11776, which affects the same configuration.
Would this be solved by this which just landed into master: initramfs-live-boot: disable systemd-update-done.service on live images
(In reply to comment #1) > Would this be solved by this which just landed into master: > > initramfs-live-boot: disable systemd-update-done.service on live images No, that only solves the issue for an initramfs that uses init-live.sh. It is not solved for a normal read-only rootfs, not does it address the "ld.so.cache also gets re-generated unnecessarily when booting into a read/write image" part. But probably the technique used in that patch can be generalized also for the other scenarios.
Maxin, can you take this?
(In reply to comment #3) > Maxin, can you take this? Sure.
(In reply to comment #0) > > I think (but haven't checked again) that ld.so.cache also gets re-generated > unnecessarily when booting into a read/write image. > This has been puzzling me for a while, looking at the source code of ldconfig https://github.com/lattera/glibc/blob/master/elf/ldconfig.c We can see the the cache file contains directory entries. So I don't understand how you can actually "cross-compile" a cache file, as the directory entries reflect the build host machine. So the way I understand this, a cross-compiled ld.so.cache needs to re-generate right away, as all entries are originally invalid, originating from the build host.
Can't reproduce. ldconfig.service not even to start because start condition is not met. root@qemux86-64:~# touch /abc touch: /abc: Read-only file system root@qemux86-64:~# root@qemux86-64:~# systemctl status ldconfig| more ● ldconfig.service - Rebuild Dynamic Linker Cache Loaded: loaded (/lib/systemd/system/ldconfig.service; static; vendor preset: enabled) Active: inactive (dead) Condition: start condition failed at Tue 2019-01-08 03:05:36 UTC; 5min ago ├─ ConditionNeedsUpdate=|/etc was not met └─ ConditionFileNotEmpty=|!/etc/ld.so.cache was not met Docs: man:ldconfig(8) Patrick, did you have extra configure?
(In reply to comment #6) > Can't reproduce. ldconfig.service not even to start because start condition > is not met. > > root@qemux86-64:~# touch /abc > touch: /abc: Read-only file system > root@qemux86-64:~# > root@qemux86-64:~# systemctl status ldconfig| more > > ● ldconfig.service - Rebuild Dynamic Linker Cache > Loaded: loaded (/lib/systemd/system/ldconfig.service; static; vendor > preset: enabled) > > Active: inactive (dead) > Condition: start condition failed at Tue 2019-01-08 03:05:36 UTC; 5min ago > ├─ ConditionNeedsUpdate=|/etc was not met > └─ ConditionFileNotEmpty=|!/etc/ld.so.cache was not met > Docs: man:ldconfig(8) > > > Patrick, did you have extra configure? Hi I just ran into this issue. We get the same error as OP. We have a bb file adding a symlink like so: ln -s /var/run/ld.so.cache ${D}${sysconfdir}/ld.so.cache
I built a systemd image (core-image-sato) and agree this seems to work fine for me: root@qemux86-64:~# systemctl status ldconfig ○ ldconfig.service - Rebuild Dynamic Linker Cache Loaded: loaded (/lib/systemd/system/ldconfig.service; static) Active: inactive (dead) Condition: start condition failed at Tue 2021-09-28 16:41:57 UTC; 2min 49s ago ├─ ConditionNeedsUpdate=|/etc was not met └─ ConditionFileNotEmpty=|!/etc/ld.so.cache was not met with ldconfig -p showing cache entries which seem to match the system.