[CLOSED] building RPM from scratch

Issues related to applications and software problems
Post Reply
User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

[CLOSED] building RPM from scratch

Post by warron.french » 2018/02/28 14:30:22

Hello to anyone who can/will contribute:
apparently the ability to create RPMs from scratch, as opposed to using an already built (needing to be compiled) src.rpm, is a magical task.

I know I am not the first nor the only person to ever have to do this, but nobody seems to know how to build an RPM from scratch... well, almost nobody.

I found the following links that provide some details and might be helpful to someone else to get caught up to the same level of competency as myself (which I know is not saying too much):

Youtube Links to get started:
The Urban Penguin - https://www.youtube.com/watch?v=364Plv6 ... 80KjLIGRKE
Philippe Loctaux - https://www.youtube.com/watch?v=CVCIUQ1 ... 80KjLIGRKE
Edureka! - https://www.youtube.com/watch?v=TINRpzM ... 80KjLIGRKE
TheCentOSProject - https://www.youtube.com/watch?v=CTTbu_q ... 80KjLIGRKE
Manoj Jaswat - https://www.youtube.com/watch?v=otL3NU2 ... 80KjLIGRKE
RocketWolf - https://www.youtube.com/watch?v=4J_Iksu ... 80KjLIGRKE

Fedora Page for in-depth information:
Fedora Quick Docs | Creating RPM Packages - https://docs.fedoraproject.org/quick-do ... kages.html

I still have some questions though.
  1. 1. I am building an RPM from scratch for the NVIDIA Drivers for a specific video card. I download their (NVIDIA's) .run file and execute to get the binaries, docs, and libraries all into place. Some of the libraries are actually linked from one path to the other. How do I ensure that the RPM delivers the files and their associated links?
  • 2. Also, how do I control the run-level state of the machine during the time the drivers are installed? I need to bring the machine down to runlevel 3 (for RHEL6) and the equivalent for RHEL7, drop in the drivers, docs, and libraries, then REBOOT the machine (that's what I want done anyway).
Last edited by warron.french on 2018/03/28 19:54:13, edited 1 time in total.
Thanks,
War

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: building RPM from scratch

Post by TrevorH » 2018/02/28 15:51:21

I am building an RPM from scratch for the NVIDIA Drivers
Why reinvent the wheel? Either just use ELRepo's version which just works or if you cannot use third party packages for $reasons then steal their SRPM and rebuild it so that you can see the spec file and the sources that go into building it. They've spent the last 5 or so years getting kmod-nvidia just right.

You don't change runlevels just to install a package. Yum does the update in such a way that any in-use files continue to be used until whatever is using them is restarted. Yes, it probably needs a reboot to take effect but you don't need to be in runlevel 3 to update them. Files are replaced on disk and the in-use ones are in RAM so don't get replaced until they're not in use.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

Re: building RPM from scratch

Post by warron.french » 2018/02/28 18:27:47

What is ELRepo? Where do I find it?

Part of the reason I have to rebuild the RPM is due to security purposes.
Thanks,
War

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: building RPM from scratch

Post by TrevorH » 2018/02/28 23:30:10

ELRepo is the go-to place for extra drivers etc that are not included in the base distro. Many of the maintainers of the ELRepo packages just happen to be on the moderation team for this forum. Google for ELRepo and you will find them. They have SRPMs available for all their packages. They also have an nvidia-detect package which supplies a utility that will tell you which of the 3 versions of kmod-nvidia you need to use (they package 2 older versions of the drivers for cards that nvidia have dropped support for in the very latest ones). The main advantage of the ELRepo packages is that they take advantage of the RHEL stable kernel ABI so the packages don't need to be rebuilt for each and every kernel update - which is the case if you install from their .run file. That does sometimes change at a new point release and they do then need rebuilding.

Make sure you use the mock utility for all your builds.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

Re: building RPM from scratch

Post by warron.french » 2018/03/01 01:04:55

Oh great! This is useful information for sure. You never cease to educate me - thank you.
Thanks,
War

User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

Re: building RPM from scratch

Post by warron.french » 2018/03/20 19:36:48

TrevorH wrote:ELRepo is the go-to place for extra drivers etc that are not included in the base distro. Many of the maintainers of the ELRepo packages just happen to be on the moderation team for this forum. Google for ELRepo and you will find them. They have SRPMs available for all their packages. They also have an nvidia-detect package which supplies a utility that will tell you which of the 3 versions of kmod-nvidia you need to use (they package 2 older versions of the drivers for cards that nvidia have dropped support for in the very latest ones). The main advantage of the ELRepo packages is that they take advantage of the RHEL stable kernel ABI so the packages don't need to be rebuilt for each and every kernel update - which is the case if you install from their .run file. That does sometimes change at a new point release and they do then need rebuilding.

Make sure you use the mock utility for all your builds.
TrevorH, I have permission to use the ELRepo to grab the "src" RPMs; and make the appropriate modifications. I generated some new RPMs but one of the problems I have run into is during the uninstall of the RPMs (kmod-nvidia, nvidia-x11-drv and yum-plugin-nvidia) is that the kernel modules don't clean up properly out of the initrd/initramfs|GRUB configurations so I end up with the nvidia as well as the nouveau drivers both being only partially installed and uninstalled. This is a problem for us for stability. We require the ability for a repeatable process for upgrading the drivers and kernel modules (thus the RPMs in tandem) and we aren't seeing that.

A cohort of mine, not really a coworker, has suggested adding something called a %postun section?

I don't know how to do that based on what I see in the current kmod-nvidia.spec file. From what I can determine, I think (and I hope you can advise me on the cleanest path possible) I need to perform:

Code: Select all

copy/backup of the current initramfs;
execute a dracut -v -f;
then a grub2-mkconfig -o /boot/grub2/grub.cfg
And finally another reboot to get the nvidia stuff entirely out of the kernel modules (I don't know the proper terms, please correct me) and then allow for nouveau to be loaded again.

The true goal is for us to take systems that have NVIDIA.run installations, update with newer driver versions using "ELRepo" RPMs created by us using your "src" RPMs, and continue the upgrade cycle using "src" RPMs -> "x86_64 homegrown RPMs."

Can you advise please?
Thanks,
War

Post Reply