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 1702735

Summary: enable SQLite support in lshw
Product: Red Hat Enterprise Linux 8 Reporter: Jeff Bastian <jbastian>
Component: lshwAssignee: lijiang
Status: CLOSED ERRATA QA Contact: Jeff Bastian <jbastian>
Severity: low Docs Contact:
Priority: low    
Version: 8.0CC: ruyang
Target Milestone: rcFlags: ruyang: mirror+
Target Release: 8.1   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: lshw-B.02.18-20.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1727393 (view as bug list) Environment:
Last Closed: 2019-11-05 22:12:50 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:
Bug Depends On:    
Bug Blocks: 1690227, 1727393    

Description Jeff Bastian 2019-04-24 15:33:28 UTC
Description of problem:
RHEL7 lshw supported dumping the output to a SQLite database, but this is disabled in the RHEL8 version.  Please enable SQLite support when building lshw.

Version-Release number of selected component (if applicable):
lshw-B.02.18-16.el8

How reproducible:
always

Steps to Reproduce:
1. lshw -dump lshw.sql

Actual results:
lshw prints the online help and exits

Expected results:
The output is saved to a SQLite database named lshw.sql

Additional info:

Comment 5 Jeff Bastian 2019-07-05 20:30:23 UTC
Verified on RHEL-8.1.0-Beta-1.1, although a new bug was found: the -dump option requires a full path to the file.  I'll open a new BZ for this.

[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.1 Beta (Ootpa)

[root@localhost ~]# rpm -q lshw
lshw-B.02.18-21.el8.x86_64

[root@localhost ~]# uname -r
4.18.0-107.el8.x86_64

[root@localhost ~]# lshw -dump lshw.sql >/dev/null

[root@localhost ~]# file lshw.sql
lshw.sql: cannot open `lshw.sql' (No such file or directory)

### That's odd: why didn't it create the file?

[root@localhost ~]# strace -e trace=file -o lshw.trace lshw -dump lshw.sql >/dev/null

[root@localhost ~]# grep lshw.sql lshw.trace
execve("/usr/sbin/lshw", ["lshw", "-dump", "lshw.sql"], 0x7ffdf2697a60 /* 42 vars */) = 0
lstat("lshw.sql", 0x7ffe34364af0)       = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/sys/bus/pnp/devices/lshw.sql", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/sys/bus/pnp/devices/lshw.sql", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

### Why is it trying to save the file to /sys/bus/pnp/devices?
### Try again with a full path:

[root@localhost ~]# lshw -dump /root/lshw.sql >/dev/null

[root@localhost ~]# file lshw.sql
lshw.sql: SQLite 3.x database, last written using SQLite version 3026000

[root@localhost ~]# sqlite3 lshw.sql .dump | head
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE META(key TEXT PRIMARY KEY COLLATE NOCASE, value BLOB);
INSERT INTO META VALUES('schema',1.0);
INSERT INTO META VALUES('application','org.ezix.lshw');
INSERT INTO META VALUES('creator','lshw/B.012.18');
INSERT INTO META VALUES('OS','Red Hat Enterprise Linux release 8.1 Beta (Ootpa) ; Linux 4.18.0-107.el8.x86_64 ; glibc 2.28');
INSERT INTO META VALUES('platform','x86_64');
CREATE TABLE nodes(path TEXT PRIMARY KEY, id TEXT NOT NULL COLLATE NOCASE, parent TEXT COLLATE NOCASE, class TEXT NOT NULL COLLATE NOCASE, enabled BOOL, claimed BOOL, description TEXT, vendor TEXT, product TEXT, version TEXT, serial TEXT, businfo TEXT, physid TEXT, slot TEXT, size INTEGER, capacity INTEGER, clock INTEGER, width INTEGER, dev TEXT);
INSERT INTO nodes VALUES('/','localhost.localdomain',NULL,'system',1,1,'Rack Mount Chassis','Dell Inc.','PowerEdge R730 (SKU=NotProvided;ModelName=PowerEdge R730)',NULL,'J6H8GB2',NULL,NULL,NULL,NULL,NULL,NULL,64,NULL);

Comment 6 Jeff Bastian 2019-07-05 20:40:15 UTC
See bug 1727393 for the problem with relative vs absolute paths for the dump file.

Comment 8 errata-xmlrpc 2019-11-05 22:12:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:3549