WhitewaterFoundry / Fedora-Remix-for-WSL

Fedora Remix for Windows Subsystem for Linux.
Other
710 stars 51 forks source link

RPM DB_VERSION_MISMATCH #47

Closed Thorfin closed 4 years ago

Thorfin commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Run this

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

And try again.

From: https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/issues/46#issuecomment-531488924

Thorfin commented 4 years ago

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.

crramirez commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

Same issue, this worked for me.

ElvenSpellmaker commented 4 years ago

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

ACTom commented 4 years ago

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 commented 4 years ago

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

sudo rm /var/lib/rpm/.rpm.lock
whiteear commented 4 years ago

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 commented 4 years ago

yep, removing the lock file is enough.

fritzr commented 4 years ago

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 commented 4 years ago

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

crramirez commented 4 years ago

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

BlackthornYugen commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

Does anyone know why the dd commands fix this?

crramirez commented 2 years ago

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

DrLove73 commented 2 years ago

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

crramirez commented 2 years ago

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

sumojee commented 2 years ago

Below command worked for me

rm -f /var/lib/rpm/__db*

https://barchive.wordpress.com/2016/10/28/error-db5-error-30969-from-dbenv-open-bdb0091-db_version_mismatch-database-environment-version-mismatch/

macardosa commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

nirosha-r commented 1 year ago

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 commented 1 year ago

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. :)