[systemd-devel] Journalctl --list-boots problem
Martin Townsend
mtownsend1973 at gmail.com
Tue Oct 8 15:57:00 UTC 2019
Thanks for your help. In the end I just created a symlink from
/etc/machine-id to /data/etc/machine-id. It complains really early on
boot with
Cannot open /etc/machine-id: No such file or directory
So I guess it's trying to read /etc/machine-id for something before
fstab has been processed and the data partition is ready.
But the journal seems to be working ok and --list-boots is fine. The
initramfs would definitely be more elegant solution to ensure
/etc/machine-id is ready.
I don't suppose you know what requires /etc/machine-id so early in the boot?
Cheers,
Martin.
On Tue, Oct 8, 2019 at 4:41 PM Mantas Mikulėnas <grawity at gmail.com> wrote:
>
> 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.
>
> 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.
>
> 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.
>
> On Tue, Oct 8, 2019 at 11:00 AM Martin Townsend <mtownsend1973 at gmail.com> wrote:
>>
>> You are right /etc/machine-id is different for every boot as we have a
>> read-only filesystem. /etc/machine-id is being mounted to
>> /run/machine-id by systemd-machine-id-setup. I have a persistent data
>> partition, how do I mount it into this? I tried --root /data but this
>> didn't work. Should I disable the
>> /lib/systemd/system/systemd-machine-id-commit.service and create
>> /etc/machine-id myself using something like the MAC address and some
>> random numbers?
>>
>> Cheers,
>> Martin.
>>
>>
>>
>>
>> On Mon, Oct 7, 2019 at 9:29 PM Mantas Mikulėnas <grawity at gmail.com> wrote:
>> >
>> > Run both with SYSTEMD_LOG_LEVEL=debug in the environment and compare.
>> >
>> > Does your /etc/machine-id remain the same across boots?
>> >
>> > On Mon, Oct 7, 2019, 20:32 Martin Townsend <mtownsend1973 at gmail.com> wrote:
>> >>
>> >> Hi,
>> >>
>> >> I'm trying to get journalctl --list-boots working but it always shows
>> >> the current boot
>> >>
>> >> # journalctl --list-boots
>> >> 0 c064e8c1d1a2403f9370e550bb74ecb2 Mon 2019-10-07 17:02:44 UTC—Mon
>> >> 2019-10-07 17:17:56 UTC
>> >>
>> >> I'm using persistent storage and I'm sure I have /var/log/journal
>> >> setup correctly because if I specify the directory I get the list I'm
>> >> after
>> >>
>> >> # journalctl -D /var/log/journal --list-boots
>> >> -2 90b892156cf240cfb70fbc0129163a7c Mon 2019-10-07 17:02:11 UTC—Mon
>> >> 2019-10-07 17:02:37 UTC
>> >> -1 c064e8c1d1a2403f9370e550bb74ecb2 Mon 2019-10-07 17:02:44 UTC—Mon
>> >> 2019-10-07 17:31:17 UTC
>> >> 0 ded3a4118bfc4f9682f99c3e4e2d941a Mon 2019-10-07 17:31:26 UTC—Mon
>> >> 2019-10-07 17:31:39 UTC
>> >>
>> >> I'm looking through the code and in sd-journal.c it should add the
>> >> /var/log/journal in the function add_search_paths. Any ideas why it's
>> >> now working unless I specify the directory explicitly. I'm building
>> >> systemd using Yocto (thud) release.
>> >>
>> >> # journalctl --version
>> >> systemd 239
>> >> +PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP
>> >> -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS
>> >> +KMOD -IDN2 -IDN -PCRE2 default-hierarchy=hybrid
>> >>
>> >> Here's the end of the configure task in case it helps
>> >>
>> >> Message: systemd 239
>> >> split /usr: true
>> >> split bin-sbin: true
>> >> prefix directory: /usr
>> >> rootprefix directory: /
>> >> sysconf directory: /etc
>> >> include directory: /usr/include
>> >> lib directory: /usr/lib
>> >> rootlib directory: /lib
>> >> SysV init scripts: /etc/init.d
>> >> SysV rc?.d directories: /etc
>> >> PAM modules directory: /lib/security
>> >> PAM configuration directory: /etc/pam.d
>> >> RPM macros directory: /usr/lib/rpm/macros.d
>> >> modprobe.d directory: /lib/modprobe.d
>> >> D-Bus policy directory: /usr/share/dbus-1/system.d
>> >> D-Bus session directory: /usr/share/dbus-1/services
>> >> D-Bus system directory: /usr/share/dbus-1/system-services
>> >> bash completions directory:
>> >> /usr/share/bash-completion/completions
>> >> zsh completions directory: /usr/share/zsh/site-functions
>> >> extra start script: /etc/rc.local
>> >> extra stop script: /usr/sbin/halt.local
>> >> debug shell: /bin/sh @ /dev/tty9
>> >> TTY GID: 5
>> >> users GID: -
>> >> maximum system UID: 999
>> >> maximum system GID: 999
>> >> minimum dynamic UID: 61184
>> >> maximum dynamic UID: 65519
>> >> minimum container UID base: 524288
>> >> maximum container UID base: 1878982656
>> >> /dev/kvm access mode: 0666
>> >> render group access mode: 0666
>> >> certificate root directory: /etc/ssl
>> >> support URL:
>> >> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>> >> nobody user name: nobody
>> >> nobody group name: nobody
>> >> fallback hostname: localhost
>> >> symbolic gateway hostnames: _gateway
>> >> default DNSSEC mode: no
>> >> default DNS-over-TLS mode: no
>> >> default cgroup hierarchy: hybrid
>> >> default KillUserProcesses setting: true
>> >> default DNS servers: 8.8.8.8
>> >> 8.8.4.4
>> >> 2001:4860:4860::8888
>> >> 2001:4860:4860::8844
>> >> default NTP servers: time1.google.com
>> >> time2.google.com
>> >> time3.google.com
>> >> time4.google.com
>> >> time epoch: 0 (1970-01-01T00:00:00+00:00)
>> >>
>> >> enabled features: PAM, IMA, SMACK, xz, ACL, idn, nss-systemd,
>> >> binfmt, vconsole, quotacheck, tmpfiles
>> >> , environment.d, sysusers, firstboot, randomseed, rfkill, logind,
>> >> machined, hostnamed, timedated, localed, ne
>> >> tworkd, resolve, polkit, kmod, blkid, nss-myhostname, hwdb, tpm, SysV
>> >> compat, utmp, ldconfig, hibernate, adm
>> >> group, wheel group, gshadow
>> >>
>> >> disabled features: libcryptsetup, AUDIT, AppArmor, SELinux,
>> >> SECCOMP, zlib, lz4, bzip2, gcrypt, qrenc
>> >> ode, microhttpd, gnutls, libcurl, libidn2, libidn, libiptc, elfutils,
>> >> backlight, portabled, importd, timesync
>> >> d, DNS-over-TLS, coredump, legacy pkla, efi, gnu-efi, xkbcommon,
>> >> pcre2, dbus, glib, man pages, html pages, ma
>> >> n page indices, debug hashmap, debug mmap cache, valgrind
>> >>
>> >> Many Thanks,
>> >> Martin.
>> >> _______________________________________________
>> >> systemd-devel mailing list
>> >> systemd-devel at lists.freedesktop.org
>> >> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
>
> --
> Mantas Mikulėnas
More information about the systemd-devel
mailing list