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

RPM DB_VERSION_MISMATCH #47

Closed
Thorfin opened this issue Sep 16, 2019 · 31 comments
Closed

RPM DB_VERSION_MISMATCH #47

Thorfin opened this issue Sep 16, 2019 · 31 comments

Comments

@Thorfin
Copy link

Thorfin commented Sep 16, 2019

Describe the bug

Run Yum update, or try to install a package using yum:

RPM: error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch
RPM: error: cannot open Packages index using db5 - (-30969)
RPM: error: cannot open Packages database in /var/lib/rpm
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Could not run transaction.

To Reproduce
Steps to reproduce the behavior:

  1. Reboot
  2. yum update
  3. See error

Expected behavior
Updates completed succesfully

Additional context
I have deleted and started from scratch the whole WSL environment and yum works for one update cycle, then after an update and reboot I get the same error above.

Basic Troubleshooting Checklist

[x] I have searched Google for the error message.
[x] I have checked official WSL troubleshooting documentation: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#confirm-wsl-is-enabled.
[x] I have searched the official Microsoft WSL issues page: https://github.com/Microsoft/WSL/issues.
[x] I have searched the WLinux issues page: https://github.com/WhitewaterFoundry/WLinux/issues.
[x] I have reset WLinux: Settings->Apps->Apps & features->WLinux->Advanced Options->Reset.
[x] I have disabled and re-enabled WSL in Windows Features.
[x] I have run Windows 10 updates and restarted.

Windows Build

OS Version: 10.0.18362 N/A Build 18362

copy paste:

[root@SAMPC ~]# yum update
whitewaterfoundry_wslu 256 B/s | 833 B 00:03
Dependencies resolved.

Package Architecture Version Repository Size

Upgrading:
dnf noarch 4.2.8-2.fc30 updates 405 k
dnf-data noarch 4.2.8-2.fc30 updates 45 k
dnf-yum noarch 4.2.8-2.fc30 updates 42 k
fontconfig x86_64 2.13.1-9.fc30 updates 253 k
jbig2dec-libs x86_64 0.16-1.fc30 updates 69 k
libdnf x86_64 0.35.2-3.fc30 updates 589 k
libxcrypt x86_64 4.4.9-1.fc30 updates 123 k
libxcrypt-compat x86_64 4.4.9-1.fc30 updates 96 k
polkit-libs x86_64 0.116-2.fc30 updates 64 k
python3-dnf noarch 4.2.8-2.fc30 updates 413 k
python3-hawkey x86_64 0.35.2-3.fc30 updates 93 k
python3-libdnf x86_64 0.35.2-3.fc30 updates 708 k
vim-common x86_64 2:8.1.1991-2.fc30 updates 6.7 M
vim-enhanced x86_64 2:8.1.1991-2.fc30 updates 1.4 M
vim-filesystem noarch 2:8.1.1991-2.fc30 updates 28 k
vim-minimal x86_64 2:8.1.1991-2.fc30 updates 619 k

Transaction Summary

Upgrade 16 Packages

Total download size: 12 M
Is this ok [y/N]: y
Downloading Packages:
(1/16): dnf-yum-4.2.8-2.fc30.noarch.rpm 86 kB/s | 42 kB 00:00
(2/16): dnf-data-4.2.8-2.fc30.noarch.rpm 79 kB/s | 45 kB 00:00
(3/16): fontconfig-2.13.1-9.fc30.x86_64.rpm 288 kB/s | 253 kB 00:00
(4/16): jbig2dec-libs-0.16-1.fc30.x86_64.rpm 77 kB/s | 69 kB 00:00
(5/16): dnf-4.2.8-2.fc30.noarch.rpm 259 kB/s | 405 kB 00:01
(6/16): libxcrypt-compat-4.4.9-1.fc30.x86_64.rpm 265 kB/s | 96 kB 00:00
(7/16): polkit-libs-0.116-2.fc30.x86_64.rpm 269 kB/s | 64 kB 00:00
(8/16): libdnf-0.35.2-3.fc30.x86_64.rpm 609 kB/s | 589 kB 00:00
(9/16): libxcrypt-4.4.9-1.fc30.x86_64.rpm 130 kB/s | 123 kB 00:00
(10/16): python3-hawkey-0.35.2-3.fc30.x86_64.rpm 530 kB/s | 93 kB 00:00
(11/16): python3-dnf-4.2.8-2.fc30.noarch.rpm 232 kB/s | 413 kB 00:01
(12/16): python3-libdnf-0.35.2-3.fc30.x86_64.rpm 195 kB/s | 708 kB 00:03
(13/16): vim-filesystem-8.1.1991-2.fc30.noarch.rpm 272 kB/s | 28 kB 00:00
(14/16): vim-minimal-8.1.1991-2.fc30.x86_64.rpm 393 kB/s | 619 kB 00:01
(15/16): vim-enhanced-8.1.1991-2.fc30.x86_64.rpm 334 kB/s | 1.4 MB 00:04
(16/16): vim-common-8.1.1991-2.fc30.x86_64.rpm 612 kB/s | 6.7 MB 00:11

Total 809 kB/s | 12 MB 00:14
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
RPM: error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch
RPM: error: cannot open Packages index using db5 - (-30969)
RPM: error: cannot open Packages database in /var/lib/rpm
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Could not run transaction.
[root@SAMPC ~]#

@Thorfin
Copy link
Author

Thorfin commented Sep 16, 2019

I've tried "normal fixes" for this issue but they don't fix it in this case, I think it might be to do with the WSL element?

@crramirez
Copy link
Contributor

Run this

sudo dnf upgrade --refresh rpm glibc
sudo rm /var/lib/rpm/.rpm.lock
sudo dnf upgrade dnf

And try again.

From: #46 (comment)

@Thorfin
Copy link
Author

Thorfin commented Sep 16, 2019

The above just hung for me and didn't do anything.

I found https://github.com/WhitewaterFoundry/Pengwin-Enterprise/issues/20 and followed:

sudo -s
cd /var/lib/rpm
rpm --rebuilddb
dd if=/dev/zero of=__db.001 bs=1M count=1
dd if=/dev/zero of=__db.002 bs=1M count=1
dd if=/dev/zero of=__db.003 bs=1M count=1
rpm -qa rpm
yum install vim

Which seems to have fixed the issue now.

Thankyou for your help.

@Thorfin Thorfin closed this as completed Sep 16, 2019
@crramirez
Copy link
Contributor

crramirez commented Oct 13, 2019

A fix was uploaded to the store with the version 1.30.5.0 if someone can check if the error is gone away.

@PhilBarila
Copy link

I can't comment on the store version, but @Thorfin's resolution worked for me in 1.30.1.0 that I downloaded from here.

@cbowlesatx
Copy link

sudo dnf upgrade --refresh rpm glibc
sudo rm /var/lib/rpm/.rpm.lock
sudo dnf upgrade dnf

Same issue, this worked for me.

@ElvenSpellmaker
Copy link

@crramirez's solution worked for me too, even if the two dnf commands said "nothing to do" haha.

@ACTom
Copy link

ACTom commented Jan 6, 2020

The above just hung for me and didn't do anything.

I found https://github.com/WhitewaterFoundry/Pengwin-Enterprise/issues/20 and followed:

sudo -s
cd /var/lib/rpm
rpm --rebuilddb
dd if=/dev/zero of=__db.001 bs=1M count=1
dd if=/dev/zero of=__db.002 bs=1M count=1
dd if=/dev/zero of=__db.003 bs=1M count=1
rpm -qa rpm
yum install vim

Which seems to have fixed the issue now.

Thankyou for your help.

cd /var/lib/rpm
dd if=/dev/zero of=__db.001 bs=1M count=1
dd if=/dev/zero of=__db.002 bs=1M count=1
dd if=/dev/zero of=__db.003 bs=1M count=1

this worked for me.

@christianfosli
Copy link

In my case it was enough to simply delete the lock file

sudo rm /var/lib/rpm/.rpm.lock

@whiteear
Copy link

whiteear commented Mar 4, 2020

simply, this worked in my case [windows WSL fedora 31]

In my case it was enough to simply delete the lock file

sudo rm /var/lib/rpm/.rpm.lock

@WSLUser
Copy link
Contributor

WSLUser commented Mar 13, 2020

yep, removing the lock file is enough.

@fritzr
Copy link

fritzr commented Apr 17, 2020

After installing many packages just fine this error randomly occurred when trying to dnf install cmake ninja-build. After removing the lock file and cleaning packages with sudo dnf clean packages I was able to successfully install the packages.

@tqmillerusa
Copy link

Just removing the lock file worked for me, as well.

@crramirez
Copy link
Contributor

Try the new script upgrade.sh and see if it fixes it as well

@BlackthornYugen
Copy link

The above just hung for me and didn't do anything.
I found https://github.com/WhitewaterFoundry/Pengwin-Enterprise/issues/20 and followed:
sudo -s
cd /var/lib/rpm
rpm --rebuilddb
dd if=/dev/zero of=__db.001 bs=1M count=1
dd if=/dev/zero of=__db.002 bs=1M count=1
dd if=/dev/zero of=__db.003 bs=1M count=1
rpm -qa rpm
yum install vim
Which seems to have fixed the issue now.
Thankyou for your help.

cd /var/lib/rpm
dd if=/dev/zero of=__db.001 bs=1M count=1
dd if=/dev/zero of=__db.002 bs=1M count=1
dd if=/dev/zero of=__db.003 bs=1M count=1

this worked for me.

I tried this and it didn't fix my issue:

sudo dnf upgrade --refresh rpm glibc
sudo rm /var/lib/rpm/.rpm.lock
sudo dnf upgrade dnf

I'm not a fan of sudo -s so I tried this and it worked:

cd /var/lib/rpm/
sudo rpm --rebuilddb
sudo rpm -qa rpm

I didn't need to use dd to zero out __db.xxx files. I would have tried that next if I still had issues.

@Miriam-CID
Copy link

Miriam-CID commented Mar 30, 2021

In my case, it was useful for installing libcanberrra in RHEL8

cd /var/lib/rpm
rpm --rebuilddb
rpm -qa rpm

yum install -y libcanberra-gtk*

Result:
Installed:
libcanberra-gtk2-0.30-16.el8.x86_64
Complete!

PROBLEM BEFORE
yum install -y libcanberra-gtk

Result:
Running transaction
RPM: error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch
RPM: error: cannot open Packages index using db5 - (-30969)
RPM: error: cannot open Packages database in /var/lib/rpm

@crramirez
Copy link
Contributor

The above just hung for me and didn't do anything.
I found https://github.com/WhitewaterFoundry/Pengwin-Enterprise/issues/20 and followed:
sudo -s
cd /var/lib/rpm
rpm --rebuilddb
dd if=/dev/zero of=__db.001 bs=1M count=1
dd if=/dev/zero of=__db.002 bs=1M count=1
dd if=/dev/zero of=__db.003 bs=1M count=1
rpm -qa rpm
yum install vim
Which seems to have fixed the issue now.
Thankyou for your help.

cd /var/lib/rpm
dd if=/dev/zero of=__db.001 bs=1M count=1
dd if=/dev/zero of=__db.002 bs=1M count=1
dd if=/dev/zero of=__db.003 bs=1M count=1

this worked for me.

I tried this and it didn't fix my issue:

sudo dnf upgrade --refresh rpm glibc
sudo rm /var/lib/rpm/.rpm.lock
sudo dnf upgrade dnf

I'm not a fan of sudo -s so I tried this and it worked:

cd /var/lib/rpm/
sudo rpm --rebuilddb
sudo rpm -qa rpm

I didn't need to use dd to zero out __db.xxx files. I would have tried that next if I still had issues.

Hello @BlackthornYugen

Are you using Fedora Remix 33? or 32?

Regards

@BlackthornYugen
Copy link

Hello @BlackthornYugen

Are you using Fedora Remix 33? or 32?

Regards

@crramirez oops... I'm running Centos 8 Stream. This page turned up in a google search for my issue. I didn't even notice it was a Fedora for WSL issue.

==> /etc/os-release <==
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"

@ggress
Copy link

ggress commented Apr 4, 2021

rpm -qa rpm

In my case, it was useful for installing libcanberrra in RHEL8

cd /var/lib/rpm
rpm --rebuilddb
rpm -qa rpm

yum install -y libcanberra-gtk*

Result:
Installed:
libcanberra-gtk2-0.30-16.el8.x86_64
Complete!

PROBLEM BEFORE
yum install -y libcanberra-gtk

Result:
Running transaction
RPM: error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch
RPM: error: cannot open Packages index using db5 - (-30969)
RPM: error: cannot open Packages database in /var/lib/rpm

works for me !!! RHEL8

@crramirez
Copy link
Contributor

Hello @BlackthornYugen
Are you using Fedora Remix 33? or 32?
Regards

@crramirez oops... I'm running Centos 8 Stream. This page turned up in a google search for my issue. I didn't even notice it was a Fedora for WSL issue.

==> /etc/os-release <==
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"

Good to know that there is a solution for this for CentOS Stream and RHEL 8

@MohitR1999
Copy link

The above just hung for me and didn't do anything.
I found https://github.com/WhitewaterFoundry/Pengwin-Enterprise/issues/20 and followed:
sudo -s
cd /var/lib/rpm
rpm --rebuilddb
dd if=/dev/zero of=__db.001 bs=1M count=1
dd if=/dev/zero of=__db.002 bs=1M count=1
dd if=/dev/zero of=__db.003 bs=1M count=1
rpm -qa rpm
yum install vim
Which seems to have fixed the issue now.
Thankyou for your help.

cd /var/lib/rpm
dd if=/dev/zero of=__db.001 bs=1M count=1
dd if=/dev/zero of=__db.002 bs=1M count=1
dd if=/dev/zero of=__db.003 bs=1M count=1

this worked for me.

This worked for me as well, thanks

@charterchap
Copy link

Does anyone know why the dd commands fix this?

@crramirez
Copy link
Contributor

Yes, because it fails when trying to grow the files. The dd command creates files with 1MB with enough space to fill.

@DrLove73
Copy link

DrLove73 commented Apr 7, 2022

I just had this problem and rm -f /var/lib/rpm/__db* fixed it at once.

@crramirez
Copy link
Contributor

@DrLove73 excellent. Also, sudo rm /var/lib/rpm/.rpm.lock helps.

@sumojee
Copy link

sumojee commented May 19, 2022

@macardosa
Copy link

I just had this problem and rm -f /var/lib/rpm/__db* fixed it at once.

Thanks for posting. This worked for me

@cxy-uestc
Copy link

What the real reason for the problem 'dbenv version mismatch'? And How to fix it in the source code? such as rpm or librpm

@cgome2
Copy link

cgome2 commented Aug 1, 2022

I just needed to rebuild de database and it worked:
cd /var/lib/rpm
rpm --rebuilddb

@nirosha-r
Copy link

Run this

sudo dnf upgrade --refresh rpm glibc
sudo rm /var/lib/rpm/.rpm.lock
sudo dnf upgrade dnf

And try again.

From: #46 (comment)

This worked for me

@ganesh-at-wiw
Copy link

Run this

sudo dnf upgrade --refresh rpm glibc
sudo rm /var/lib/rpm/.rpm.lock
sudo dnf upgrade dnf

And try again.

From: #46 (comment)

You made my day. :)

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

No branches or pull requests