Skip to content

tmpfiles.d: Add /var/log as entry for baselayout.conf#29

Merged
pothos merged 1 commit intoflatcar-masterfrom
kai/var-log
Apr 4, 2023
Merged

tmpfiles.d: Add /var/log as entry for baselayout.conf#29
pothos merged 1 commit intoflatcar-masterfrom
kai/var-log

Conversation

@pothos
Copy link
Copy Markdown
Member

@pothos pothos commented Mar 30, 2023

The persisting of logs on first boot didn't work anymore because /var/log wasn't created early enough as Mathieu found out. The /var/log directory is set up by var.conf from systemd which we can't easily apply from the initrd due to the utmp user defined there. As workaround, add /var/log also to baselayout.conf which gets applied
from the initrd - but even here we have to copy the systemd-journal
group over to /sysroot/etc/group because systemd-tmpfiles only looks
there and doesn't load the libc and its nss plugin from the chroot.

How to use

Backport to Alpha

Testing done

see flatcar/bootengine#60

pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Mar 30, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Mar 30, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
L /var/run - - - - ../run
# Explicit add of /var/log here even if it has a duplicate in var.conf
# but for the initrd we don't apply var.conf
d /var/log 0755 - - - -
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think of adding /var/log/journal too? As mentioned in the manual: https://www.man7.org/linux/man-pages/man8/systemd-journald.service.8.html

   On systems where /var/log/journal/ does not exist yet but where
   persistent logging is desired (and the default journald.conf is
   used), it is sufficient to create the directory, and ensure it
   has the correct access modes and ownership:

       mkdir -p /var/log/journal
       systemd-tmpfiles --create --prefix /var/log/journal

Something like:

z /var/log/journal 2755 root systemd-journal - -

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, forgot that this is what we wanted and it's in a different file

pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Mar 31, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Mar 31, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Apr 3, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
@pothos pothos requested a review from a team April 3, 2023 12:52
The persisting of logs on first boot didn't work anymore because
/var/log wasn't created early enough as Mathieu found out.
The /var/log directory is set up by var.conf/systemd.conf from systemd
which we can't easily apply from the initrd due to the utmp user
defined there.
As workaround, add /var/log also to baselayout.conf which gets applied
from the initrd - but even here we have to copy the systemd-journal
group over to /sysroot/etc/group because systemd-tmpfiles only looks
there and doesn't load the libc and its nss plugin from the chroot.
@pothos pothos merged commit f55f20a into flatcar-master Apr 4, 2023
@pothos pothos deleted the kai/var-log branch April 4, 2023 02:17
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Apr 4, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Apr 4, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Apr 4, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Apr 4, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Apr 4, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Apr 4, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
t-lo pushed a commit to flatcar/scripts that referenced this pull request Apr 13, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
t-lo pushed a commit to flatcar/scripts that referenced this pull request Apr 17, 2023
This pulls in flatcar/bootengine#60
and flatcar/baselayout#29
to fix the persisting of the journal on first boot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants