The goal is to keep the same /etc/machine-id
when the device is updated with SWUpdate so that the journalctl logs keep the same initially generated machine id even after update.
The journalctl problem was also described in detail by someone else here.
The images are built with Yocto using meta-swupdate
layer.
sw-description file currently looks something like this
rootfs_2_0 : {
A : {
images: (
{
filename = "rpi4.ext4.gz";
sha256 = "$swupdate_get_sha256(rpi4.ext4.gz)";
type = "raw";
compressed = "zlib";
installed-directly = true;
device = "/dev/mmcblk0p2";
}
)
bootenv: (
{
name: "swupdateboot";
value: "/dev/mmcblk0p2";
}
);
}
B : {
images: (
{
filename = "rpi4.ext4.gz";
sha256 = "$swupdate_get_sha256(rpi4.ext4.gz)";
type = "raw";
compressed = "zlib";
installed-directly = true;
device = "/dev/mmcblk0p3";
}
);
bootenv: (
{
name: "swupdateboot";
value: "/dev/mmcblk0p3";
}
);
}
Would like to keep the machine id generated in first boot from /etc/machine.
I've noticed there is a copy-handler in SWUpdate but I'm not sure if this the best way to do it.
Also tried the solution from the answer "Is there a way to create a link for the machine ID without modifying Yocto?" but the partition I have for data boots later so I could not create a working link from that location to /etc/machine-id