Skip to content
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

Ensure that 'logrotate-config.service' is set as a dependency to start before 'logrotate.service'. #17312

Merged

Conversation

xincunli-sonic
Copy link
Contributor

@xincunli-sonic xincunli-sonic commented Nov 28, 2023

  • Summary
    Ensure that 'logrotate-config.service' is set as a dependency to start before 'logrotate.service'.

  • Why I did it?
    This PR addresses the issue: [logrotate]Logrotate sometimes is started before logrotate-config.service #13261

  • How I did it
    Add a configuration file to declare logrotate.sevice will depend on logrotate-config.service

  • How did you verify/test it?

  • Which release branch to backport (provide reason below if selected)

  • 202205

  • 202305

Signed-off-by: Xincun Li [email protected]

Why I did it

This PR addresses the issue: #13261

Work item tracking
  • Microsoft ADO (number only):

How I did it

Add a configuration file to declare logrotate.sevice will depend on logrotate-config.service

How to verify it

Manually create logrotateOverride.conf file under /etc/systemd/system/logrotate.service.d/, then do reboot, it did consume by systemd

admin@str2-msn2700-spy-1:~$ systemctl cat logrotate
# /lib/systemd/system/logrotate.service
[Unit]
...

# /etc/systemd/system/logrotate.service.d/logrotate.conf
[Unit]
Requires=logrotate-config.service

admin@str2-msn2700-spy-1:~$ systemctl cat logrotate-config
# /lib/systemd/system/logrotate-config.service
[Unit]
...
# /etc/systemd/system/logrotate-config.service.d/logrotate-config.conf
[Service]
RemainAfterExit=yes

Also, checking logrotate and logrotate-config, both applied.

admin@str2-msn2700-spy-1:~$ systemctl show logrotate
...
Requires=sysinit.target system.slice logrotate-config.service
...

admin@str2-msn2700-spy-1:~$ systemctl show logrotate-config
...
RemainAfterExit=yes
...
admin@str2-msn2700-spy-1:~$ sudo systemctl list-dependencies logrotate.service
logrotate.service
● ├─logrotate-config.service <--
● ├─system.slice
● └─sysinit.target
●   ├─apparmor.service
●   ├─dev-hugepages.mount
●   ├─dev-mqueue.mount
●   ├─haveged.service
●   ├─kmod-static-nodes.service
●   ├─proc-sys-fs-binfmt_misc.automount
●   ├─sys-fs-fuse-connections.mount
●   ├─sys-kernel-config.mount
●   ├─sys-kernel-debug.mount
●   ├─sys-kernel-tracing.mount
●   ├─systemd-ask-password-console.path
●   ├─systemd-binfmt.service
●   ├─systemd-boot-system-token.service
●   ├─systemd-hwdb-update.service
●   ├─systemd-journal-flush.service
●   ├─systemd-journald.service
●   ├─systemd-machine-id-commit.service
●   ├─systemd-modules-load.service
●   ├─systemd-pstore.service
●   ├─systemd-random-seed.service
●   ├─systemd-sysctl.service
●   ├─systemd-sysusers.service
●   ├─systemd-tmpfiles-setup-dev.service
●   ├─systemd-tmpfiles-setup.service
●   ├─systemd-udev-trigger.service
●   ├─systemd-udevd.service
●   ├─systemd-update-utmp.service
●   ├─cryptsetup.target
●   ├─local-fs.target
●   │ └─systemd-remount-fs.service
●   └─swap.target

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@xincunli-sonic xincunli-sonic removed the request for review from lguohan November 29, 2023 18:53
@xincunli-sonic xincunli-sonic self-assigned this Nov 29, 2023
@yxieca yxieca merged commit f13081b into sonic-net:master Nov 30, 2023
19 checks passed
yxieca pushed a commit that referenced this pull request Dec 4, 2023
…t before 'logrotate.service'. (#17312)

* Ensure that 'logrotate-config.service' is set as a dependency to start before 'logrotate.service'.
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.

4 participants