it wants to purge kernels I did not ask it to

Bug #1713348 reported by Doug Smythies
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-purge
Fix Released
Undecided
Unassigned

Bug Description

Using this command:

./linux-purge --simulate --choose

and then selecting only kernel 4.13.0-rc2-doug1 for purging (I'll attach a screen shot later), the program/script seems to also want to delete several other functional kernels that I want to keep (I'll attach the program output later).

The computer is my main test server, and so I am reluctant to run the script in anything other than dry-run mode for now.

I am also trying the program/script on a test desktop VM, and, once I installed gawk, it seems to be working O.K. there, including cleaning up leftovers from a previous partial kernel removal.

Revision history for this message
Doug Smythies (dsmythies) wrote :

Notice that I did not ask it to delete 4 of the 5 kernels it seems to want to purge.

description: updated
Revision history for this message
Jarno Suni (jarnos) wrote :

Could you attach the output of command
dpkg-query -W -f='${db:Status-Abbrev} ${Package}\n' linux-'*'
in the system you ran the simulation in.

BTW I wonder why the lines in your screenshot are drawn as letters. It does not happen in my system, and locale is reset by 'export LC_ALL=C' in the script.

Revision history for this message
Doug Smythies (dsmythies) wrote :

> BTW I wonder why the lines in your screenshot are drawn as letters.
> It does not happen in my system, and locale is reset by 'export LC_ALL=C' in the script.

I do not know, but maybe because it is an SSH session from a windows computer.
If I use a remote desktop on my VM, it draws lines.

Revision history for this message
Doug Smythies (dsmythies) wrote :
Revision history for this message
Doug Smythies (dsmythies) wrote :

The only thing I can think of that might be different with those 4 kernels is that I might have purged them before and subsequently re-installed them. I'll do some tests based on this idea.

Revision history for this message
Doug Smythies (dsmythies) wrote :

I manually un-installed kernel 4.13.0-rc2-doug2 and then re-installed it. No problem.
I used the rm-kernels-server script (from askubuntu.com) to un-install 4.13.0-rc2-doug2 and then re-installed it. No Problem.

I re-installed an older kernel, 4.10.0-rc7-chen. Still no problem with linux-purge. However, it does show on this:

$ dpkg-query -W -f='${db:Status-Abbrev} ${Package}\n' linux-'*' | grep "^un" | grep linux-modules
un linux-modules-4.10.0-rc7-chen
un linux-modules-4.10.0-stock
un linux-modules-4.5.0-stock
un linux-modules-4.8.0-stock
un linux-modules-4.9.0-stock

So, I guess the modules list thing was a red herring. I do not know why linux-purge wants to remove those extra 4 kernels that I did not ask it to remove.

Revision history for this message
Jarno Suni (jarnos) wrote :

Please pull the latest from git and run the command with new --debug option and attach the generated file.

Revision history for this message
Doug Smythies (dsmythies) wrote :

Now most kernels are not listed at all.

Revision history for this message
Doug Smythies (dsmythies) wrote :

For comment #9 above: It turns out that the kernels are there in the menu list, if one scrolls down. It is just, for whatever reason, the menu now only shows 4 kernels at a time.

Revision history for this message
Doug Smythies (dsmythies) wrote :

I installed the problem kernels on my master VM, and then re-cloned my test VMs.
I get the same issue, which eliminates anything to do with them having been deleted and re-installed, because they have never been previously installed on the VM.

Revision history for this message
Doug Smythies (dsmythies) wrote :

The following additional testes were done:
1.) checkout my old kernel 4.9 branch and compile, using the same kernel configuration file from back then. It seems to want to delete that kernel also. (4.9.0-test)
2.) Observing that all the kernels it seems to want to delete have names with 4.N.0-string and all the others have names with 4.N.0-string-string, then re-compile kernel 4.9 again but call it -test-test (4.9.0-test-test). Not only did the script not want to purge that kernel without me asking for it, it also no longer wanted to purge 4.9.0-test.

Revision history for this message
Jarno Suni (jarnos) wrote :

If you have a kernel image package say linux-image-4.9.0-test, you may have have a header package linux-headers-4.9.0 (without the '-test' part) or some other similarly named package, right?

Revision history for this message
Doug Smythies (dsmythies) wrote :

> If you have a kernel image package say linux-image-4.9.0-test,
> you may have have a header package linux-headers-4.9.0
> (without the '-test' part) or some other similarly named package, right?

No.
The related headers package would only be linux-headers-4.9.0-test

Example (edited):
doug@s15:~/temp$ dpkg -l | grep "\-4\.9\.0"
ii linux-headers-4.9.0 4.9.0-277
ii linux-headers-4.9.0-stock 4.9.0-stock-165
ii linux-headers-4.9.0-test 4.9.0-test-275
ii linux-headers-4.9.0-test-test 4.9.0-test-test-276
ii linux-image-4.9.0 4.9.0-277
ii linux-image-4.9.0-stock 4.9.0-stock-165
ii linux-image-4.9.0-test 4.9.0-test-275
ii linux-image-4.9.0-test-test 4.9.0-test-test-276

Revision history for this message
Jarno Suni (jarnos) wrote :

Could you attach output of
dpkg-query -W -f='${Status} ${Package} ${Depends}\n' linux-headers-'*'

Revision history for this message
Doug Smythies (dsmythies) wrote :
Revision history for this message
Jarno Suni (jarnos) wrote :

I try to protect e.g. reserve depending header packages from being purged and it works fine with usual kernel; if I want to keep linux-headers-4.4.0-92-generic, I should keep linux-headers-4.4.0-92 even if I am going to purge linux-headers-4.4.0-92-lowlatency (i.e. respective header package with different flavor). Maybe I can not rely on package naming generally; I hope there is some naming convention I can rely on. Anyway, I pushed some changes that aim to make the script work better with your development kernels and also work better with mawk as awk alternative, and display checklist better in debug mode.

Revision history for this message
Doug Smythies (dsmythies) wrote :

Works well. Thanks.
I did (on test clone VM):
0.) Remove gawk package, so only mawk is still there.
1.) Don't select anything. Observe it clean up a previous partially uninstalled kernel.
2.) Don't select anything again. It exited with an error, I guess because nothing was selected.
3.) Remove a lowlatency kernel, but keep the same one generic.
4.) Remove another Ubuntu kernel.

Oh, ...

5.) Try to remove 4.9.0-test, resulted in an error exit.

I'll attach the debug file in a moment.

Revision history for this message
Jarno Suni (jarnos) wrote :

It should not error exit now, but I suppose it will not purge 4.9.0-test, if you do not choose to purge 4.9.0-test-test. Is that a problem? If it is, the current logic of removing unneeded dependencies can not be applied.

Jarno Suni (jarnos)
Changed in linux-purge:
status: New → Confirmed
status: Confirmed → In Progress
Revision history for this message
Doug Smythies (dsmythies) wrote :

> It should not error exit now

O.K. thanks.

> but I suppose it will not purge 4.9.0-test,
> if you do not choose to purge 4.9.0-test-test.
> Is that a problem?

I do not know if it is a problem or not. I never actually name my kernels that way. I only did it as a test case.

Jarno Suni (jarnos)
Changed in linux-purge:
status: In Progress → Fix Committed
Jarno Suni (jarnos)
Changed in linux-purge:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.