+++ This bug was initially created as a clone of Bug #1934042 +++ Description of problem: /usr/lib/systemd/system/kvm_stat.service could not added with kernel-tools, need to add manually, Version-Release number of selected component (if applicable): host kernel:5.11.0-0.rc7.151.el9.s390x qemu:qemu-kvm-5.2.0-7.el9.s390x guest kernel:5.11.0-0.rc7.151.el9.s390x How reproducible: 100% Steps to Reproduce: 1.Install kernel-tools package 2.Try to start kvm_stat logging via 'systemctl start kvm_stat.service Actual results: [root@l42 ~]# systemctl start kvm_stat Failed to start kvm_stat.service: Unit kvm_stat.service not found. Expected results: [root@l42 bfu]# systemctl status kvm_stat ● kvm_stat.service - Service that logs KVM kernel module trace events Loaded: loaded (/usr/lib/systemd/system/kvm_stat.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2021-03-02 04:19:38 EST; 2s ago Main PID: 647939 (kvm_stat) Tasks: 1 (limit: 28846) Memory: 10.7M CPU: 110ms CGroup: /system.slice/kvm_stat.service └─647939 /usr/bin/python3 -s /usr/bin/kvm_stat -dtcz -s 0.1 -L /var/log/kvm_stat.csv
Beside the missing kvm_stat.service file (which can be found in the tools/kvm/kvm_stat/ folder of the kernel sources), we'd also need a matching logrotate config file like this: /var/log/kvm_stat.csv { size 10M missingok compress maxage 30 rotate 5 nodateext postrotate /usr/bin/systemctl try-restart kvm_stat.service endscript }
FWIW, this were the changes that I did for the RHEL8 kernel spec file (for BZ 1919930): diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index 32dac629b11c..78922902c1f3 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -540,6 +540,7 @@ Source400: mod-kvm.list # Sources for kernel-tools Source2000: cpupower.service Source2001: cpupower.config +Source2002: kvm_stat.logrotate ## Patches needed for building this package @@ -2086,9 +2087,11 @@ popd pushd tools/gpio %{tools_make} DESTDIR=%{buildroot} install popd +install -m644 -D %{SOURCE2002} %{buildroot}%{_sysconfdir}/logrotate.d/kvm_stat pushd tools/kvm/kvm_stat make INSTALL_ROOT=%{buildroot} install-tools make INSTALL_ROOT=%{buildroot} install-man +install -m644 -D kvm_stat.service %{buildroot}%{_unitdir}/kvm_stat.service popd # install VM tools pushd tools/vm/ @@ -2448,6 +2451,8 @@ fi %{_bindir}/gpio-event-mon %{_mandir}/man1/kvm_stat* %{_bindir}/kvm_stat +%{_unitdir}/kvm_stat.service +%config(noreplace) %{_sysconfdir}/logrotate.d/kvm_stat %{_bindir}/page_owner_sort %{_bindir}/slabinfo diff --git a/redhat/kvm_stat.logrotate b/redhat/kvm_stat.logrotate new file mode 100644 index 000000000000..105e15e651f0 --- /dev/null +++ b/redhat/kvm_stat.logrotate @@ -0,0 +1,11 @@ +/var/log/kvm_stat.csv { + size 10M + missingok + compress + maxage 30 + rotate 5 + nodateext + postrotate + /usr/bin/systemctl try-restart kvm_stat.service + endscript +} ... I assume the spec file for the Fedora kernel could be adjusted in a similar way?
Seems like this has been fixed in commit 4f81869d2aa7 by Jiri Benc - Thank you very much, Jiri!