Bug 1353159 - dnf and rpm stopped working with error 'Failed to initialize NSS library' after updating
Summary: dnf and rpm stopped working with error 'Failed to initialize NSS library' aft...
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 23
Hardware: x86_64
OS: Linux
urgent
urgent
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-06 10:19 UTC by Alex Jia
Modified: 2016-10-26 14:20 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-10-12 11:48:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Alex Jia 2016-07-06 10:19:43 UTC
Description of problem:
dnf and rpm stopped working after updating fedora23, the error like this "error: Failed to initialize NSS library", I saw some guys also met the same issue to me, I tried to solve it by google search, but I still can't find a valid solution.

Version-Release number of selected component (if applicable):

# cat /etc/redhat-release 
Fedora release 23 (Twenty Three)

# uname -r
4.2.3-300.fc23.x86_64

How reproducible:
not always

Steps to Reproduce:
1. dnf update --refresh
2. reboot


Actual results:

# rpm
error: Failed to initialize NSS library

# dnf
error: Failed to initialize NSS library
Traceback (most recent call last):
  File "/usr/bin/dnf", line 34, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.4/site-packages/dnf/__init__.py", line 31, in <module>
    import dnf.base
  File "/usr/lib/python3.4/site-packages/dnf/base.py", line 29, in <module>
    from dnf.yum import history
  File "/usr/lib/python3.4/site-packages/dnf/yum/history.py", line 30, in <module>
    import dnf.rpm.miscutils
  File "/usr/lib/python3.4/site-packages/dnf/rpm/__init__.py", line 20, in <module>
    from . import transaction
  File "/usr/lib/python3.4/site-packages/dnf/rpm/transaction.py", line 14, in <module>
    import rpm
  File "/usr/lib64/python3.4/rpm/__init__.py", line 39, in <module>
    from rpm.transaction import *
  File "/usr/lib64/python3.4/rpm/transaction.py", line 5, in <module>
    from rpm._rpm import ts as TransactionSetCore
ImportError: cannot import name 'ts'



Expected results:


Additional info:

I download rpm, rpm-python, sqlite, sqlite-libs, mod_nss, etc to release version then use rpm2cpio to unpack them and replace system binaries and libraries with these old version, but dnf and rpm still can't work.

Please help change component if it's not best one, thanks.

Comment 1 Panu Matilainen 2016-08-18 07:45:40 UTC
It's not rpm installation that is broken here but NSS, as the message is trying to say. If you have 'strace' installed then 'strace -eopen rpm' might provide clues as to what exactly is missing/broken, if not try replacing all the NSS packages with rpm2cpio. In F23 that would seem to be:
nss, nss-softokn, nss-softokn-freebl, nss-sysinit, nss-tools and nss-util

(...but the problem could be in packages NSS depends on as well)

Comment 2 Panu Matilainen 2016-10-12 11:48:09 UTC
There's not sufficient data to tell why NSS broke in the update, it could've of course been a problem in transaction but it could just as well be a NSS package split/rearrangement with missing dependencies. 

Comment #1 provides hints how to try and restore functionality but there has been no activity -> closing.

Comment 3 Bataille Jacques 2016-10-24 21:59:22 UTC
Hello, 
I just face the issue, and fortunately I know the history of it,
I installed for some test systemtap and tuned-utils-systemtap, then removed them after some test, the removal remove the sqlite-libs package.
I checked and dnf has no dependencies on sqlite-libs in repository, still it seems to need it. 
After manual extract of sqlite and sqlite-libs, copy file in /usr, everything was back OK.
Hope this can help.
Have a nice day.

Comment 4 Panu Matilainen 2016-10-25 07:01:45 UTC
You cannot remove sqlite-libs without --nodeps, among other things nss-softokn and python depend on it (sqlite is in python std library nowadays). So yes forcefully removing it will break a whole lot of things, among them NSS.

Comment 5 Bataille Jacques 2016-10-25 15:13:13 UTC
Hello,
I did not removed the sqlite-libs with any kind of 'force',
a simple 'dnf remove systemtap tuned-utils-systemtap' removed it !

Definitively there is a issue with the dependencies resolution. But can't tell you where exactly. If you want I can provide additional info you would like to receive, just let me know.
Have a nice day

fyi
# dnf repoquery --whatrequires sqlite-libs --alldeps | grep -Ei 'dnf|rpm|^sqlite-0'
sqlite-0:3.11.0-3.fc23.i686
sqlite-0:3.11.0-3.fc23.x86_64
# rpm -q dnf rpm sqlite python3
dnf-1.1.10-1.fc23.noarch
rpm-4.13.0-0.rc1.13.fc23.x86_64
sqlite-3.11.0-3.fc23.x86_64
python3-3.4.3-12.fc23.x86_64
# uname -r
4.6.7-200.fc23.x86_64
#

Comment 6 Panu Matilainen 2016-10-26 05:05:55 UTC
Sigh, for one dnf repoquery appears to be "rpm compatible" so its half useless. The original repoquery reported actual dependencies on the queried package, whereas dnf repoquery reports dependencies on that string. So now you'd need to manually loop through packages provides and query for them, but for whatever reason that doesn't work either, SIGH:

[root@sopuli ~]# dnf repoquery --whatrequires $(dnf repoquery --provides sqlite-libs)
Last metadata expiration check: 0:13:12 ago on Wed Oct 26 07:42:02 2016.
[root@sopuli ~]#

Compare that with (but it'll take a while since it needs to populate yum cache):
[root@sopuli ~]# repoquery --whatrequires sqlite-libs 2>/dev/null|wc -l
628

Anyway, for a better idea on what *really* depends on sqlite, try the following:
# dnf repoquery --whatrequires 'libsqlite3.so.0()(64bit)'

...or for installed packages depending on it:
# rpm -q --whatrequires $(rpm -q --provides sqlite-libs)|grep -v "no package"

...or...

# rpm -e --test sqlite-libs

Guess my plans for the day just changed, there seem to be bunch of dnf bugs to file...

Comment 7 Bataille Jacques 2016-10-26 11:54:53 UTC
Hello,

I notice i have a sqlite-libs of i686, when I guess should be x86_64 , is this normal ?
Looks related to Bug 1310441 ?

The removal of systemtap tuned-utils-systemtap did actually remove the 64 bit version of sqlite-libs.

[root@jbat ~]# uname -r
4.6.7-200.fc23.x86_64
[root@jbat ~]# rpm -qa | grep ^sqlite
sqlite-3.11.0-3.fc23.x86_64
sqlite-libs-3.11.0-3.fc23.i686
[root@jbat ~]#

Comment 8 Bataille Jacques 2016-10-26 14:03:45 UTC
Hello,
So far I can not tell you why i was in such situation, 

What i had before issue : (this is a assumption based on yum/dnf log analysis)
sqlite-3.11.0-3.fc23.x86_64
sqlite-libs-3.11.0-3.fc23.i686
sqlite-libs-3.11.0-3.fc23.x86_64

Did the removal : dnf remove systemtap tuned-utils-systemtap
which removed the sqlite-libs-3.11.0-3.fc23.x86_64 , probably wrongly ?

Leading to more inconsistency in packages, and the rpm 'error: Failed to initialize NSS library'

To solve the issue : 
I did 'reinstall' because I actually installed by extracting sqlite-libs in 64bit version, and so this one was not referenced correctly.

sudo dnf install sqlite-libs.i686 sqlite-libs.x86_64 sqlite.i686 sqlite.x86_64
sudo dnf reinstall sqlite-libs.i686 sqlite-libs.x86_64 sqlite.i686 sqlite.x86_64

After this I can install and deinstall systemtap with no issue, no removal of sqlite-libs anymore, which make sens of course.

Have a nice day.

Comment 9 Bataille Jacques 2016-10-26 14:20:48 UTC
Hello again and sorry,

'dnf remove ' looks like removing leaf/orphan packages, so maybe any 'dnf remove ..' would had lead to same problem ? if so, maybe that's reason why so many people are facing this issue for the moment ?

With hope this can help .. Have a nice day.


Note You need to log in before you can comment on or make changes to this bug.