Skip to contentSkip to conversation

initramfs-live-boot: disable systemd-update-done.service on live images

PATCH In review Carlos Alberto Lopez Perez 4 participants 9 messages Aug 31, 2017 – Sep 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initramfs-live-boot: disable systemd-update-done.service on live images

When systemd is used, it will invoke a service on first boot that triggers a rebuild of ldconfig caches (rebuild dynamic linker cache).

This is fine on the first boot of a system that has been installed, but it makes no sense on a live system. The worst part is that rebuilding this caches is slow and it causes the live system to take longer to boot. (I measured this in 30 seconds longer on a standard PC system booting core-image-sato live from an USB memory).

Disable this by touching /etc/.updated and /var/.updated on the live initramfs.

For more details see https://bugzilla.redhat.com/show_bug.cgi?id=1201725 and
https://www.freedesktop.org/software/systemd/man/systemd-update-done.service.html

---
 meta/recipes-core/initrdscripts/files/init-live.sh | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-core/initrdscripts/files/init-live.sh +4 -0
index 441b41c9d6..46cab6cc77 100644
@@ -84,6 +84,10 @@ boot_live_root() {
     # device node creation events were handled, to avoid unexpected behavior
     killall -9 "${_UDEV_DAEMON##*/}" 2>/dev/null
 
+    # Don't run systemd-update-done on systemd-based live systems
+    # because it triggers a slow rebuild of ldconfig caches.
+    touch ${ROOT_MOUNT}/etc/.updated ${ROOT_MOUNT}/var/.updated
+
     # Allow for identification of the real root even after boot
     mkdir -p  ${ROOT_MOUNT}/media/realroot
     mount -n --move "/run/media/${ROOT_DISK}" ${ROOT_MOUNT}/media/realroot
Signature · 1 line
2.11.0
#1 lore raw

meta/recipes-core/initrdscripts/files/init-live.sh boot_live_root() { · line 89

Quoted 4 lines · Carlos Alberto Lopez Perez
meta/recipes-core/initrdscripts/files/init-live.sh +3 -0
+    # Don't run systemd-update-done on systemd-based live systems
+    # because it triggers a slow rebuild of ldconfig caches.
+    touch ${ROOT_MOUNT}/etc/.updated ${ROOT_MOUNT}/var/.updated

Good catch, there's a bug somewhere in bugzilla for a very similar problem.

Presumably/hopefully systemd isn't hardcoding /etc and /var but respecting sysconfdir and localstatedir, so the touch should also use those variables (by sedding the script).

Ross

#3 lore raw
Quoted 5 lines · Carlos Alberto Lopez Perez
Quoted 1 line · Ross

Presumably/hopefully systemd isn't hardcoding /etc and /var but

respecting

Quoted 1 line

sysconfdir and localstatedir, so the touch should also use those

variables

Quoted 8 lines
Quoted 1 line

(by sedding the script).

https://github.com/systemd/systemd/blob/master/units/
systemd-update-done.service.in#L15
https://github.com/systemd/systemd/blob/master/src/
update-done/update-done.c#L72

// losing the hope

Sigh.

If you promise to file a bug against systemd moaning about that, I'll queue your patch. ;)

Ross

#4 lore raw
Quoted 15 lines · Ross
Quoted 12 lines · Carlos Alberto Lopez Perez
Quoted 1 line · Ross

Presumably/hopefully systemd isn't hardcoding /etc and /var but

respecting

Quoted 1 line

sysconfdir and localstatedir, so the touch should also use those

variables

Quoted 1 line

(by sedding the script).

https://github.com/systemd/systemd/blob/master/units/
systemd-update-done.service.in#L15
https://github.com/systemd/systemd/blob/master/src/
update-done/update-done.c#L72

Quoted 8 lines
Quoted 1 line

// losing the hope

Sigh.

If you promise to file a bug against systemd moaning about that, I'll queue your patch. ;)

Better done than promised! :)
https://github.com/systemd/systemd/issues/6716

Best regards.

#7 lore raw
In reply to Carlos Alberto Lopez Perez
Quoted 9 lines · Carlos Alberto Lopez Perez

When systemd is used, it will invoke a service on first boot that triggers a rebuild of ldconfig caches (rebuild dynamic linker cache).

This is fine on the first boot of a system that has been installed, but it makes no sense on a live system. The worst part is that rebuilding this caches is slow and it causes the live system to take longer to boot. (I measured this in 30 seconds longer on a standard PC system booting core-image-sato live from an USB memory).

Quoted 6 lines

Disable this by touching /etc/.updated and /var/.updated on the live initramfs.

For more details see https://bugzilla.redhat.com/show_bug.cgi?id=1201725 and
https://www.freedesktop.org/software/systemd/man/systemd-update-done.service.html

This should be done to the live boot module of initramfs-framework as well.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#8 lore raw
Quoted 11 lines · Otavio Salvador
Quoted 9 lines · Carlos Alberto Lopez Perez

When systemd is used, it will invoke a service on first boot that triggers a rebuild of ldconfig caches (rebuild dynamic linker cache).

This is fine on the first boot of a system that has been installed, but it makes no sense on a live system. The worst part is that rebuilding this caches is slow and it causes the live system to take longer to boot. (I measured this in 30 seconds longer on a standard PC system booting core-image-sato live from an USB memory).

Quoted 10 lines
Quoted 6 lines

Disable this by touching /etc/.updated and /var/.updated on the live initramfs.

For more details see https://bugzilla.redhat.com/show_bug.cgi?id=1201725 and
https://www.freedesktop.org/software/systemd/man/systemd-update-done.service.html

This should be done to the live boot module of initramfs-framework as well.

I'm not really familiar with the modules there.

What is the use case of doing this there as well? live systems without an initramfs? is that possible?

Where should this exactly be done there?
I don't see the boot_live_root() equivalent.