<div dir="ltr"><div>Yes, you could replace it with a custom service that generates a predictable /run/machine-id (e.g. by hashing or hmac'ing the MAC address) and then bind-mounts it on top of /etc/machine-id.<br></div><div><br></div><div><div>If you have a persistent data partition that's mounted on /data, I guess it could be integrated just by adding a bind mount to /etc/fstab? I'm not sure how machine-id-commit behaves.</div><div></div></div><div><br></div><div>Really it just needs to be done before journald starts, but for consistency I'd actually do this from the initramfs to make sure it's present as early as possible.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 8, 2019 at 11:00 AM Martin Townsend <<a href="mailto:mtownsend1973@gmail.com">mtownsend1973@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You are right /etc/machine-id is different for every boot as we have a<br>
read-only filesystem. /etc/machine-id is being mounted to<br>
/run/machine-id by systemd-machine-id-setup. I have a persistent data<br>
partition, how do I mount it into this? I tried --root /data but this<br>
didn't work. Should I disable the<br>
/lib/systemd/system/systemd-machine-id-commit.service and create<br>
/etc/machine-id myself using something like the MAC address and some<br>
random numbers?<br>
<br>
Cheers,<br>
Martin.<br>
<br>
<br>
<br>
<br>
On Mon, Oct 7, 2019 at 9:29 PM Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>> wrote:<br>
><br>
> Run both with SYSTEMD_LOG_LEVEL=debug in the environment and compare.<br>
><br>
> Does your /etc/machine-id remain the same across boots?<br>
><br>
> On Mon, Oct 7, 2019, 20:32 Martin Townsend <<a href="mailto:mtownsend1973@gmail.com" target="_blank">mtownsend1973@gmail.com</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I'm trying to get journalctl --list-boots working but it always shows<br>
>> the current boot<br>
>><br>
>> # journalctl --list-boots<br>
>> 0 c064e8c1d1a2403f9370e550bb74ecb2 Mon 2019-10-07 17:02:44 UTC—Mon<br>
>> 2019-10-07 17:17:56 UTC<br>
>><br>
>> I'm using persistent storage and I'm sure I have /var/log/journal<br>
>> setup correctly because if I specify the directory I get the list I'm<br>
>> after<br>
>><br>
>> # journalctl -D /var/log/journal --list-boots<br>
>> -2 90b892156cf240cfb70fbc0129163a7c Mon 2019-10-07 17:02:11 UTC—Mon<br>
>> 2019-10-07 17:02:37 UTC<br>
>> -1 c064e8c1d1a2403f9370e550bb74ecb2 Mon 2019-10-07 17:02:44 UTC—Mon<br>
>> 2019-10-07 17:31:17 UTC<br>
>> 0 ded3a4118bfc4f9682f99c3e4e2d941a Mon 2019-10-07 17:31:26 UTC—Mon<br>
>> 2019-10-07 17:31:39 UTC<br>
>><br>
>> I'm looking through the code and in sd-journal.c it should add the<br>
>> /var/log/journal in the function add_search_paths. Any ideas why it's<br>
>> now working unless I specify the directory explicitly. I'm building<br>
>> systemd using Yocto (thud) release.<br>
>><br>
>> # journalctl --version<br>
>> systemd 239<br>
>> +PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP<br>
>> -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS<br>
>> +KMOD -IDN2 -IDN -PCRE2 default-hierarchy=hybrid<br>
>><br>
>> Here's the end of the configure task in case it helps<br>
>><br>
>> Message: systemd 239<br>
>> split /usr: true<br>
>> split bin-sbin: true<br>
>> prefix directory: /usr<br>
>> rootprefix directory: /<br>
>> sysconf directory: /etc<br>
>> include directory: /usr/include<br>
>> lib directory: /usr/lib<br>
>> rootlib directory: /lib<br>
>> SysV init scripts: /etc/init.d<br>
>> SysV rc?.d directories: /etc<br>
>> PAM modules directory: /lib/security<br>
>> PAM configuration directory: /etc/pam.d<br>
>> RPM macros directory: /usr/lib/rpm/macros.d<br>
>> modprobe.d directory: /lib/modprobe.d<br>
>> D-Bus policy directory: /usr/share/dbus-1/system.d<br>
>> D-Bus session directory: /usr/share/dbus-1/services<br>
>> D-Bus system directory: /usr/share/dbus-1/system-services<br>
>> bash completions directory:<br>
>> /usr/share/bash-completion/completions<br>
>> zsh completions directory: /usr/share/zsh/site-functions<br>
>> extra start script: /etc/rc.local<br>
>> extra stop script: /usr/sbin/halt.local<br>
>> debug shell: /bin/sh @ /dev/tty9<br>
>> TTY GID: 5<br>
>> users GID: -<br>
>> maximum system UID: 999<br>
>> maximum system GID: 999<br>
>> minimum dynamic UID: 61184<br>
>> maximum dynamic UID: 65519<br>
>> minimum container UID base: 524288<br>
>> maximum container UID base: 1878982656<br>
>> /dev/kvm access mode: 0666<br>
>> render group access mode: 0666<br>
>> certificate root directory: /etc/ssl<br>
>> support URL:<br>
>> <a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
>> nobody user name: nobody<br>
>> nobody group name: nobody<br>
>> fallback hostname: localhost<br>
>> symbolic gateway hostnames: _gateway<br>
>> default DNSSEC mode: no<br>
>> default DNS-over-TLS mode: no<br>
>> default cgroup hierarchy: hybrid<br>
>> default KillUserProcesses setting: true<br>
>> default DNS servers: 8.8.8.8<br>
>> 8.8.4.4<br>
>> 2001:4860:4860::8888<br>
>> 2001:4860:4860::8844<br>
>> default NTP servers: <a href="http://time1.google.com" rel="noreferrer" target="_blank">time1.google.com</a><br>
>> <a href="http://time2.google.com" rel="noreferrer" target="_blank">time2.google.com</a><br>
>> <a href="http://time3.google.com" rel="noreferrer" target="_blank">time3.google.com</a><br>
>> <a href="http://time4.google.com" rel="noreferrer" target="_blank">time4.google.com</a><br>
>> time epoch: 0 (1970-01-01T00:00:00+00:00)<br>
>><br>
>> enabled features: PAM, IMA, SMACK, xz, ACL, idn, nss-systemd,<br>
>> binfmt, vconsole, quotacheck, tmpfiles<br>
>> , environment.d, sysusers, firstboot, randomseed, rfkill, logind,<br>
>> machined, hostnamed, timedated, localed, ne<br>
>> tworkd, resolve, polkit, kmod, blkid, nss-myhostname, hwdb, tpm, SysV<br>
>> compat, utmp, ldconfig, hibernate, adm<br>
>> group, wheel group, gshadow<br>
>><br>
>> disabled features: libcryptsetup, AUDIT, AppArmor, SELinux,<br>
>> SECCOMP, zlib, lz4, bzip2, gcrypt, qrenc<br>
>> ode, microhttpd, gnutls, libcurl, libidn2, libidn, libiptc, elfutils,<br>
>> backlight, portabled, importd, timesync<br>
>> d, DNS-over-TLS, coredump, legacy pkla, efi, gnu-efi, xkbcommon,<br>
>> pcre2, dbus, glib, man pages, html pages, ma<br>
>> n page indices, debug hashmap, debug mmap cache, valgrind<br>
>><br>
>> Many Thanks,<br>
>> Martin.<br>
>> _______________________________________________<br>
>> systemd-devel mailing list<br>
>> <a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank">systemd-devel@lists.freedesktop.org</a><br>
>> <a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>