/sbin/purge-kernels fails on removing non-installed kernel since rpm -qa report is wrong

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

/sbin/purge-kernels fails on removing non-installed kernel since rpm -qa report is wrong

Thomas Wagner
Hi @all!

I have Leap 42.3 with the Kernel:stable repository enabled.

/sbin/purge-kernels should remove old kernel version. However it fails
to remove one particular kernel version (and subsequently does not
remove anything).

zypper -se -i -v reports that said kernel version is not installed.
rpm -qa reports that said kernel version is installed.
rpm -ql reports that said kernel version is not installed.
Checking /boot/ and /lib/modules/ shows that said kernel is indeed not
installed.

Why can rpm -qa report a package which is not installed?

Can /sbin/purge-kernels use other sources of installed packages than rpm
-qa?

best regards

Thomas




--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: /sbin/purge-kernels fails on removing non-installed kernel since rpm -qa report is wrong

Andrei Borzenkov
27.01.2018 16:14, Thomas Wagner пишет:

> Hi @all!
>
> I have Leap 42.3 with the Kernel:stable repository enabled.
>
> /sbin/purge-kernels should remove old kernel version. However it fails
> to remove one particular kernel version (and subsequently does not
> remove anything).
>
> zypper -se -i -v reports that said kernel version is not installed.
> rpm -qa reports that said kernel version is installed.
> rpm -ql reports that said kernel version is not installed.
> Checking /boot/ and /lib/modules/ shows that said kernel is indeed not
> installed.
>
> Why can rpm -qa report a package which is not installed?
>

RPM database can be corrupted. You can misinterpret output of commands.
As you do not show actual commands and their output you can only expect
pure guesswork answers.

> Can /sbin/purge-kernels use other sources of installed packages than rpm
> -qa?
>

Program that attempts to remove package should check for this package in
package database, should not it? Or do you have other suggestion?

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: /sbin/purge-kernels fails on removing non-installed kernel since rpm -qa report is wrong

Thomas Wagner
On 2018-01-27 19:31, Andrei Borzenkov wrote:

> 27.01.2018 16:14, Thomas Wagner пишет:
>> zypper -se -i -v reports that said kernel version is not installed.
>> rpm -qa reports that said kernel version is installed.
>> rpm -ql reports that said kernel version is not installed.
>> Checking /boot/ and /lib/modules/ shows that said kernel is indeed not
>> installed.
>>
>> Why can rpm -qa report a package which is not installed?
>>
>
> RPM database can be corrupted. You can misinterpret output of commands.
> As you do not show actual commands and their output you can only expect
> pure guesswork answers.
Fair enough, here is the full output:

# /sbin/purge-kernels
x86_64/defaultHASH(0x2725378)error: package
kernel-default-4.4.92-31.1.x86_64 is not installed
/sbin/purge-kernels: giving up.



  # zypper se -i -s kernel-default
Loading repository data...
Reading installed packages...

S  | Name           | Type    | Version              | Arch   |
Repository
---+----------------+---------+----------------------+--------+-------------------------------------------
i+ | kernel-default | package | 4.14.15-3.1.g9e84548 | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.15-2.1.g5b3d0ce | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.14-1.1.geef6178 | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.13-1.1.gbd444a0 | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.7-1.1.g0598608  | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.4-1.1.gb29439c  | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.3-1.1.ga731a45  | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.2-1.1.gb0610fc  | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.1-2.1.ga5bca71  | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.0-1.1.gab9e909  | x86_64 | (System
Packages)
i+ | kernel-default | package | 4.14.15-4.1.g12e5c10 | x86_64 | Kernel
builds for branch stable (standard)
i+ | kernel-default | package | 4.4.104-39.1         | x86_64 |
Hauptaktualisierungs-Repository



# rpm -qa | grep kernel-default | sort
kernel-default-4.14.0-1.1.gab9e909.x86_64
kernel-default-4.14.1-2.1.ga5bca71.x86_64
kernel-default-4.14.13-1.1.gbd444a0.x86_64
kernel-default-4.14.14-1.1.geef6178.x86_64
kernel-default-4.14.15-2.1.g5b3d0ce.x86_64
kernel-default-4.14.15-3.1.g9e84548.x86_64
kernel-default-4.14.15-4.1.g12e5c10.x86_64
kernel-default-4.14.2-1.1.gb0610fc.x86_64
kernel-default-4.14.3-1.1.ga731a45.x86_64
kernel-default-4.14.4-1.1.gb29439c.x86_64
kernel-default-4.14.7-1.1.g0598608.x86_64
kernel-default-4.4.104-39.1.x86_64
kernel-default-4.4.92-31.1.x86_64



# rpm -ql kernel-default-4.4.92-31.1.x86_64
package kernel-default-4.4.92-31.1.x86_64 is not installed


>> Can /sbin/purge-kernels use other sources of installed packages than
>> rpm
>> -qa?
> Program that attempts to remove package should check for this package
> in
> package database, should not it? Or do you have other suggestion?
Yeah, my suggestion is an option to choose whether to use rpm's or
zypper's database, as there can be obviously a state where they differ.
This would also solve
https://bugzilla.opensuse.org/show_bug.cgi?id=768947
Avoiding the difference between zypper and rpm at all would be best, but
I'm not sure how that difference could occur in the first place, neither
do I know how to fix this.

best regards

Thomas

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: /sbin/purge-kernels fails on removing non-installed kernel since rpm -qa report is wrong

Thomas Wagner
In reply to this post by Andrei Borzenkov
On 2018-01-28 09:52, Andrei Borzenkov wrote:
> 28.01.2018 11:09, Thomas Wagner пишет:
>> On 2018-01-27 19:31, Andrei Borzenkov wrote:

>> # rpm -qa | grep kernel-default | sort
>> kernel-default-4.14.0-1.1.gab9e909.x86_64
>> kernel-default-4.14.1-2.1.ga5bca71.x86_64
>> kernel-default-4.14.13-1.1.gbd444a0.x86_64
>> kernel-default-4.14.14-1.1.geef6178.x86_64
>> kernel-default-4.14.15-2.1.g5b3d0ce.x86_64
>> kernel-default-4.14.15-3.1.g9e84548.x86_64
>> kernel-default-4.14.15-4.1.g12e5c10.x86_64
>> kernel-default-4.14.2-1.1.gb0610fc.x86_64
>> kernel-default-4.14.3-1.1.ga731a45.x86_64
>> kernel-default-4.14.4-1.1.gb29439c.x86_64
>> kernel-default-4.14.7-1.1.g0598608.x86_64
>> kernel-default-4.4.104-39.1.x86_64
>> kernel-default-4.4.92-31.1.x86_64
>>
>>
>>
>> # rpm -ql kernel-default-4.4.92-31.1.x86_64
>> package kernel-default-4.4.92-31.1.x86_64 is not installed
>>
>
> Database consists of data and indexes. "rpm -qa" will crawl all data,
> while "rpm -q" attempts to only check index. This implies that RPM
> database is corrupted and index was not properly updated after package
> was removed. You may try to run
>
> cd /var/lib/rpm
> /usr/lib/rpm/rpmdb_verify Packages Name
>
> to see if it finds anything.
Thanks for the suggestion. I just tired it and does not report anything.



--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: /sbin/purge-kernels fails on removing non-installed kernel since rpm -qa report is wrong

Andrei Borzenkov
29.01.2018 18:50, Thomas Wagner пишет:

> On 2018-01-28 09:52, Andrei Borzenkov wrote:
>> 28.01.2018 11:09, Thomas Wagner пишет:
>>> On 2018-01-27 19:31, Andrei Borzenkov wrote:
>
>>> # rpm -qa | grep kernel-default | sort
>>> kernel-default-4.14.0-1.1.gab9e909.x86_64
>>> kernel-default-4.14.1-2.1.ga5bca71.x86_64
>>> kernel-default-4.14.13-1.1.gbd444a0.x86_64
>>> kernel-default-4.14.14-1.1.geef6178.x86_64
>>> kernel-default-4.14.15-2.1.g5b3d0ce.x86_64
>>> kernel-default-4.14.15-3.1.g9e84548.x86_64
>>> kernel-default-4.14.15-4.1.g12e5c10.x86_64
>>> kernel-default-4.14.2-1.1.gb0610fc.x86_64
>>> kernel-default-4.14.3-1.1.ga731a45.x86_64
>>> kernel-default-4.14.4-1.1.gb29439c.x86_64
>>> kernel-default-4.14.7-1.1.g0598608.x86_64
>>> kernel-default-4.4.104-39.1.x86_64
>>> kernel-default-4.4.92-31.1.x86_64
>>>
>>>
>>>
>>> # rpm -ql kernel-default-4.4.92-31.1.x86_64
>>> package kernel-default-4.4.92-31.1.x86_64 is not installed
>>>
>>
>> Database consists of data and indexes. "rpm -qa" will crawl all data,
>> while "rpm -q" attempts to only check index. This implies that RPM
>> database is corrupted and index was not properly updated after package
>> was removed. You may try to run
>>
>> cd /var/lib/rpm
>> /usr/lib/rpm/rpmdb_verify Packages Name
>>
>> to see if it finds anything.
> Thanks for the suggestion. I just tired it and does not report anything.
>
>

Well, then I guess it really remains

rpm --rebuilddb && zypper clean && zypper ref


--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: /sbin/purge-kernels fails on removing non-installed kernel since rpm -qa report is wrong

Thomas Wagner
On 2018-01-29 18:01, Andrei Borzenkov wrote:

> 29.01.2018 18:50, Thomas Wagner пишет:
>> On 2018-01-28 09:52, Andrei Borzenkov wrote:
>>> 28.01.2018 11:09, Thomas Wagner пишет:
>>> cd /var/lib/rpm
>>> /usr/lib/rpm/rpmdb_verify Packages Name
>>>
>>> to see if it finds anything.
>> Thanks for the suggestion. I just tired it and does not report
>> anything.
>>
>>
>
> Well, then I guess it really remains
>
> rpm --rebuilddb && zypper clean && zypper ref
This seemed a bit harsh to me.
I found another solution:
Thankfully the rpm package of affected old kernel-default version was
still on openSUSEs update servers.
Thus, i simply re-installed the package for which the database entry was
broken. Now purge-kernels runs fine.

--
To unsubscribe, e-mail: [hidden email]
To contact the owner, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: /sbin/purge-kernels fails on removing non-installed kernel since rpm -qa report is wrong

Carlos E. R.-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Content-ID: <[hidden email]>


On Tuesday, 2018-01-30 at 10:58 +0100, Thomas Wagner wrote:

> On 2018-01-29 18:01, Andrei Borzenkov wrote:
>>  29.01.2018 18:50, Thomas Wagner пишет:
>>>  On 2018-01-28 09:52, Andrei Borzenkov wrote:
>>>>  28.01.2018 11:09, Thomas Wagner пишет:
>>>>  cd /var/lib/rpm
>>>>  /usr/lib/rpm/rpmdb_verify Packages Name
>>>>
>>>>  to see if it finds anything.
>>>  Thanks for the suggestion. I just tired it and does not report anything.
>>>
>>>
>>
>>  Well, then I guess it really remains
>>
>>  rpm --rebuilddb && zypper clean && zypper ref
> This seemed a bit harsh to me.
If the rpm database is broken, you need to repair it, or it will bite you
in another way, and the sooner the better.

There is a backup in [...] What, I can't find it. It is created by a
backup cron job, /etc/cron.daily/suse.de-backup-rpmdb, configured in
/etc/sysconfig/backup... ah, the directory is /var/adm/backup/rpmdb.

In case the database gets corrupt beyond repair, replace the active copy
with a previous copy and run rebuilddb again. If it doesn't work, try
again with an earlier copy, etc.

As the backup is done periodically, if you wait too much the last working
copy will rotate out...

- --
Cheers,
        Carlos E. R.
        (from openSUSE 42.2 x86_64 "Malachite" at Telcontar)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlpwgugACgkQtTMYHG2NR9UfCACfephzEIoCWDgnei6nSE/10kQu
owEAoIEjQJ4U0Zbcu5ux0sTqHZeIj6bk
=5XKz
-----END PGP SIGNATURE-----