Hide Forgot
Description of problem: getpwnam call failing on 32 bit for NIS user Version-Release number of selected component (if applicable): glibc-2.28-72.el8_1.1.x86_64 RHEL 8 How reproducible: Always Steps to Reproduce: 1. #define _POSIX_SOURCE #include <pwd.h> #include <stdio.h> int main() { char *username = "nis1"; struct passwd *p; printf("in getpwnam(\"%s\")\n", username); p = getpwnam((const char *)username); if( p ) { printf("getpwnam() returned the following info for user %s:\n", username); printf(" pw_name : %s\n", p->pw_name); printf(" pw_uid : %d\n", (int) p->pw_uid); printf(" pw_gid : %d\n", (int) p->pw_gid); printf(" pw_dir : %s\n", p->pw_dir); printf(" pw_shell : %s\n", p->pw_shell); } else { printf("out getpwnam() = IDCMD_FAILURE\n"); } return 0; } 2. gcc -m32 hi.c -o a.ou 3. Actual results: ./a.ou in getpwnam("nis1") out getpwnam() = IDCMD_FAILURE Expected results: ./a.ou in getpwnam("nis1") getpwnam() returned the following info for user nis1: pw_name : nis1 pw_uid : 10001 pw_gid : 10001 pw_dir : /home/nis1 pw_shell : /bin/bash Additional info: Please note this works well when compiled without -m32
Please make sure that the customer has actually installed nss_nis.i686.
Customer has nss_nis-3.0-8.el8.i686 installed, Getting same error for LDAP user as well, what is being missed here? # gcc hi.c -o a.out ./a.out in getpwnam("testuser") getpwnam() returned the following info for user testuser: pw_name : testuser pw_uid : 1100 pw_gid : 1100 pw_dir : /home/testuser pw_shell : /bin/bash [root ~]# gcc -m32 hi.c -o a.out [root ~]# ./a.out in getpwnam("testuser") out getpwnam() = IDCMD_FAILURE
To avoid recurring issues with missing nss_nis.i686 packages, it nss_nis.x86_64 should have conditional dependency on the i686 package, like this: %ifarch x86_64 Recommends: (nss_nis(x86-32) if glibc(x86-32)) %endif This will also help with in-place upgrades from Red Hat Enterprise Linux 7. It's not a perfect solution. I brought this up on the Fedora devel list: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/3HZSIWSPEEC6KL6OBWSIPPYHU3CUL5YK/
Apologies, I made a mistake and I overlooked, that Florian's solution doesn't work. It looks like DNF skip self-dependency in field Recommends and doesn't support installation x86_64 together with i686. I tried to force it to install using Requires instead of Recommends but it leads to errors.
(In reply to Filip Januš from comment #9) > Apologies, I made a mistake and I overlooked, that Florian's solution > doesn't work. It looks like DNF skip self-dependency in field Recommends and > doesn't support installation x86_64 together with i686. I tried to force it > to install using Requires instead of Recommends but it leads to errors. Sorry, what exactly does not work? We are using something very similar for nss_db, and it works for us.
from your glibc spec: %ifarch x86_64 # Automatically install the 32-bit variant if the 64-bit variant has # been installed. This covers the case when glibc.i686 is installed # before nss_db.x86_64. (See above for the other ordering.) Recommends: (nss_db(x86-32) if glibc(x86-32)) %endif if I perform following steps, nss_db.i686 won't be installed: 1. dnf install glibc.i686 2. for sure dnf install glibc-devel.i686 3. # rpm -qa |grep glibc glibc-headers-2.30-11.fc31.x86_64 glibc-all-langpacks-2.30-11.fc31.x86_64 glibc-devel-2.30-11.fc31.i686 glibc-common-2.30-11.fc31.x86_64 glibc-2.30-11.fc31.i686 glibc-2.30-11.fc31.x86_64 glibc-devel-2.30-11.fc31.x86_64 4.dnf install nss_db Dependencies resolved. =================================================================================================================================================================== Package Architecture Version Repository Size =================================================================================================================================================================== Installing: nss_db x86_64 2.30-11.fc31 updates 62 k Transaction Summary =================================================================================================================================================================== Install 1 Package From my point of view here is missing nss_db.i686 as weak dependency. Maybe I have overlooked some important thing, but in my opinion, this construction "Recommends: (nss_db(x86-32) if glibc(x86-32))" is satisfied with glibc.i686 package.
(In reply to Filip Januš from comment #12) > from your glibc spec: > %ifarch x86_64 > # Automatically install the 32-bit variant if the 64-bit variant has > # been installed. This covers the case when glibc.i686 is installed > # before nss_db.x86_64. (See above for the other ordering.) > Recommends: (nss_db(x86-32) if glibc(x86-32)) > %endif > > if I perform following steps, nss_db.i686 won't be installed: Where does the repodata come from? An old createrepo program (from Red Hat Enterprise Linux 7) does not process Recommends: dependencies at all, so they are missing from the repodata, and DNF cannot act on them. This is consistent with the behavior you observe. If you regenerate the repodata with the appropriate createrepo version, I'm sure this will work.
Hi Florian, there was probably a misunderstanding, I tried to describe behavior on Fedora 31, not on RHEL7, but as you recommended, I tried to create my own repo by using the latest version of createrepo tool. But it behaves in the same way as I described above. So I made a build of nss_nis in copr[1] with simple recommendation: %ifarch x86_64 Recommends: nss_nis(x86-32) %endif then from built rpms I created own repo[1] and add, enabled in dnf. But the result was the same as before, the weak dependency is missing. [root@ci-vm-10-0-138-150 ~]# dnf install nss_nis Beaker Client - Fedora30 88 kB/s | 11 kB 00:00 Beaker harness 505 kB/s | 133 kB 00:00 Fedora Modular 31 - x86_64 1.1 MB/s | 5.2 MB 00:04 Fedora Modular 31 - x86_64 - Updates 913 kB/s | 4.1 MB 00:04 Fedora 31 - x86_64 - Updates 922 kB/s | 25 MB 00:27 Fedora 31 - x86_64 10 MB/s | 71 MB 00:06 created by dnf config-manager from https://fjanus.fedorapeople.org/testrepo/ 4.0 kB/s | 1.4 kB 00:00 QA Tools Incubator 211 kB/s | 407 kB 00:01 QA Tools Incubator Testing 146 kB/s | 122 kB 00:00 Dependencies resolved. =============================================================================================================================================================== Package Architecture Version Repository Size =============================================================================================================================================================== Installing: nss_nis x86_64 3.1-5.fc31 fjanus.fedorapeople.org_testrepo_ 42 k Transaction Summary =============================================================================================================================================================== Install 1 Package Total download size: 42 k Installed size: 82 k Is this ok [y/N]: But I tried to change section Recommands to some other package and it works[3]. %ifarch x86_64 Recommends: pg_repack %endif root@ci-vm-10-0-138-45 ~]# dnf install nss_nis Last metadata expiration check: 0:00:07 ago on Mon 18 May 2020 08:41:19 AM EDT. Dependencies resolved. =============================================================================================================================================================== Package Architecture Version Repository Size =============================================================================================================================================================== Installing: nss_nis x86_64 3.1-5.fc31 fjanus.fedorapeople.org_testrepo_ 41 k Installing dependencies: libicu x86_64 63.2-3.fc31 fedora 9.3 M libpq x86_64 12.2-1.fc31 updates 212 k postgresql x86_64 11.7-1.fc31 updates 1.5 M postgresql-server x86_64 11.7-1.fc31 updates 5.2 M Installing weak dependencies: pg_repack x86_64 1.4.4-1.fc31 fjanus.fedorapeople.org_testrepo_ 86 k Transaction Summary =============================================================================================================================================================== Install 6 Packages Total download size: 16 M Installed size: 60 M Is this ok [y/N]: So from my point of view this behavior is not caused by old repodata, but it could be some dnf feature or bug which don't allow self-dependency. [1] https://copr.fedorainfracloud.org/coprs/fjanus/nss_nis/build/1388345/ [2] https://fjanus.fedorapeople.org/testrepo/ [3] https://fjanus.fedorapeople.org/testrepo1/
since it's a corner case and not easy to solve, with a documented workaround, I am closing it as WONTFIX, but feel free to reopen if needed