Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2118971

Summary: Can't Initialize NSS database
Product: Red Hat Enterprise Linux 8 Reporter: LiLiang <liali>
Component: libreswanAssignee: Daiki Ueno <dueno>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.7Keywords: Regression
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-31 02:30:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description LiLiang 2022-08-17 09:07:42 UTC
Description of problem:
on recent RHEL-8.7 distro, Initialize NSS database can't success.
command "ipsec initnss --nssdir /etc/ipsec.d" can't complete.


Version-Release number of selected component (if applicable):
RHEL-8.7.0-20220815.1
kernel-4.18.0-416.el8.x86_64

  ldns-1.7.0-21.el8.x86_64                      libreswan-4.5-1.el8.x86_64             nspr-4.34.0-3.el8_6.x86_64           nss-3.79.0-9.el8_6.x86_64           nss-softokn-3.79.0-9.el8_6.x86_64     
  nss-softokn-freebl-3.79.0-9.el8_6.x86_64      nss-sysinit-3.79.0-9.el8_6.x86_64      nss-tools-3.79.0-9.el8_6.x86_64      nss-util-3.79.0-9.el8_6.x86_64     

How reproducible:
always

Steps to Reproduce:
1.install distro RHEL-8.7.0-20220815.1
2.yum install -y libreswan
3.ipsec initnss --nssdir /etc/ipsec.d

Actual results:
command "ipsec initnss --nssdir /etc/ipsec.d" can't complete

# ipsec initnss --nssdir /etc/ipsec.d
Initializing NSS database

^C

Expected results:
initialize nss database success using command "ipsec initnss --nssdir /etc/ipsec.d" 

Additional info:
"systemctl start ipsec" also failed with error:

# systemctl start ipsec
Job for ipsec.service failed because a timeout was exceeded.
See "systemctl status ipsec.service" and "journalctl -xe" for details.

# journalctl -u ipsec -f
-- Logs begin at Wed 2022-08-17 04:47:40 EDT. --
Aug 17 05:04:50 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: Starting Internet Key Exchange (IKE) Protocol Daemon for IPsec...
Aug 17 05:04:51 dell-per750-13.rhts.eng.pek2.redhat.com ipsec[19970]: Initializing NSS database
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: ipsec.service: start-pre operation timed out. Terminating.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com ipsec[20009]: nflog ipsec capture disabled
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: ipsec.service: Failed with result 'timeout'.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: Failed to start Internet Key Exchange (IKE) Protocol Daemon for IPsec.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: ipsec.service: Service RestartSec=100ms expired, scheduling restart.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: ipsec.service: Scheduled restart job, restart counter is at 1.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: Stopped Internet Key Exchange (IKE) Protocol Daemon for IPsec.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: Starting Internet Key Exchange (IKE) Protocol Daemon for IPsec...
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com ipsec[20280]: Initializing NSS database

# systemctl status ipsec.service
● ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec
   Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled; vendor preset: disabled)
   Active: activating (start-pre) since Wed 2022-08-17 05:06:21 EDT; 40s ago
     Docs: man:ipsec(8)
           man:pluto(8)
           man:ipsec.conf(5)
  Process: 20031 ExecStopPost=/usr/sbin/ipsec --stopnflog (code=exited, status=0/SUCCESS)
  Process: 20027 ExecStopPost=/bin/bash -c if test "$EXIT_STATUS" != "12"; then /sbin/ip xfrm policy flush; /sbin/ip xfrm state flush; fi (code=exited, status=0/SUCCESS)
  Process: 20009 ExecStartPre=/usr/sbin/ipsec --checknflog (code=exited, status=0/SUCCESS)
  Process: 20041 ExecStartPre=/usr/libexec/ipsec/_stackmanager start (code=exited, status=0/SUCCESS)
  Process: 20039 ExecStartPre=/usr/libexec/ipsec/addconn --config /etc/ipsec.conf --checkconfig (code=exited, status=0/SUCCESS)
Cntrl PID: 20280 (ipsec)
    Tasks: 2 (limit: 818791)
   Memory: 1.8M
   CGroup: /system.slice/ipsec.service
           ├─20280 /usr/bin/sh /usr/sbin/ipsec --checknss
           └─20281 certutil -N -d sql:/etc/ipsec.d --empty-password

Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: Starting Internet Key Exchange (IKE) Protocol Daemon for IPsec...
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com ipsec[20280]: Initializing NSS database

# journalctl -xe
-- Unit systemd-tmpfiles-clean.service has finished starting up.
-- 
-- The start-up result is done.
Aug 17 05:04:50 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: Starting Internet Key Exchange (IKE) Protocol Daemon for IPsec...
-- Subject: Unit ipsec.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- Unit ipsec.service has begun starting up.
Aug 17 05:04:51 dell-per750-13.rhts.eng.pek2.redhat.com kernel: IPv4 over IPsec tunneling driver
Aug 17 05:04:51 dell-per750-13.rhts.eng.pek2.redhat.com systemd-udevd[19959]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Aug 17 05:04:51 dell-per750-13.rhts.eng.pek2.redhat.com NetworkManager[1955]: <info>  [1660727091.0628] manager: (ip_vti0): new Generic device (/org/freedesktop/NetworkManager/Devices/10)
Aug 17 05:04:51 dell-per750-13.rhts.eng.pek2.redhat.com kernel: IPsec XFRM device driver
Aug 17 05:04:51 dell-per750-13.rhts.eng.pek2.redhat.com ipsec[19970]: Initializing NSS database
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: ipsec.service: start-pre operation timed out. Terminating.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com ipsec[20009]: nflog ipsec capture disabled
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: ipsec.service: Failed with result 'timeout'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- The unit ipsec.service has entered the 'failed' state with result 'timeout'.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: Failed to start Internet Key Exchange (IKE) Protocol Daemon for IPsec.
-- Subject: Unit ipsec.service has failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- Unit ipsec.service has failed.
-- 
-- The result is failed.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: ipsec.service: Service RestartSec=100ms expired, scheduling restart.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: ipsec.service: Scheduled restart job, restart counter is at 1.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- Automatic restarting of the unit ipsec.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: Stopped Internet Key Exchange (IKE) Protocol Daemon for IPsec.
-- Subject: Unit ipsec.service has finished shutting down
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- Unit ipsec.service has finished shutting down.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com systemd[1]: Starting Internet Key Exchange (IKE) Protocol Daemon for IPsec...
-- Subject: Unit ipsec.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- Unit ipsec.service has begun starting up.
Aug 17 05:06:21 dell-per750-13.rhts.eng.pek2.redhat.com ipsec[20280]: Initializing NSS database

Comment 1 LiLiang 2022-08-17 09:11:01 UTC
This looks like a regression.

It can't be reproduce using below software versions:

RHEL-8.7.0-20220808.1
4.18.0-415.el8.x86_64

ldns-1.7.0-21.el8.x86_64                      libreswan-4.5-1.el8.x86_64             nspr-4.34.0-3.el8_6.x86_64           nss-3.79.0-8.el8_6.x86_64           nss-softokn-3.79.0-8.el8_6.x86_64     
  nss-softokn-freebl-3.79.0-8.el8_6.x86_64      nss-sysinit-3.79.0-8.el8_6.x86_64      nss-tools-3.79.0-8.el8_6.x86_64      nss-util-3.79.0-8.el8_6.x86_64