I download this Package util-linux-2.23.2-65.el7_9.1.src.rpm and extract it

 rpm2cpio ./util-linux-2.23.2-65.el7_9.1.src.rpm | cpio -idmv

Among the files used there is a file named util-linux-2.23.2.tar.xz

I have extract this file and Editing one of the files login.c

Then I compressed the files once using the command

tar -cJvf util-linux-2.23.2.tar.xz util-linux-2.23.2/

Now when I try to compress files to rpm file I have this with the command

rpmbuild -ba ~/rpmbuild/SOURCES/util-linux.spec

I have this error:

+ /usr/bin/patch -p1 -s
+ /usr/bin/cat /root/rpmbuild/SOURCES/0143-lsmem-make-split-optional-follow-output-by-default.patch
+ /usr/bin/patch -p1 -s
+ /usr/bin/cat /root/rpmbuild/SOURCES/0144-libmount-fix-access-utab-write-test.patch
+ /usr/bin/patch -p1 -s
+ /usr/bin/cat /root/rpmbuild/SOURCES/0145-login-add-LOGIN_PLAIN_PROMPT-to-login.defs.patch
+ /usr/bin/patch -p1 -s
1 out of 2 hunks FAILED -- saving rejects to file login-utils/login.c.rej
error: Bad exit status from /var/tmp/rpm-tmp.GN6oqO (%prep)

RPM build errors:
    bogus date in %changelog: Thu Oct 10 2012 Karel Zak <kzak@redhat.com> 2.22.1-1
    bogus date in %changelog: Thu Feb 07 2012 Karel Zak <kzak@redhat.com> 2.21-0.1
    bogus date in %changelog: Fri Aug  2 2011 Karel Zak <kzak@redhat.com> 2.20-0.1
    bogus date in %changelog: Thu Jan  8 2010 Karel Zak <kzak@redhat.com> 2.17-1
    bogus date in %changelog: Wed Dec 14 2006 Karel Zak <kzak@redhat.com> 2.13-0.46
    bogus date in %changelog: Wed Mar  9 2006 Jesse Keating <jkeating@redhat.com> 2.13-0.20
    bogus date in %changelog: Wed Mar  9 2006 Jesse Keating <jkeating@redhat.com> 2.13-0.19
    bogus date in %changelog: Sun Mar 13 2004  <SteveD@RedHat.com>
    bogus date in %changelog: Mon Jun 14 2003 Elliot Lee <sopwith@redhat.com> 2.11y-20
    bogus date in %changelog: Tue Jan 28 2002 Bill Nottingham <notting@redhat.com> 2.11n-4
    Bad exit status from /var/tmp/rpm-tmp.GN6oqO (%prep)
[root@vps8865 ~]# ^C

1 Answer 1


You are compiling a new package with rpmbuild, not compressing it.

Your mistake is that you edited files in the source tarball and then replaced the original one with your changes. However, one of the source package’s patches failed to apply because it was generated from the original source instead of your modified source.

You should use diff to generated a patch that includes your changes to the source, and apply it after all the other patches in the spec file (include it by adding another Patch### line to the spec file and a %patch line to the %prep). The end result will be the only files you change is the spec file and adding a .patch file to the source dir. See the RPM packaging Guide on correctly creating a patch.

Note: It appears that you are changing something that another patch changes, so you will likely need to get the original source tarball and apply all the other patches first, then modify the source and generate the diff.

As for the Bogus dates, RPM started checking whether the day of the week is correct for the date, and all of those dates are wrong. I suppose you have to fix it if you want to build the package. It was probably fixed in RHEL.

  • I really can't do this on my own because I'm very new to it and it's my first time using linux It is annotated graduated to the group. I hope you will give me instructions to solve the problem Aug 22, 2021 at 23:40
  • I can’t really help you any further than that. Compiling and packaging software is complex and I’ve given you instructions already. Perhaps you should create a new question explaining why you need to modify the login program in the first place?
    – jsbillings
    Aug 22, 2021 at 23:42
  • It's a protection project for telnet login. Where any wrong login is saved. The administrator of the server can know if there are force brute password attacks on his server or not. Aug 22, 2021 at 23:48
  • @mohammedmoha aren’t failed logins already logged in the journal? And btmp?
    – jsbillings
    Aug 22, 2021 at 23:49
  • btmp not save password and not save username I need to log all the data with the hacker ip device Aug 22, 2021 at 23:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.