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 2177776 - nodejs:10/nodejs: npm's /usr/etc/ softlink to /etc/ is preventing osbuild from creating Edge images. [rhel-8]
Summary: nodejs:10/nodejs: npm's /usr/etc/ softlink to /etc/ is preventing osbuild fro...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: nodejs
Version: 8.7
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: rc
: ---
Assignee: Jan Staněk
QA Contact: RHEL CS Apps Subsystem QE
URL:
Whiteboard:
Depends On:
Blocks: 2177781 2222285 2222287 2222288
TreeView+ depends on / blocked
 
Reported: 2023-03-13 15:39 UTC by jcastran
Modified: 2023-11-10 04:25 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2177781 (view as bug list)
Environment:
Last Closed: 2023-06-27 14:26:55 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 2176555 0 urgent CLOSED composer-cli fails to build edge images with nodejs or npm included 2023-10-17 06:22:05 UTC
Red Hat Issue Tracker RHELPLAN-151617 0 None None None 2023-03-13 15:42:30 UTC
Red Hat Knowledge Base (Solution) 7001834 0 None None None 2023-03-13 15:41:08 UTC

Description jcastran 2023-03-13 15:39:55 UTC
Description of problem:
Initially reported https://bugzilla.redhat.com/show_bug.cgi?id=2176555 against osbuild, the easiest method of resolving this issue is if we can remove the /usr/etc/npmrc softlink in npm and just use /etc/npmrc.

If we can do that, then osbuild will not have to workaround this single package. This is the only package we have found so far that has any content in /usr/etc/

# rpm -qlv npm | grep etc/npmrc
-rw-r--r--    1 root    root                       18 Feb 25  2021 /etc/npmrc
lrwxrwxrwx    1 root    root                       10 Feb 25  2021 /usr/etc/npmrc -> /etc/npmrc

Version-Release number of selected component (if applicable):
RHEL 8 and RHEL 9 npm


Additional info:

Comment 1 Zuzana Svetlikova 2023-03-14 12:04:26 UTC
Hi, which versions of nodejs does this affect and how urgent are the fixes?

Comment 2 jcastran 2023-03-14 17:20:44 UTC
Currently osbuild can not switch streams so this only affects the default stream of 10. Customers building edge systems fail if they include npm or nodejs.

Comment 3 Zuzana Svetlikova 2023-03-15 12:06:21 UTC
I am sorry to inform you that v10 doesn't receive any updates or fixes anymore. It is the default version, because it was the first version introduced in RHEL8, but it's been dead for years. I can bring it up with our PM, but I don't think anything will be done about v10.

Please let me know if you need a fix included in newer releases, currently supported streams are v14, v16 and v18 with v14 going EOL very soon.

Comment 7 Honza Horak 2023-03-24 14:56:28 UTC
The symlink in question was added by the following Fedora commit: https://src.fedoraproject.org/rpms/nodejs18/c/2526ca953f7d2de94348a77127a85b39a4a8407d

Comment 8 Honza Horak 2023-03-28 16:07:59 UTC
Reported RFE for rpminspect that could warn about `/usr/etc` content early on: https://github.com/rpminspect/rpminspect/issues/1133

Comment 9 Honza Horak 2023-03-28 16:10:00 UTC
I just found that removing /usr/etc/npmrc does not work, it would make the npmrc not work entirely because the code looks primarily to ${prefix}/etc/npmrc:

#> echo 'loglevel="silly"' >>/etc/npmrc
#> npm install express 2>&1 | grep loadBundles
npm timing reify:loadBundles Completed in 0ms
#> unlink /usr/etc/npmrc 
#> npm install express 2>&1 | grep loadBundles
<nothing>

So, we need not only remove /usr/etc/npmrc, but also fix the code to look directly to /etc/npmrc. This might ideally be an upstream fix, that could let users to specify npmrc location somewhere else than in ${prefix}/etc/npmrc during the build.

Comment 12 Jan Staněk 2023-04-25 13:05:02 UTC
I did some digging in the sources of npm on what we can do with the expected location of the file, and I see some options.

npm loads up to 4 (!) configuration files in addition to the "hardcoded" defaults: builtin, project, user, and global npmrc; the global is the one we have trouble with. The location of this file is determined by the "globalconfig" config value, which defaults to "$(prefix)/etc/npmrc". Since it is a configuration value, it can be set via CLI, earlier configuration files or environment variables. In this case, we can (and probably should) utilize the builtin npmrc – it is intended for distribution-level configuration and effectively overrides the "hardcoded" defaults (`npm config list -l` even shows the new values as the defaults). The builtin npmrc should be located at "<npm module>/npmrc" (i.e. /usr/lib/node_modules/npm/npmrc).

So for future packaging, I suggest using this file for setting the globalconfig path; I'll start submitting patches to Fedora streams once I wrap my head around the new structure. However, this can take some time to propagate to (any) RHEL.

For the osbuilder, it is possible to use environment variables to point npm to the correct location? According to docs (from the nodejs:10 stream), `npm_config_globalconfig=/etc/npmrc` environment variable should provide the same effect and allow us to remove /usr/etc/npmr symling during build. (Note: NPM_CONFIG_GLOBALCONFIG name should also work, but apparently can be internally overriden by the lowercase version; better use the lowercase to be safe.)

Comment 13 Jan Staněk 2023-04-25 13:08:28 UTC
(In reply to Jan Staněk from comment #12) (Accidentally submitted the change too soon.)

John, is the environment variable approach something you can use for the image build? Or do you need any change to happen on the packaging side?

Comment 14 Jan Staněk 2023-04-27 11:35:32 UTC
The Fedora PR that does away with the symlink: https://src.fedoraproject.org/rpms/nodejs20/pull-request/1. Similar PRs will be opened against other NodeJS streams (both Fedora and EL) once this one is reviewed and merged.

Comment 16 Red Hat Bugzilla 2023-11-10 04:25:14 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


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