Skip to content

initrd-setup-root: Set up more /var directories from packages #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2023

Conversation

pothos
Copy link
Member

@pothos pothos commented Mar 30, 2023

The base_image_var.conf contents are generated during image build and
don't originally come from tmpfiles rules but from package
installation. For those rules coming from a package's tmpfiles I think
t's enough to let them do the job at their regular boot stage but for
those not from tmpfiles we don't really know whether this works for
them, so I added it as precaution. Also, add info on where
/var/log/journal gets set up.

How to use

Backport to Alpha

Testing done

Done

pothos added a commit to flatcar-archive/coreos-overlay that referenced this pull request Mar 30, 2023
This pulls in flatcar/bootengine#60
to fix the persisting of the journal on first boot.
Comment on lines 90 to 91
baselayout-home.conf base_image_var.conf \
var.conf
Copy link
Member

Choose a reason for hiding this comment

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

Where the base_image_var.conf and var.conf come from?

Copy link
Member Author

Choose a reason for hiding this comment

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

All these files are under /sysroot/usr/lib/tmpfiles.d/

Copy link
Contributor

Choose a reason for hiding this comment

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

I got an error from the initramfs when trying to apply this conf:

                bash-5.1# systemd-tmpfiles --root=/sysroot --create var.conf
                /sysroot/usr/lib/tmpfiles.d/var.conf:15: Failed to resolve group 'utmp'.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the confusion. I meant that I know that baselayout-home.conf comes from our baselayout project, but I don't know from which project base_image_var.conf and var.conf come from. I couldn't find them in systemd, init or baselayout. That's why I'm asking.

Copy link
Member Author

Choose a reason for hiding this comment

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

base_image_var.conf is generated based on package contents, var.conf comes from systemd.

Ok, sounds like we should not add var.conf directly but only copy the wanted line somehow

Copy link
Member

Choose a reason for hiding this comment

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

Ok, sounds like we should not add var.conf directly but only copy the wanted line somehow

flatcar-tmpfiles in baselayout could also copy the utmp group to solve the issue Mathieu had.

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.
systemd-tmpfiles --root=/sysroot --create \
baselayout.conf baselayout-usr.conf \
baselayout-home.conf
baselayout-home.conf base_image_var.conf \
var.conf
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
var.conf
systemd-tmpfiles --root=/sysroot --create var.conf --exclude-prefix /var/log/wtmp --exclude-prefix /var/log/btmp --exclude-prefix /var/log/lastlog

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, interesting, I went with flatcar/baselayout#29 to only work on Flatcar-specific things and be independent from systemd changes

@tormath1
Copy link
Contributor

Note: it's possible to quickly identify if the system is persisting logs by running: journactl --verify: if you only see /run/log/journal/* it means the issue is still present.
I'm looking to provide tests to avoid future regressions.

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
Copy link
Member Author

pothos commented Apr 3, 2023

Looks ok now:

journalctl --verify
PASS: /run/log/journal/c7ff69fdb5844e33a22092259bad1823/system.journal                                                                             
PASS: /var/log/journal/6716a3388bb147ec955254cbe893efc6/system.journal

After the reboot I also see the first boot:

journalctl --list-boots
IDX BOOT ID                          FIRST ENTRY                 LAST ENTRY                 
 -1 272c012b16a04d55b5c6d67f1ce8c85e Mon 2023-04-03 12:47:37 UTC Mon 2023-04-03 12:50:49 UTC
  0 e953f09c5c494cf2a61dc1c13f27f2a6 Mon 2023-04-03 12:50:54 UTC Mon 2023-04-03 12:51:12 UTC

@pothos pothos marked this pull request as ready for review April 3, 2023 12:51
@pothos pothos requested a review from a team April 3, 2023 12:52
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 pothos changed the title initrd-setup-root: Run tmpfiles to set up /var/log initrd-setup-root: Set up more /var directories from packages Apr 4, 2023
The base_image_var.conf contents are generated during image build and
don't originally come from tmpfiles rules but from package
installation. For those rules coming from a package's tmpfiles I think
t's enough to let them do the job at their regular boot stage but for
those not from tmpfiles we don't really know whether this works for
them, so I added it as precaution. Also, add info on where
/var/log/journal gets set up.
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 pothos merged commit d3cc0f4 into flatcar-master Apr 4, 2023
@pothos pothos deleted the kai/tmpfiles branch April 4, 2023 15:44
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