[opensuse-kernel] Kernel Package Retention Feature/purge-kernels script
Hello all, I hope I am finally on the right mailinglist to addres this topic. I am running/testing the above feature in combination with the purge-kernels script on four machines for nearly two months now and I like it very much. I have added/uncommented these two lines in zypp.conf: "multiversion = provides:multiversion(kernel)" and "multiversion.kernels = latest,latest-1,latest-2,running" because I want to keep the new kernel (of course) and the last two working ones. The purge-kernels script is working fine as it removes old kernels during the next reboot following a new kernel install... exept for two packages: The kernel-source and the kernel-devel package are left on disk. These two packages still have to be removed manually via Yast2 or zypper. My questions concerning this problem are - is this behaviour intended and if so then why? - shouldn't the old -source and -devel package also be deleted, together with their corresponding kernel version? I think this is a great feature but it seems to be less useful if one still has to think of removing old -source ande -devel packages manually. Thank you, Andreas -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
On 17.9.2011 13:21, Freigeist wrote:
I hope I am finally on the right mailinglist to addres this topic.
Yes!
I am running/testing the above feature in combination with the purge-kernels script on four machines for nearly two months now and I like it very much.
Great. [...]
The purge-kernels script is working fine as it removes old kernels during the next reboot following a new kernel install... exept for two packages:
The kernel-source and the kernel-devel package are left on disk. These two packages still have to be removed manually via Yast2 or zypper.
My questions concerning this problem are
- is this behaviour intended and if so then why?
It's not really intended, I was just lazy to solve it yet: sub list_old_packages { my ($flavor) = @_; # ignore kernel-source for now return if $flavor =~ /\/source$/;
- shouldn't the old -source and -devel package also be deleted, together with their corresponding kernel version?
Yeah, probably. What needs to be decided is whether and how to support "running" in the context of kernel-source. Also, kernel-source is noarch, so that's another difference. I'll try to come up with something. Thanks for testing. Michal -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
Am 19.09.2011 10:13, schrieb Michal Marek:
On 17.9.2011 13:21, Freigeist wrote:
I hope I am finally on the right mailinglist to addres this topic.
Yes!
I am running/testing the above feature in combination with the purge-kernels script on four machines for nearly two months now and I like it very much.
Great.
[...]
The purge-kernels script is working fine as it removes old kernels during the next reboot following a new kernel install... exept for two packages:
The kernel-source and the kernel-devel package are left on disk. These two packages still have to be removed manually via Yast2 or zypper.
My questions concerning this problem are
- is this behaviour intended and if so then why?
It's not really intended, I was just lazy to solve it yet:
sub list_old_packages { my ($flavor) = @_;
# ignore kernel-source for now return if $flavor =~ /\/source$/;
- shouldn't the old -source and -devel package also be deleted, together with their corresponding kernel version?
Yeah, probably. What needs to be decided is whether and how to support "running" in the context of kernel-source. Also, kernel-source is noarch, so that's another difference. I'll try to come up with something.
If I understand this correctly it means, that the script is not able decide wether a source package is to be kept or to be deleted, is it? What about the version number of the old kernel that will be deleted on the next reboot? Could this number somehow be used as an identifier for the script to identify the corresponding source package? Regards, Andreas -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
On Mon, Sep 19, 2011 at 10:13:44AM +0200, Michal Marek wrote:
Yeah, probably. What needs to be decided is whether and how to support "running" in the context of kernel-source. Also, kernel-source is noarch, so that's another difference. I'll try to come up with something.
Can you try this patch? Michal diff --git a/sbin/purge-kernels b/sbin/purge-kernels index f0eebc4..d5ea592 100755 --- a/sbin/purge-kernels +++ b/sbin/purge-kernels @@ -71,11 +71,13 @@ sub add_package { ($flavor = $name) =~ s/.*-kmp-//; $table = \%kmps; } - $flavor =~ s/-.*//; # XXX: No dashes in flavor names - if ($flavor eq "devel") { - # kernel-devel is a subpackage of kernel-source - $flavor = "source"; + # Put all subpackages into the same group, except for + # kernel-source-{vanilla,rt}, which are packages on their own + if ($flavor !~ /^source/) { + $flavor =~ s/-.*//; # XXX: No dashes in flavor names } + # kernel-devel is a subpackage of kernel-source + $flavor =~ s/^devel/source/; $table->{"$arch/$flavor"} ||= {}; $table->{"$arch/$flavor"}{$vr} ||= []; push(@{$table->{"$arch/$flavor"}{$vr}}, "$name-$vr.$arch"); @@ -130,23 +132,21 @@ sub version_match { sub list_old_packages { my ($flavor) = @_; - # ignore kernel-source for now - return if $flavor =~ /\/source$/; - + my $is_source = $flavor =~ /\/source/; my $kernels = $kernels{$flavor}; my @versions = sort_versions(keys(%$kernels)); my %idx = ( oldest => 0, latest => scalar(@versions) - 1, ); - if ($want_running && $running_flavor eq $flavor) { + if ($want_running && ($running_flavor eq $flavor || $is_source)) { for (my $i = scalar(@versions) - 1; $i >= 0; $i--) { if (version_match($running_version, $versions[$i])) { $idx{running} = $i; last; } } - if (!exists($idx{running})) { + if (!exists($idx{running}) && !$is_source) { print STDERR "$0: Running kernel $running_version-$running_flavor not installed.\n"; print "NOT removing any packages for flavor $flavor.\n"; return; -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
On 19.9.2011 13:57, Michal Marek wrote:
On Mon, Sep 19, 2011 at 10:13:44AM +0200, Michal Marek wrote:
Yeah, probably. What needs to be decided is whether and how to support "running" in the context of kernel-source. Also, kernel-source is noarch, so that's another difference. I'll try to come up with something.
Can you try this patch?
I submitted it to Factory, please try once a new mkinitrd package is published. Michal -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
Am 20.09.2011 10:53, schrieb Michal Marek:
On 19.9.2011 13:57, Michal Marek wrote:
On Mon, Sep 19, 2011 at 10:13:44AM +0200, Michal Marek wrote:
Yeah, probably. What needs to be decided is whether and how to support "running" in the context of kernel-source. Also, kernel-source is noarch, so that's another difference. I'll try to come up with something.
Can you try this patch?
I submitted it to Factory, please try once a new mkinitrd package is published.
Michal
Great! Thanks Michal. I tried to patch my purge-kernels script yesterday but had some difficulties doing that. I didn't know which lines would have to be replaced. Andreas -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
On 09/20/2011 10:53 AM, Michal Marek wrote:
On 19.9.2011 13:57, Michal Marek wrote:
On Mon, Sep 19, 2011 at 10:13:44AM +0200, Michal Marek wrote:
Yeah, probably. What needs to be decided is whether and how to support "running" in the context of kernel-source. Also, kernel-source is noarch, so that's another difference. I'll try to come up with something.
Can you try this patch?
I submitted it to Factory, please try once a new mkinitrd package is published.
Michal
ok easy, as the tool let my previous (now obsolete) -devel and source package) it should remove them after the update of this package -- Bruno Friedmann Ioda-Net Sàrl www.ioda-net.ch openSUSE Member & Ambassador GPG KEY : D5C9B751C4653227 irc: tigerfoot -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
Am 20.09.2011 10:53, schrieb Michal Marek:
I submitted it to Factory, please try once a new mkinitrd package is published.
Michal
I didn't want to wait until this package shows up in factory, so I decided to do some preliminary testing on my own. I downloaded it from here https://build.opensuse.org/package/files?package=mkinitrd&project=openSUSE%3AFactory and extracted and put only the purge-kernels script of this package into /sbin of two different installations. I took a look into the purge-kernels.init script (which seems to equal the purge-kernel shell script on my systems in /etc/init.d/). It says that the file /boot/do_purge_kernels hast to be present to execute the /sbin/purge-kernels script after a new kernel has been installed. I assume, that this do_purge-kernels file will be created during or after installation of a new kernel but I don't have a clue what creates or should create it. So I took care of if this file will be created after a kernel installation. The setup Both are 12.1 MS 5 installations. - Installation #1 has the remnants (kernel-source and kernel-devel) of a deleted kernel left on the disk. I wanted to test if these get removed by the script. - Installation #2 has no remnants, I removed them manually after the last deletion of an older kernel. On this installation I installed an older kernel to see if it will be removed on the next reboot. Testing 1.) I started testing with installation #2: Kernel 2.6.37 was installed with sources from the openSUSE updates repo which was enabled for this test. a) After the installation finished I checked if the file /boot/do_purge_kernels was present and it was not. As expected in this case on the next reboot no old kernel was deleted. b) I then created the /boot/do_purge_kernels files (an empty file) manually and rebooted. During the boot process the purge-kernels script was executed and deleted the oldest kernel, including -source and -devel packages. c) I did the test installation of a new kernel twice: One with zypper, the other one with yast2. This didn't make any difference concerning the presence of /boot/do_purge_kernels after a kernel installation. In both cases the results were the same as described in a) and b): No /boot/do_purge_kernels file present and I had to create it manually to have the purge-kernels script executed on reboot. 2.) In installation #1 I wanted to test if the leftover -source and -devel packages would be identified as "to be deleted". Since no kernel installation took place I just executed the purge-kernels script in a terminal with the "--test" switch. The script recognized the -source and -devel packages. After that I executed the script without the "--test" switch and both packages were removed. Results The purge-kernels script is working as expected and is removing older kernels as configured in zypp.conf, including -source and -devel packages. But for whatever reason the /boot/do_purge_kernels file is not created after the installation of a new kernel so that, as a result of this, the purge-kernels script will not be executed on the next reboot. This is something I don't understand since it has been working in the past and the only change I did to the two systems was to use the purge-kernels script of the new mkinitrd package. Andreas -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
On 21.9.2011 16:40, Freigeist wrote:
I didn't want to wait until this package shows up in factory, so I decided to do some preliminary testing on my own.
I downloaded it from here
https://build.opensuse.org/package/files?package=mkinitrd&project=openSUSE%3AFactory
and extracted and put only the purge-kernels script of this package into /sbin of two different installations.
I took a look into the purge-kernels.init script (which seems to equal the purge-kernel shell script on my systems in /etc/init.d/). It says that the file /boot/do_purge_kernels hast to be present to execute the /sbin/purge-kernels script after a new kernel has been installed. I assume, that this do_purge-kernels file will be created during or after installation of a new kernel but I don't have a clue what creates or should create it. So I took care of if this file will be created after a kernel installation.
The setup
[...] Thanks for the thorough testing!
Results
The purge-kernels script is working as expected and is removing older kernels as configured in zypp.conf, including -source and -devel packages.
Great.
But for whatever reason the /boot/do_purge_kernels file is not created after the installation of a new kernel so that, as a result of this, the purge-kernels script will not be executed on the next reboot.
This is something I don't understand since it has been working in the past and the only change I did to the two systems was to use the purge-kernels script of the new mkinitrd package.
This is created by the kernel %post, but you were using the 11.4 kernel, which did not have this feature yet. Michal -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
Am 21.09.2011 16:45, schrieb Michal Marek:
[...]
Thanks for the thorough testing!
You're welcome.
But for whatever reason the /boot/do_purge_kernels file is not created after the installation of a new kernel so that, as a result of this, the purge-kernels script will not be executed on the next reboot.
This is something I don't understand since it has been working in the past and the only change I did to the two systems was to use the purge-kernels script of the new mkinitrd package.
This is created by the kernel %post, but you were using the 11.4 kernel, which did not have this feature yet.
Thanks for the info. Although I am sure now that it will work with newer kernels, I'll wait for the mkinitrd package to appear in factory and for a new kernel and will keep on testing. I'll keep you posted. Andreas -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
Am 21.09.2011 20:37, schrieb Freigeist:
Thanks for the info. Although I am sure now that it will work with newer kernels, I'll wait for the mkinitrd package to appear in factory and for a new kernel and will keep on testing. I'll keep you posted.
Hello, sorry for the delay but I wanted to wait until a new kernel is released in factory. I tested the purge-kernels script on four different 12.1 Beta 1 (I don't know if they are really Beta 1 already but at least the systems are telling me that they are) installations: KDE, Gnome, XFCE and LXDE. Right now the script doesn't work at all. Here is what happened and what I did on all four systems. - installed new kernel 3.1 RC7 with zypper - checked that /boot/do_purge_kernels is present and it was - rebooted - nothing gets removed, older kernels still present, including source and devel packages The problem is, that with systemd I don't get any information during the boot process and I did not find anything in the log files. So I just recreated /boot/do_purge_kernels manually and booted again. Nothing happened. I did a "systemctl status purge-kernels.service" and received the follwing: "purge-kernels.service - LSB: Purge old kernels Loaded: loaded (/etc/init.d/purge-kernels) Active: failed since Thu, 29 Sep 2011 22:50:49 + 0200; 2min 30s ago Process: 782 ExecStart=/etc/init.d/purge-kernels start (code=exited, status=1/FAILURE) OGroup: name=systemd:/system/purge-kernels.service" After that I executed "purge-kernels" in a terminal window and got this message: "error: failed dependencies: kernel-devel = 2.6.37.6-0.7 is needed by (installed) kernel-xen-devel-2.6.37.6-0.7.1.i586 /sbin/purge-kernels giving up" Then I booted two of these four installations again using init=/bin/init and did the same again with the same results. Should I file a bug report? Regards, Andreas -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
On 30.9.2011 08:42, Freigeist wrote:
After that I executed "purge-kernels" in a terminal window and got this message:
"error: failed dependencies: kernel-devel = 2.6.37.6-0.7 is needed by (installed) kernel-xen-devel-2.6.37.6-0.7.1.i586 /sbin/purge-kernels giving up"
Then I booted two of these four installations again using init=/bin/init and did the same again with the same results.
Yes, and please include the output of $ rpm -qa 'kernel-*' '*-kmp-*' $ grep multiversion /etc/zypp/zypp.conf Thanks, Michal -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
Am 30.09.2011 09:45, schrieb Michal Marek:
On 30.9.2011 08:42, Freigeist wrote:
After that I executed "purge-kernels" in a terminal window and got this message:
"error: failed dependencies: kernel-devel = 2.6.37.6-0.7 is needed by (installed) kernel-xen-devel-2.6.37.6-0.7.1.i586 /sbin/purge-kernels giving up"
Then I booted two of these four installations again using init=/bin/init and did the same again with the same results.
Yes, and please include the output of $ rpm -qa 'kernel-*' '*-kmp-*' $ grep multiversion /etc/zypp/zypp.conf
Thanks, Michal
Hello Michal, Done. https://bugzilla.novell.com/show_bug.cgi?id=721481 Andreas -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org
Thanks for fixing it Michal. Best regards Andreas -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-kernel+owner@opensuse.org
On 10/18/2011 12:55 PM, Freigeist wrote:
Thanks for fixing it Michal.
Best regards
Andreas
And my last test after the 3.1-rc9 install look very good now S | Name | Type | Version | Arch | Repository --+--------------------------------+---------+--------------+--------+------------------ i | devel_kernel | pattern | 12.1-23.1 | x86_64 | factory-oss i | devel_kernel | pattern | 12.1-23.1 | i586 | factory-oss i | kernel-default-devel | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-default-devel | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-default-devel-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug i | kernel-desktop | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-desktop | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-desktop-base-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug i | kernel-desktop-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug i | kernel-desktop-devel | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-desktop-devel | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-desktop-devel-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug i | kernel-devel | package | 3.1.rc9-1.1 | noarch | factory-oss i | kernel-devel | package | 3.1.rc7-3.2 | noarch | (System Packages) i | kernel-docs | package | 3.1.rc9-1.1 | noarch | factory-oss i | kernel-firmware | package | 20110709-8.2 | noarch | factory-oss i | kernel-source | package | 3.1.rc9-1.1 | noarch | factory-oss i | kernel-source | package | 3.1.rc7-3.2 | noarch | (System Packages) i | kernel-syms | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-syms | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-xen-devel | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-xen-devel | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-xen-devel-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug with this param in zypp.conf multiversion = provides:multiversion(kernel) multiversion.kernels = latest,latest-1,running But I would expect to have 3.1.rc6 kept but in fact not as purge_kernel start after reboot the running always = the latest which is not the case during the install Am I right ? -- Bruno Friedmann Ioda-Net Sàrl www.ioda-net.ch openSUSE Member & Ambassador GPG KEY : D5C9B751C4653227 irc: tigerfoot -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-kernel+owner@opensuse.org
Am 18.10.2011 21:21, schrieb Bruno Friedmann:
And my last test after the 3.1-rc9 install look very good now
S | Name | Type | Version | Arch | Repository --+--------------------------------+---------+--------------+--------+------------------ i | devel_kernel | pattern | 12.1-23.1 | x86_64 | factory-oss i | devel_kernel | pattern | 12.1-23.1 | i586 | factory-oss i | kernel-default-devel | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-default-devel | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-default-devel-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug i | kernel-desktop | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-desktop | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-desktop-base-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug i | kernel-desktop-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug i | kernel-desktop-devel | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-desktop-devel | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-desktop-devel-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug i | kernel-devel | package | 3.1.rc9-1.1 | noarch | factory-oss i | kernel-devel | package | 3.1.rc7-3.2 | noarch | (System Packages) i | kernel-docs | package | 3.1.rc9-1.1 | noarch | factory-oss i | kernel-firmware | package | 20110709-8.2 | noarch | factory-oss i | kernel-source | package | 3.1.rc9-1.1 | noarch | factory-oss i | kernel-source | package | 3.1.rc7-3.2 | noarch | (System Packages) i | kernel-syms | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-syms | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-xen-devel | package | 3.1.rc9-1.1 | x86_64 | factory-oss i | kernel-xen-devel | package | 3.1.rc7-3.2 | x86_64 | (System Packages) i | kernel-xen-devel-debuginfo | package | 3.1.rc9-1.1 | x86_64 | factory-debug
with this param in zypp.conf multiversion = provides:multiversion(kernel) multiversion.kernels = latest,latest-1,running
But I would expect to have 3.1.rc6 kept but in fact not as purge_kernel start after reboot the running always = the latest which is not the case during the install
Am I right ?
This is what I found out, too. At least when the the running kernel (the one you reboot with) is the latest and not an older one. The way to keep three kernels for me - the latest or running one and the last two older kernels - is: multiversion.kernels = latest,latest-1,latest-2,running and reboot with a new kernel after installation. With the line above in your zypp.conf your system would have kept 3.1.rc6. At least this is what my system does. Regards, Andreas -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-kernel+owner@opensuse.org
Dne 18.10.2011 21:21, Bruno Friedmann napsal(a):
with this param in zypp.conf multiversion = provides:multiversion(kernel) multiversion.kernels = latest,latest-1,running
But I would expect to have 3.1.rc6 kept but in fact not as purge_kernel start after reboot the running always = the latest which is not the case during the install
Am I right ?
Yes, "running" is only for the case when you install an older kernel for a test. Michal -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-kernel+owner@opensuse.org
participants (3)
-
Bruno Friedmann
-
Freigeist
-
Michal Marek