Patchwork systemd-compat-units: drop machineid.service

login
register
mail settings
Submitter Ross Burton
Date Dec. 12, 2013, 10:04 a.m.
Message ID <1386842653-1089-1-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/63257/
State New
Headers show

Comments

Ross Burton - Dec. 12, 2013, 10:04 a.m.
systemd will create the machine ID automatically if it isn't set, so this unit
doesn't serve any purpose.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/recipes-core/systemd/systemd-compat-units.bb      |    4 ----
 .../systemd/systemd-compat-units/machineid.service     |   16 ----------------
 2 files changed, 20 deletions(-)
 delete mode 100644 meta/recipes-core/systemd/systemd-compat-units/machineid.service
Koen Kooi - Dec. 12, 2013, 11:33 a.m.
Op 12 dec. 2013, om 11:04 heeft Ross Burton <ross.burton@intel.com> het volgende geschreven:

> systemd will create the machine ID automatically if it isn't set,

That's not the whole story, it will generate a new one every boot

> so this unit doesn't serve any purpose.

That's correct, you need to generate it offline, since /etc/machine-id is a bind mount after booting :(


> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
> meta/recipes-core/systemd/systemd-compat-units.bb      |    4 ----
> .../systemd/systemd-compat-units/machineid.service     |   16 ----------------
> 2 files changed, 20 deletions(-)
> delete mode 100644 meta/recipes-core/systemd/systemd-compat-units/machineid.service
> 
> diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
> index 6eb5ffd..e4d93d2 100644
> --- a/meta/recipes-core/systemd/systemd-compat-units.bb
> +++ b/meta/recipes-core/systemd/systemd-compat-units.bb
> @@ -19,10 +19,6 @@ do_install() {
> 	install -m 0644 ${WORKDIR}/run-postinsts.service ${D}${systemd_unitdir}/system
> 	ln -sf ../run-postinsts.service ${D}${systemd_unitdir}/system/basic.target.wants/
> 	ln -sf ../run-postinsts.service ${D}${systemd_unitdir}/system/sysinit.target.wants/
> -
> -	install -m 0644 ${WORKDIR}/machineid.service ${D}${systemd_unitdir}/system
> -	ln -sf ../machineid.service ${D}${systemd_unitdir}/system/sysinit.target.wants/
> -	ln -sf ../machineid.service ${D}${systemd_unitdir}/system/basic.target.wants/
> }
> 
> SYSTEMD_DISABLED_SYSV_SERVICES = " \
> diff --git a/meta/recipes-core/systemd/systemd-compat-units/machineid.service b/meta/recipes-core/systemd/systemd-compat-units/machineid.service
> deleted file mode 100644
> index f586c6d..0000000
> --- a/meta/recipes-core/systemd/systemd-compat-units/machineid.service
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -[Unit]
> -Description=Machine ID first boot configure
> -DefaultDependencies=no
> -ConditionPathExists=|!/etc/machine-id
> -After=systemd-remount-fs.service
> -Before=sysinit.target
> -
> -[Service]
> -ExecStart=/bin/systemd-machine-id-setup
> -RemainAfterExit=No
> -Type=oneshot
> -StandardOutput=syslog
> -
> -[Install]
> -WantedBy=basic.target
> -WantedBy=sysinit.target
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
Ross Burton - Dec. 18, 2013, 3:03 p.m.
On 12 December 2013 11:33, Koen Kooi <koen@dominion.thruhere.net> wrote:
> Op 12 dec. 2013, om 11:04 heeft Ross Burton <ross.burton@intel.com> het volgende geschreven:
>
>> systemd will create the machine ID automatically if it isn't set,
>
> That's not the whole story, it will generate a new one every boot

It will generate a new one on boot *if* /etc/machine-id doesn't
contain a valid ID.  If /etc is read-write then this happens once on
first boot.

>> so this unit doesn't serve any purpose.
>
> That's correct, you need to generate it offline, since /etc/machine-id is a bind mount after booting :(

Why is that bad?  In the read-only-rootfs case you can either pre-seed
the machine ID at image creation time (if a single machine ID across
all instances is reasonable) or let systemd create a fresh one on
every boot in /run/machine-id and bind-mount /etc/machine-id to it.

Ross
Koen Kooi - Dec. 18, 2013, 3:42 p.m.
Op 18 dec. 2013, om 16:03 heeft Burton, Ross <ross.burton@intel.com> het volgende geschreven:

> On 12 December 2013 11:33, Koen Kooi <koen@dominion.thruhere.net> wrote:
>> Op 12 dec. 2013, om 11:04 heeft Ross Burton <ross.burton@intel.com> het volgende geschreven:
>> 
>>> systemd will create the machine ID automatically if it isn't set,
>> 
>> That's not the whole story, it will generate a new one every boot
> 
> It will generate a new one on boot *if* /etc/machine-id doesn't
> contain a valid ID.  If /etc is read-write then this happens once on
> first boot.

Right, booting with 'ro' in the kernel cmdline will prevent that from happening, which means...

> 
>>> so this unit doesn't serve any purpose.
>> 
>> That's correct, you need to generate it offline, since /etc/machine-id is a bind mount after booting :(
> 
> Why is that bad?  In the read-only-rootfs case you can either pre-seed
> the machine ID at image creation time (if a single machine ID across
> all instances is reasonable) or let systemd create a fresh one on
> every boot in /run/machine-id and bind-mount /etc/machine-id to it.

... every boot you get a new machine ID and hence a new journal ID, which sucks. We can debate if that sucks more or less than having duplicate machine IDs across the boards on your desk :)

regards,

Koen
Ross Burton - Dec. 18, 2013, 4 p.m.
On 18 December 2013 15:42, Koen Kooi <koen@dominion.thruhere.net> wrote:
>> Why is that bad?  In the read-only-rootfs case you can either pre-seed
>> the machine ID at image creation time (if a single machine ID across
>> all instances is reasonable) or let systemd create a fresh one on
>> every boot in /run/machine-id and bind-mount /etc/machine-id to it.
>
> ... every boot you get a new machine ID and hence a new journal ID, which sucks. We can
> debate if that sucks more or less than having duplicate machine IDs across the boards on
> your desk :)

Out of the box, the journal is in a tmpfs, so it disappears anyway.

Either way, this service file isn't useful.

Ross
Ross Burton - Dec. 18, 2013, 4:39 p.m.
On 18 December 2013 15:42, Koen Kooi <koen@dominion.thruhere.net> wrote:
> ... every boot you get a new machine ID and hence a new journal ID, which sucks. We can debate if that sucks more or less than having duplicate machine IDs across the boards on your desk :)

In the spirit of Linux we can make this a choice, though something
like a systemd postinst that can optionally write a machine ID to
/etc.  If enabled, the rootfs will get a machine ID at construction
time.

Ross

Patch

diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
index 6eb5ffd..e4d93d2 100644
--- a/meta/recipes-core/systemd/systemd-compat-units.bb
+++ b/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -19,10 +19,6 @@  do_install() {
 	install -m 0644 ${WORKDIR}/run-postinsts.service ${D}${systemd_unitdir}/system
 	ln -sf ../run-postinsts.service ${D}${systemd_unitdir}/system/basic.target.wants/
 	ln -sf ../run-postinsts.service ${D}${systemd_unitdir}/system/sysinit.target.wants/
-
-	install -m 0644 ${WORKDIR}/machineid.service ${D}${systemd_unitdir}/system
-	ln -sf ../machineid.service ${D}${systemd_unitdir}/system/sysinit.target.wants/
-	ln -sf ../machineid.service ${D}${systemd_unitdir}/system/basic.target.wants/
 }
 
 SYSTEMD_DISABLED_SYSV_SERVICES = " \
diff --git a/meta/recipes-core/systemd/systemd-compat-units/machineid.service b/meta/recipes-core/systemd/systemd-compat-units/machineid.service
deleted file mode 100644
index f586c6d..0000000
--- a/meta/recipes-core/systemd/systemd-compat-units/machineid.service
+++ /dev/null
@@ -1,16 +0,0 @@ 
-[Unit]
-Description=Machine ID first boot configure
-DefaultDependencies=no
-ConditionPathExists=|!/etc/machine-id
-After=systemd-remount-fs.service
-Before=sysinit.target
-
-[Service]
-ExecStart=/bin/systemd-machine-id-setup
-RemainAfterExit=No
-Type=oneshot
-StandardOutput=syslog
-
-[Install]
-WantedBy=basic.target
-WantedBy=sysinit.target