Rocky Linux HOWTO Series: Building a Rocky RPM package webinar poster

Rocky Linux HOWTO Series: Building a Rocky RPM package

Watch Now

In this webinar, we will demonstrate how to build a Rocky Linux RPM package. Don’t miss this exciting and informative webinar!

RPM Package Manager (RPM) (originally Red Hat Package Manager, now a recursive acronym) is a free, open-source software package management system. The name RPM refers both to the .rpm file format and the package manager program itself. RPM was intended primarily for Linux distributions; the file format is the baseline package format of the Linux Standard Base.

Webinar Synopsis:

  • How Have RPMs Changed?

  • Where do RPM Packages Come From?

  • What If You Don’t Have the Source File?

  • Demo

  • Chroot and Containers

  • Does Mock Clean the Environment?

  • Are Some Packages Omitted From the Minimal Base System?

  • Are There Things You Don’t Need to Say in Your Spec File?

  • Other Distro’s

  • The Build Process For New Config File and Repositories

  • Rebuilding Rocky Linux Packages

  • Can You Cross Compile?

  • i686 Packages On a x86_64 System

  • 32-bit Packages

  • Did You Do a 32-bit Kernel?

  • Kernels While Running Mock

  • Individuals Messing With Default Packages

  • The Mock Build Process is Smoother

Speakers:


Note: This transcript was created using speech recognition software. While it has been reviewed by human transcribers, it may contain errors.

Full Webinar Transcript:

Zane Hamilton:

Good morning, good afternoon, and good evening, wherever you are. Welcome to another CNX CIQ webinar. My name is Zane Hamilton. I'm the Vice President of Sales Engineering at CIQ. At CIQ we are focused on powering the next generation of software infrastructure, leveraging the capabilities of cloud, hyperscale and HPC. From research to the enterprise, our customers rely on us for the ultimate Rocky Linux Warewulf, and Apptainer support escalation. We provide deep development capabilities and solutions, all delivered in the collaborative spirit of open source. Today we're going to be talking about RPMs and how to create them. I would like to welcome Skip Grube and Jonathon Anderson. Skip, would you introduce yourself?

Skip Grube:

My name is Skip Grube. I began my career as a Rocky Linux release engineering contributor, something I still do to this day.  I spend a lot of time building packages. When package builds don’t succeed, I check on them. I am also a Linux engineer at CIQ.

How Have RPMs Changed? [01:16]

Zane Hamilton:

Thank you, Skip. Our conversation last night was focused on RPMs.  I realized that I hadn’t worked on one for a long time. I was looking at my old notes and saw comments like “this is painful” or “I don’t ever want to do this again.” How have RPMs changed? 

Skip Grube:

Yes. How

Skip Grube:

I remember when it was difficult. A tool that we still use is rpm-build. The tool has undergone many changes. We are also going to talk about a simple and powerful wrapper around rpm-build called Mock. . Rpm-build was really frustrating because you had to get everything just right such as setting your directories properly, macros, and then it might work. It could work for you, but then it wouldn’t work for someone else. Mock has made it so that we no longer have to worry about that. For example, instead of having Zane build the RPM on his system or Jonathon build an RPM on his system, Mock creates either a searu or container.

The idea is to quickly spin up a minimal Rocky Linux or other Linux system within your current box. You can then run the build inside that minimal system only using things available within the system. Unable to see anything else, the build will produce results and collect logs. It is simple and significantly easier than setting up rpm-build and doing this by yourself. Today we are going to demonstrate how to use the Mock and rpm-build to build a Rocky RPM package. 

Where do RPM Packages Come From? [03:49]

The first thing I want to talk about is where do RPM packages come from? Many people don’t understand that when you do DNF install or YUM command (the precursor to DNF), under your Linux box , RPMs are compiled from source RPMs. Source RPMs come from code. There are three components to a source RPM. There is usually a zip file or tarball with source code in it. This also means that we are going to talk about the Bash shell. 

Can I share my screen and present? This will be easier to demo than to tell. We're going to go to one of my most visited sites, the Raw Rocky Linux download pages. I know that you can browse these and they are also automatically added in your DNF Files. You can also go to /etc/yum.repos.d,, but I will show you that in a minute. We are going to click in here. Rocky Linux distributes source packages with their binaries. 

We are going to look at the bash source package. There are three components to a source RPM. There is a spec file that looks like this. It is a recipe for doing a rpm-build. Though we aren’t going to dive deep into this right now, it has the name, version it depends on, and making it bigger. It contains complex documentation that tells us how to build whatever we are trying to build. It shows us commands, whether it is a Makefile in a GCC or Python. It provides all the things that the package requires to complete the build. Bash has a lot of content. It has the second component of source RPM known as patches. Our upstream provider is Red Hat so most of these patches are issued by them. 

There are things that are added on to the main bash source code. Oftentimes they are backports to fix little bugs, security issues, or even a behavior change to be more conducive to Enterprise Linux.  The final component is the zip file or the tarball. That is in here. If you go into here and look at source0 you can see where the upstream source file originated. If you go to the gnu ftp server at this location you will see that these match exactly. Our base version is 5.1. That is everything we need to compile our bash. 

What If You Don’t Have the Source File? [07:27]

Jonathon Anderson:

If you don't have the source file, will it pull it down from that URL automatically?

Skip Grube:

It will not. It has to be bundled. The source RPM is expected to be able to compile without any internet access. We want to make sure that we have everything bundled together within our source RPM.First thing we need is a Rocky Lenox system. Doesn't necessarily have to be a Linux system, but as a member of the Rocky Lenox team, you can imagine I have a bunch of VMs, I've got a bunch of all kinds of things, uh, going on, ready to go. Once we have the source RPM this has made this much easier to understand. It is only source code and a spec file recipe on how to build it. I would like to show everyone how to build it. 

Demo [8:16]

The first thing you need is a Rocky Linux system or another functional system. As a member of the Rocky Linux team I already have many VMs and other things ready to use. I got everything running. We're going to load up a terminal and ssh into it because that will be easier than using the VM screen.  The first thing we're going to do is use four commands here to set up our Mock.  The first one (that many people are familiar with) is sudo dnf install epel-release. Epel, for those that are not familiar, is an excellent collection. It is a third party repository that stands for extra packages for Enterprise Linux and it has a bunch of stuff including this Mock program that we're about to install. This repository is maintained by the Fedora project and has a bunch of extra packages and stuff that you might find interesting for Rocky Linux or Red Hat Enterprise Linux. Now that we have our epel powers enabled, we can do dnf install mock. It is a very simple package. There are going to be a few Python dependencies because it was written in Python, but as you can see it is quite small for what it does. This package is less than 200 kilobytes. Now we are going to go ahead and install some support stuff.

I am not in the mock group so I am going to change that.  It is possible but I prefer to not do it on the system. You can run it as a normal user. Users in the mock group are allowed to run mock build. We are going to add me (Skip) to the mock group. Then we need to log in again to update the mock group membership. I will check to see if it worked and now I am a mock user with build powers.

The next thing we need to do is scroll to our vaunted Bash source RPM that we saw earlier. We're going to grab it and download it. Let's go.. Since we have a source file I am going to create a temporary folder to prevent cluttering up anything with logs. We have our source rpm and out  our mock built program. I enjoy seeing how fast compilation happens and how fast systems work. I always do build time to check speed and for benchmarking.

 -v for verbose. Verbose is important. Then do - - resultdir /home/skip/tmp That is the current directory.  Then do /home/skip/bash.  This is the source RPM. I'm going to press enter and watch it work. While this is working we need to take some time to explain what's happening. The Mock program is creating and installing a minimalistic Rocky Linux system in my virtual machine inside chroot. It is a container environment.

There are some packages here that are the bare minimum required. This way you can run DNF to install more packages effectively. This will look familiar to anyone who has installed packages before. Once that step is done it is going to read the bash spec file that we downloaded. It will say “what are the requirements that I need to build this package?” Then it will install only those packages. It will proceed to read it and call rpm-build just like normal, but inside the minimal system and perform a build. This way we are doing in a place where it has the minimum required to build bash without anything extra. 

Chroot and Containers [13:41]

Zane Hamilton:

I have some questions about this minimal environment. Earlier you mentioned chroot or a container. How does this work? What is it doing underneath? Is it really a container platform? Is there something else I have to do?

Skip Grube:

There are two options in Mock. The default option is systemd-nspawn container. You can read all kinds of wonderful technical details about that. It's a systemd feature that allows you to create containers without Docker Podman.  Systemd will talk directly to the kernel to see groups and create a container for you with storage, networking and everything. And it's it's very nice because this program, you don't want to, you could use Docker to run rpm-build, but we don't, we don't want that overhead, right? We don't need a whole Docker install to do this. And we're interested in just spinning up the bare minimum environment and then we're going to discard it at the end of this. Like this is all once we have our build and our, our resulting RPMs, then we don't we don't care anymore. It is a very nice feature because, while you could use Docker Podeman to run rpm-build, we don’t want the overhead. We are only interested in spinning up the bare minimum environment and then discard it at the end. Once we have our build and resulting RPMs we don’t care anymore. 

We will discard the environment and next time we call for a package we will load a new environment. This way we keep things clean. Systemd-nspawn is new to Enterprise Linux. You can run it with a simple chroot without containers. You can use the old chroot developed in the 1980s. It will do the same thing, but with differences in technical details. Containers and chroot can see different aspects of the kernel. You might run into some issues if you are running an advanced build with chroot. In bash it is a simple package so we are going to keep using the default. 

Does Mock Clean the Environment? [15:44]

Zane Hamilton:

Whenever this environment is created we want things to be clean and simple. Does Mock clean the environment for you? Is there anything to consider after it is finished?

Skip Grube:

By default it cleans it up. However, I would encourage everyone to get into Mock building because there are millions of options. And you can say especially for troubleshooting, hey, when you're done, do not clean this up, right? Go leave, leave the directories lying around so that if something went wrong, we can actually go into the ch route and check out like what was going on, like what files were produced, right? For example, for troubleshooting we can tell the system to “not clean certain things. Leave the directories lying around so that if something goes wrong we can go into the chroot and investigate what files were produced.” If there was an error, a file that was missed, or something, we can explore that. I know there are a lot of scary texts but  this is what happens when you compile bash. I can show you the text because it is straightforward and not a mystery. This is an excellent tool. I am going to become root for this because I need to be root to explore. 

When you install Mock, there's a mock here and  a couple of folders. We're going to go into the mock config (your configuration for mock sets). We'll go into that in a minute and you can see here's root. if you look at my system here this looks like a root directory. This is where bash is being built as we speak. I'll bet if we go into the build here there will be all kinds of stuff going on inside this wonderful little directory. If we wanted to, we could explore the gcc (what it's pulling as it happens). I'm not going to get into that right now, but  this is the chroot or the container in this case. There is an option to Mock called - - no clean or something like that. This option will not remove stuff when we’re done. It will keep everything around so that someone can investigate and see what went wrong. 

Are Some Packages Omitted From the Minimal Base System? [18:18]

Jonathon Anderson:

We have talked a little bit about the benefit of listing all your build requirements in the spec file. Is it normal for some packages to be omitted from that list in the minimal base system? Does that package make assumptions about the base system and only define requirements that would go on? 

Skip Grube:

This is an excellent question. You are referring to the initial set of packages. That was the first dnf command that was run inside of our mock, called a Buildroot. It's there to  bootstrap a minimal Rocky system. Your rpm-build requirements are only as sound as how minimal your Buildroot is. For example, if you throw Java into your Buildroot (this is a terrible idea) and your RPM requires Java without specifying it, that will cause issues for someone who doesn’t have Java. It’s not a requirement. 

Your question is difficult to answer.  The defaults for Mock are very good. They are as minimal as possible while still having a functional system.  It is up to the user to take things away. Let’s look at our log and I will show you what I am talking about. Look at that Bash RPM. I enjoy testing my RPMs so lets take the new RPM and overwrite/remove the current Bash. Then we will install the one we just produced. We shouldn’t have any issues because it is the same version. 

Even though they are the identical we installed and are running the new Bash. We just built our own shell interpreter.  Anyway, returning to your question, let's check out when the system begins. root.log is the Mock set up process for creating the container. This is the stuff that it needs to install before compilation is done. If we scroll down here we can see the list of packages. There aren’t very many. You won’t be able to take very many things out of there and have a functional system. If you are interested, you could always add things, but be careful. For every RPM package you should expect these to be present. You can always specify them. For example you can always specify “I need grep or gzip.” Almost every system you encounter is going to have this stuff and its dependencies. I hope I properly answered your question without beating around the bush too much. 

Are There Things You Don’t Need to Say in Your Spec File? [22:04]

Jonathon Anderson:

Maybe a point of reference is I don't think I've ever seen a package say that it depends on or build depends on glibc.Is it acceptable to have things you don’t have to say in your spec file?

Skip Grube:

It depends on the system you're building for. For example, Rocky Linux packages come from a tightly controlled system based entirely on Red Hat Enterprise Linux.If you run Red Hat Enterprise Linux you are also running glibc without it being specified.  It's not normally specified. I can imagine a situation via container or via something else where you have an RPM based distribution that has musl libc that would need to be specified within your package. It entirely depends on your RPMs intended audience or build distro. 

We're very fortunate in Rocky Linux to have Red Hat Enterprise Linux. We have a very high quality upstream. There still might be problems when you build 3000 plus packages to mail to distro. Many things might come up such as bugging. Most run of the mill packages like this one are pretty solid. It looks like we built it. 

Other Distro’s [23:48]

I'm going to go off on a little tangent here because we were talking about other distros. It's important to note if you're not familiar with Mock or this process. Mock is a Fedora tool. It's used a lot across the spectrum. This is not just a Rocky Linux thing. So if you go into /epc/mock/ configuration directory there are a lot of distros. There are some cool things we can do with this tool. When we create chroot and begin our build process it doesn’t have Rocky 9.0. We build Rocky 9 Bash, but you have the option to use other systems. We could specify CentOS 7, Fedora 1, or openSUSE and use a Bash design for any of those builds. The only limitation is you have to use an RPM based distro. 

There are so many in there. There are a ton of derivatives and distributions. The one I used is the default Rocky 9.  It’s default on this system because the packages of Mock say “if you’re using Rocky 9, they will assume you want to build Rocky 9 packages.  As you can see this is just a Python config file here. It's a bit of Python code. This is a Python dictionary and it's really cool how the settings are set. Let's check out this template file. This one is really interesting. I will show you high in the curtain with Mock. 

Is very interesting. If you've ever edited YUM or DNF config files, you will be familiar with this. It's fascinating because you have to remember when you're building an RPM package the location where you grab it’s dependencies matters. It is very important.  In Mock you can manipulate this to be whatever you want it to be. Right now this is the default, but you can change the DNF priorities to say,“I want my own repository that I hold on to. I want you to get your GCC or your dependencies from there first.” You can manipulate the versions that you're building against. For example, the following might be an issue. Maybe your Ruby package will not build because openSSL breaks it. So instead you might have to build it against a slightly older openSSL at build time so it complies. There are all kinds of things you can do such as injecting your own dependencies to change Buildroot. You can customize your system to build your RPM in limitless ways.  

The Build Process For New Config File and Repositories [27:17]

Jonathon Anderson:

What is the process like for creating a new config file and the repositories it draws from?

Skip Grube:

You have to start somewhere.  There are several ways to do it. We are very fortunate because Rocky is a downstream distribution. We have excellent upstreams in Red Hat Enterprise Linux and CentOS 9 stream. To get started we bootstrapped Rocky Linux 9 off of Red Hat 9 Beta. It was released in December or January of this year. I can show because I am heavily involved. I have a web server that the project allows me to use. Let's look at aarch64/. In Rocky Linux we have to do this for around 5 different architectures. 

We compile for the ARM processors like Raspberry Pi. We compile for 32-bit.  We compile for Intel 64-bit. These are your default laptop, desktop, server processors. We compile for s390X., This is the IBM mainframe System Z processors. We also compile for PowerPC  which is another IBM derived processor line. All of these are generally fine. They are very consistent. Every once in a while we’ll have an issue where it compiles for everything but s390X and we have to investigate. There is a lot of problem solving. The repository here is huge. There are 8,000 or more packages in the repository. This is here because I had to do a complete rebuild of what’s in Red Hat Enterprise, Linux 9, and CentOS 9 Stream in order for the build team to get going. 

This is how we start. We download source code, put together source RPMs and begin this Mock process over and over again. There are tools and automation to help us. It's not like I'm just sitting here by candle light saying, “oh gosh, I'm going to build this  3000 more times. Now we have tools to make the machine do the work. You will see that this requires a lot of effort and time. These are free to browse. You can see how Rocky Linux 9 was bootstrapped. If you go through this I hope you have a lot of memory in your browser because these are some big listings.

Rebuilding Rocky Linux Packages [30:41]

Jonathon Anderson:

I know you mentioned bootstrap. Once you have a set of packages from somewhere and build Rocky Linux packages against them, do you have to rebuild all the Rocky Linux packages?

Skip Grube:

Yes. You’ll notice right here that this says directory stage 1. There is so much more. I think this segways us nicely into a new topic, Peridot. This is a public site: paradot.build.resf.org. Because this is a public site anyone can browse this. However, not everyone will be able to import and build stuff. Let’s check out Rocky Linux 9 and go into builds. I am going to check out this one called “nodejs.” This is everyone's favorite JavaScript server. To be honest I don’t understand it very well. 

Skip Grube:

In this there are a bunch of tasks that happen. These are the interesting ones. It says build for x86_64 or build for i686. These are different architectures that we are building for.

Skip Grube:

Due to some technical issues I am going to select a different one. This one is called bind, otherwise known as everyone’s favorite DNS server. If we scroll to the top you may notice that this text looks familiar. When our build system (Peridot, API, Koji which is a Fedora CentOS system and Gooey, among others) they are very organized and elaborate ways for calling Mock and rpm-build.  And so like this, this text out here is almost identical to what we were just doing in our, if I can Back Into my bill directory here, you'll see a little clearer here. 

For this X here we installed a bunch of initial packages that the RPM requires. Then it executes rpm-build like we just did. THis is an excellent way of doing local testing/builds. If you set your Mock config correctly, you can make it completely compatible with the real Rocky Linux, CentOS, or the Red Hat Enterprise Linux projects. 

Can You Cross Compile? [34:02]

Audience Member:

With Mock, can you cross compile? For example, making an RPM for ARM on a x86 machine?

You will not be able to cross compile. Um, RPM in general does not natively support cross compiling. It is possible, but the logic to do it has to be built into the spec file.. I’ve seen some from QEMU that are like this. Most packages are not going to bother having this feature because they assume if you want to perform a cross compilation you have access to the system that also has a compiler. For bootstrapping initial systems this would go beyond the scope of this talk. This would delve into cross compiling things manually to get RPM and basic packages going. 

Let's say that a completely new processor architecture comes out and we have to build software for it. There is going to be some more fundamental work before you can even begin to think about RPMs. The goal when we begin porting a system for this is to get enough stuff so we can get this to Buildroot. This is the initial set of packages that we have inside of Mock. Once we have that, we can get rolling, we can say,  “we'll build very slowly.” We can get  some basic packages going like the C compiler. I don’t want to get into this process, but it is very complicated. The short answer is no.

i686 Packages On a x86_64 System [36:17]

Jonathon Anderson:

What about I686 packages on an x86_64 system?

Skip Grube:

That will work fine. With ARM64 you can compile as long as the processor supports it. We know x86_64 and Intel processors support 32 bit mode. Some ARM64 processors are also backwards compatible with ARM32 in the same way. Let’s take a look at an i686 build. 

Jonathon Anderson:

Presumably you'll still need a 32-bit bootstrap to or environment to build against. 

Skip Grube:

That makes a big difference. Because as long as you have some RPM macros (which Mock does for you set to be set to the proper processor architecture) then you have a proper Buildroot and build environment that supports it. We can look up here.  You will notice that when we're installing here, this entire system is i686. There is no 64-bit stuff going on here. This is because 32-bit packages do not need 64-bit packages. In fact, they actively don't want them in order to build. I think you’re next question will be about why we build 32-bit packages when Rocky Linux and Red Hat Enterprise Linux does not release a 32-bit version. 

32-bit Packages [38:19]

Jonathon Anderson:

Where is my 32-bit ISO?

Skip Grube:

The reason that we build 32-bit packages is because if you look at your Rocky Linux repositories and, and upstream Red Hat repositories, there are certain packages like OpenSSL and several others that include 32-bit variants. If you want the 32-bit version for whatever reason you can install that.They exist for compatibility's sake for a lot of commercial software. They might distribute a 32-bit version and they need 32-bit openness to sell. In the beginning the Rocky team decided we are going to compile these 20 and 32-packages. We will compile OpenSSL. “This will be just fine.” Then they would look at other ones that require 10 packages for 32-bit. “Okay we’ll do those too.” After around 150 we thought, “we’re compiling everything.” CentOS came to this conclusion before us, but in order to build these 32-bit packages, we have to build 32-bit for everything. I don’t want to get into this too much right now, but if you connect Peridot DNF repo or Webuild 8 in Koji 32-bit packages are supported. Firefox will actually refuse to build with 32-bit.They are intentionally excluded, but most of them are there. We initially thought it would be super easy to throw 20-30 cubit packages in. Then after a few days of building we realized that our dependencies had dependencies. We might as well build everything. So we did. 

Did You Do a 32-bit Kernel? [40:37]

Jonathon Anderson:

Do you also do a 32 bit kernel?

Skip Grube:

No. That is one of the packages that excludes 32-bit. This is also a big reason we don’t have 32-bit ISO. Hypothetically speaking, if someone really wants a 32-bit system, you could take 32-bit builds we have completed for all user space and make it compatible with a 32-bit kern package. Put them together and produce an ISO or an image. It would work, it would just also be a lot of work. I’m not sure if it is worth it. 32-bit hardware is becoming increasingly irrelevant. For that reason it isn’t something that we’re interested in doing. 

Kernels While Running Mock [41:23]

Jonathon Anderson:

The last big thing we need to talk about is the kernel itself. The kernel crosses the boundary, but is not part of the isolation. Even though running Mock is a container, you’re doing the build with the kernel of the host system, regardless of what you’re targeting. Has this ever come up? Is it an issue?

Skip Grube:

Yes.Usually in ways you wouldn't think about. A good example is while we were building Rocky Linux 9  there was a Ruby package that was required. We were so backed up at the time. I think even now we're building Rocky Linux 9 on Rocky Linux 8 systems. They're running containers, but they have a Rocky Linux 8 kernel. It’s a little older, but still well supported and there is the Ruby package. It might not actually be the Ruby package, but it is related to Ruby. For its compilation it runs testing and requires a kernel for support It’s not only tmpfs, the temporary file system feature, we have in our Rocky 8 Kernel. There is also tmpfs feature called O_kemp. 

I can't remember exactly the feature it provides, but it's a new thing in the Rocky Linux 9 Kernel. Anyway, the Ruby tests would not pass. The tests are done at the end of compilation for an RPM. To ensure the binaries are working properly. We ran into a problem and in order to make sure everything was okay we had to upgrade the kernel on some of our build machines.  This way it would support the new tmpfs feature. 

Jonathon Anderson:

Have you ever encountered a situation where it works in the other direction? For example, you have a newer kernel, but something you're trying to build requires an older one?

Skip Grube:

My memory is very fuzzy on this. I want to say yes, but I don't have a specific example.. I have run into a ton of awful problems such as that, where we’ve had to investigate and fix. 

Jonathon Anderson:

, My question was “has this problem occurred?” The answer is almost certainly yes, right? 

Skip Grube:

When you break things in so many different ways, it will make your head spin. Many people say ““it's so easy.” You're just calling these RPM bills over and over again. If all of them were completed on the first try my job would be very simple.  I'm happy to give it up to anybody who wants to do it. The problem is when things don't go right, and we have to spend hours to days trying to  figure out, for example, why won't this work and why did it work before? There's a lot that goes into that. Oftentimes it has to do with the versions of things that you're bringing in and building against. Sometimes a new version comes out and it will break at build time in an unexpected way.

Jonathon Anderson:

“How did this ever work before?” This is the worst question in systems engineering.

Skip Grube:

It comes up more than you would think RPMbuilding. Building in Mock here is great if you want to build two-five packages. When we're talking about industrial capacity and we need to build 5,000 packages this comes in handy. We can do mass builds and not have to do it one at a time. 

Individuals Messing With Default Packages [45:24]

Zane Hamilton:

Have you run into users out there that are taking default packages, messing with them, then posting them into their own repository? Do they have something that’s required for their company environment?

Skip Grube:

This brings me to another great point: we already know that we can get our source RPMs from our download site.  They are available via DNF command. If you check out your  yum.repos.d. Rocky Linux and other distros come with source repositories and all they do is point to these source RPMs. However, these source RPMs have to come from somewhere.We want to go to another great site git.rockylinux.org/staging/rpms/bash

And you'll see here we've got some branches. Branches are funny when it comes to distros here. This is Rocky 8 and Rocky 9. We never merge branches. These are just the different versions that we keep track of. You can see when things were imported. The latest version of Bash for Rocky 9 was imported five months ago and built. There hasn't been any updates from Red Hat since then. You'll notice here, sources and specs. Let me pull up the old source RPM that we got from here. If you browse this source here, I'm going to put it on top here so that we can see him side by side. You'll notice specs bash dot spec is right up here.

If you go into sources here, you'll see all these patch files. They should exactly match. That's where you want to know where these source RPMs come from.  This is open to everybody. You can clone it, you can muck with it, you can do whatever you want with it, and you can build your own. You don't want our bash build. Make your own fixed bash. Put in your own patches. This is where our sources come from. git.centos.org/rpms/bash is where Red Hat publishes their official source code. . They have branches. If you want the CentOS 4 (c4) bash, We're not really interested in that. We'll check out. There is no CentOS 9 , but they still call it c9.  This is the Red Hat source code and this is exactly where we got it. It gets pulled down and tagged into our git here. You can see the flow of where these things come from. If you're interested in modifying it is simple to get started. I’m not a C programmer so I won’t say it is easy.y.

The Mock Build Process is Smoother [47:35]

That was all I had planned for today. If you are building RPMs, please consider using Mock to use rpm-build. It's hard and it's outdated.I used to hate doing this. My company would sometimes ask me to build a customized RPM for different programs. I dreaded having to figure it out. Mock has made this process so much smoother. Mock has done a lot for package building. Especially RPM package building. Containers have done so much for developers. We have a standardized base that we can build on. We can make sure that when I build a package in my Mock, it's going to be the same as a package built in anyone's Mock. As long as our configurations are the same, we should get the same result. 

So please consider doing this it if you're still using raw rpm-build to build packages. Nobody should be using raw rpm-build because it is really rough. You will never have to configure RPM Macros again.  Configuring RPM macros are the same as configuring Mock. It's inside that Mock configuration file. You can set macros like you can do everything else. It's much easier than having to mess around on your file system trying to locate RPM macros. 

Zane Hamilton:

That's great. I don't think we have any more questions. I really appreciate you coming on Skip and for putting this together. 

Join us next week and like can subscribe. See you next week. Thanks.

Transcript

foreign [Music] good afternoon and good evening wherever you are welcome to another cnx ciq webinar my name is Zane Hamilton I'm the Vice President of Sales engineering at ciq we here at ciq are focused on powering the next generation of software infrastructure leveraging the capabilities of cloud hyperscale and HPC from research to the Enterprise our customers rely on us for the ultimate Rocky Linux werewolf and apptainer support escalation we provide deep development capabilities and solutions all delivered in the collaborative Spirit of Open Source today we're going to be talking about RPMs and how to create them so if we can bring in Skip and Jonathan

foreign excellent welcome back skip good to see you thank you nice to see you so again as always hey Jonathan how you doing yeah good to be here thanks thanks perfect Skip it's been a while why don't you remind everyone who you are and what you do my name is Skip grube I am well I started out as uh and still am a rocky Linux uh uh core Sig or release engineering contributor and I in short terms it means I build a lot of packages and especially when package builds go wrong I'm often there to check them out and uh I'm also a Linux engineer

and kind of engineer at large at ciq as well excellent thank you skip so I know we talked quite a bit last night about RPMs and yes it seems to be the common like ah yes we've talked about it boy oh boy oh boy quite a bit of stuff and I haven't done this in a long time but I was looking back through some old code that I put together last night after we had our conversation and I actually had comments in my code of this is painful and I don't ever want to do this again so how have things changed how is this different

now so I too remember the bad old days um the tools that we still use at its very core is rpm build however there's a lot more to it now and what we're gonna we're gonna talk about an interesting wrapper around it called mock it's kind of a simple idea but it's very powerful surprisingly powerful and um I know like you I remember you know RPM build and you had to get everything just right and you had to say a few magic words a few cuss words and then you know set your directories properly set your Macros and then maybe it would work right and

View full transcriptHide full transcript

and then it would work but maybe it wouldn't work for somebody else and that's that's no good and mock um it kind of gets rid of that idea it's very nice so what we do now instead of hey saying Zane's going to build his RPM on his system or Jonathan's going to build his RPM on his system what mock does is it will create a a Siege route or container it does both um but the idea is to to spin up very quickly a very minimal Rocky Linux or other Linux system within your current box right and then run the build inside that minimal system

using just things that are available in there the build can't see anything else and produce the results collect the logs and you're done and it's actually it sounds simple it sounds stupid but it's actually way easier than setting up RPM build and doing all of this stuff yourself and we're going to demo it we're going to show off uh we're gonna do a little build of Our Own and I think the one of the first things I need to talk about when I talk about RPM packages is where do they come from exactly because a lot of people don't you know when you do your

dnf install or whatever under your Linux box you're still using your gum command I understand love that muscle memory um the RPMs effectively are compiled from Source RPMs Source RPMs come from code effect you know if there are there's three components to a source RPM we have a usually a zip file or tarball of some kind with source code in it so we're going to talk about bash we're actually going to go pile The Bash comp or The Bash shell and everybody knows and loves well most of us love and um so in inside and we're gonna you know what we're gonna demo it uh

if you don't mind right now I'm gonna can I present here can I can I share my screen certainly because it's easier to show you than to than to tell you about this so share screen I'm going to click on this one and here I've got a rocky VM running but we're not going to use that just yet we are going to move this over and we're actually gonna go to one of my most visited sites the raw Rocky Linux download pages and I just happen to know so you can you can browse these These are also added automatically in your dnf big files you

can go to Etsy yum.repost.d show you that in a minute but we're going to go into here and uh Rocky Linux just like just about every Linux distributes Source packages with their binaries right so there are here so aha Ash this is the bash Source package and we're going to look at it real quick because I just want to show people so there's three components to a source RPM there's a spec file looks like this bring it over here it's a recipe for doing a build right it's got you know the name the version things that it depends on make it bigger for everybody we're

not going to get deep into this right now though it's it's you know a little complicated there's a lot of documentation about it but this is just a how do we build this you know what commands do we run whether it's a make and a GCC or whether it's a python thing or you know whatever right and it's got requirements here that we need in order to build this things that it provides things that the package requires that sort of stuff and it's got you'll see bash has quite a few of them it has the second component of the source RPM is patches and you'll

see these are all the patches most of these are issued by Red Hat because our Upstream provider is red hat from our code and this is just stuff that is added on to the main bash source code that are oftentimes they're back pores they fix the little bugs security issues maybe they change Behavior to a way that's more conducive to Enterprise Linux whatever right and then the final component is as I said the zip file or the tarball and that's in here and this is literally if you go to um I think it's Savannah is it gnu Savannah I'm not sure the Upstream it's actually

probably in here we look at uh Source zero aha so this is where the Upstream Source was got from so if you go to you can use FTP server to this location right this base version our base version is 5.1 it's this file right and you can you can book it you can they should match exactly and that's all we need to compile our Bash so skip if you don't have the source file will it pull it down from that URL automatically or it's a not no it has to be bundled so the The Source RPM it's expected to be able to compile without any

internet access right so we we kind of we want to make sure that we have everything um bundled together within our source our source RPM right and once we have the source RPM it's really as we see here kind of demystified it it's just a bunch of source code and a spec file to as a recipe to you know how to build that source code and we're going to take it and we're going to build it um and I will show that I think right now is that okay with you guys absolutely practical awesome awesome let's go let's go all right first thing we need

is a rocky Linux system doesn't necessarily have to be a right Linux system but as a member of the rocky links team you can imagine I have a bunch of VMS I've got a bunch of all kinds of things going on ready to go so got my thing running we're actually going to load up a terminal an SSH into it because it's going to be easier than using the VM screen but we're gonna that's the one we're going to be using and let's see if it lets me in here excellent okay and the first thing we're going to do this is very easy I think

we're going to use four commands here to set up our our Mock and the first one many people likely have already done this is um dnf install Apple release spell it right skip and Apple for those that are not familiar is an excellent collection it's a third-party repository stands for extra packages for Enterprise Linux has a bunch of stuff including this mock program that we're about to install um but it's another repository maintained by the Fedor project has a bunch of extra packages extra stuff you might find interesting compiled for Rocky Linux or red hat Enterprise Linux and now that we have our Apple Powers

enabled we can dnf install mock very um like I said four letters very simple simple package here it's written in Python so there's going to be a few python dependencies but um as you'll see here it's uh it's actually quite small surprisingly small for what it does um this package is you know less than 200 kilobytes here and it's got some support stuff that um it needs to install so we're going to do that go go a terrible time for any mirrors or anything to uh to fail yeah that would be uh that's Murphy's Law in action there okay cool so now we've got mock

here I'm just gonna yeah I'm not in the mock group excellent so we're going to do that too so we don't want to run maca's root I mean you can but I don't want to on the system it's not how I work in general you can run it as normal user you should users in the mock group are allowed to run mock field so we're going to do is we are going to add Skip that's me to the mock group here very simple his um and then we're going to re-log in because we want group membership to be updated and I will check and we

see aha now I'm a mock user I have build powers awesome the next thing we're going to do is we're going to scroll back over to our vaunted bash RPM Source RPM that we saw earlier we're going to grab it here and you guys can read this I don't know if I don't know how visible that is but that's good it's good go check it out and we're gonna we're gonna download let's go good old W get there we go now we've got a source file I'm gonna I'm gonna create a temporary folder to work in here just because I don't want to clutter anything

up with logs and now we have our source RPM we've got our mock build component right or our mock built program very simple um I'm going to time the build time is a command that you just you put I do it all the time for my builds because I enjoy seeing how fast the system works how fast compilation happens it's very useful to uh well for a lot of reasons but especially during builds very useful for benchmarking and so forth um V verbose we like verbose and let's see I'm going to say result or is home skip cup there we go that's the current directory

and then we're just going to say hey um at source RPM home skip RPM awesome and I'm going to press enter and go go and we're gonna while this is happening it's gonna take a few minutes we're going to talk about what's going on here so um and then we'll pause for some questions for some discussion because I don't want to talk forever of course um What's Happening Here is this the mock program is actually creating a very minimal Rocky Linux system right in my virtual machine here inside a CH root it's actually a container environment and it's installing you'll see there there's some packages

here that are really the bare minimum of things you need to get going like you know just so you can you can um you can have just so you can run dnf to install more packages effectively and once that step's done and it's going to complete soon here um this is going to look very familiar to anybody who's ever installed packages before then we're going to check out it's going to read that bash spec file that we looked at over here and it's going to say hey what what are the requirements that I need in order to build this package right and then it's going

to install those packages but only those packages nothing else and then it will proceed to read the it will proceed to call RPM build just like you would but inside this minimal system and perform a build and that way we only we're doing it in a place that only has the bare minimum needed to build bash and no extras no uh no optionals I have questions about this small environment yes yes the environment tell me more about this you said earlier a CH route or a container how how does this work what is it doing underneath is it really a container platform is there something

else I've got to do yeah so there's uh there's two options in mock the default uh which we're using right now is called um systemd in spawn container you can read all kinds of technical wonderful details about that it's a systemd feature that effectively allows you to create containers not with your traditional Docker or podman or whatever it's actually system D will talk directly to the kernel to c groups and create a container for you with storage and networking and everything and it's um it's very nice because this program you don't want to you could use Docker to run RPM build but we don't we

don't want that overhead right we don't need a whole Docker installed to do this and we're interested in just spinning up the bare minimum environment and then we're going to discard it at the end of this like this is all you know once we have our build and our resulting RPMs then we don't um we don't care anymore like we just you know the environment discarded and we'll wait for the you know the next time we call for a package spin up a new environment and um so yeah we keep things clean there is also an option if you don't like um in fact it's

actually very popular is some originally systemd in spawn is kind of a newer in Enterprise Linux terms a newer thing you can run it with just a simple CH root right where no containers at all just good old you know CH route developed in the 1980s still around wonderful tool and it will do the same thing the technical details are a little different right the the container and the CH root inside it they can they can see different aspects of the kernel sometimes that in when you get to Advanced builds that will affect things occasionally but here for bash it's a pretty simple package so

we're just going to uh we're just using the default okay and then whenever it lays this down we're talking about being clean and simple does it actually clean this up for you when it's finished or is that something else you've got to take care of after the fact is the environment yeah so by default it cleans it up um but you can there's actually uh and again if you get into mock building I encourage you to check out all the options because there's a million of them and you can say you know especially for troubleshooting hey when you're done do not clean this up right

go you know leave leave the directories lying around so that if something went wrong we can actually go into the CH root and check out like you know what was going on like what kind of files were produced right if there was a you know an error or a file that was missed or something we can explore that and while this is happening I know there's a lot of scary text there but it's it's and this is what happens when you compile Bash like I can show that we can because it's very uh um it's pretty straightforward which again is why I like this tool

like uh no mystery so all this is um in fact I'm going to become root for this because I believe I need to be rude to explore this and there's when you installed mock there's a mock here and we'll see there's a couple of folders we're going to go into the mock config your configuration for mock sets this we'll go into that in a minute and you can see here's root and aha aha this is if you look at my system here I'm inside here but this looks like a root directory this is where bash is being built even as we speak and I'll bet

if we go into Builder here we can yep there's all kinds of stuff going on inside this wonderful little uh lib directory in here and so we can if we wanted to we can we could explore the GCC you know what it's pulling as it happens I'm not going to get into that right now but um yeah this is this is the CH root or the container in this case I don't want to mix up my terms but yeah so if you want to explore it uh there's a mock there there's an option to mock I think it's called dash dash no clean something like

that don't quote me and um it'll say hey mock do not remove this stuff whenever you're done right keep it keep it around keep it intact so that skip or whoever can can look at it because something went wrong foreign skip we've talked a little bit about the benefit of of kind of listing all of your build requirements in that spec file um how normal is it for the some of the packages that come as this minimal base system to be omitted from that list or specified does the package make assumptions About That Base system and only Define requirements that would go on top of

it that's an excellent question and um yes so you're uh um what you're talking about the initial set of packages that was that First dnf Command that was run inside our mock thing that is what we call a build root so and it's it's there to basically um bootstrap a a real minimal Rocky system and you're absolutely right you're touching on um your your requirements and the um I'm trying to put this in a in a good way but um your RPM build requirements are only as sound as how minimal your build route is because if you throw say Java into your build root which

is a terrible idea don't do that and your your RPM actually requires Java but does not specify that then yeah it will have Java and it'll be a problem because somebody who doesn't have Java it's not a requirement will experience issues right and um it's a hard question to answer I think um the defaults for mock are pretty darn good is all I would say they are about about as minimal as you can get and still have a functioning system um there's if really if you take stuff away and it's it's really if you let's look at our log here and I'll show you what

I'm talking about because oh look at that fun bash RPM and you know I always love to test my RPMs so let's do something kind of dangerous here let's take uh this new RPM that I just compiled and overwrite we're going to just um we're gonna remove the current flash which I'm actually running right now and install the one we just produced and it should be just fine because I think it's the same version installing yep awesome Yep and so now we are running strictly speaking even though they're identical we have bash installed from the one we just built we just built our own uh

shell interpreter fantastic so yeah back to your question so let's check out really when the when the system begins and we're going to I'm going to make this a little prettier here root.log by the way is the um is mock setup process for creating the container right this is the stuff that it needs to install before compilation is actually done go down here we see that this this is the list of packages here right and really there's not a whole lot of you can't really take much out of here and still have something that's going to work if that makes any sense and so I

I think um you could add on to it if you're interested in that but again careful so I think every RPM package no matter what should expect these to be present like as as a you know you you can still specify that you can say hey I need grep or I need gzip it's good practice right but I think it's safe to say that just about every system you're going to encounter is going to have this stuff and its dependencies which you can see here installed hope that answers the question properly I don't know if I'm wandering here yeah maybe the the point of reference

is I I don't think I've ever seen for example a package say that it depends on or build depends on g-lib C and is it acceptable in that case to have there be just things you don't have to say in your spec file it really depends on what system you're building for so like Rocky Linux packages they come from you know we have a tightly controlled system that's based entirely on red hat Enterprise Linux and if you're running Red Hat Enterprise Linux you are running glibc right there's no ifs ands or buts and so it's not normally specified however you I can imagine a situation

via container or via something else crazy where you have an RPM based distribution that you know maybe has mucil libsy or something and that would need to be specified within your your package right so it might be a good practice in that case to you know it really depends on your RPM's uh intended audience I guess and tend to you know build distro because they're very different if that makes any sense yeah thanks we're very fortunate in Rocky Linux we have again Red Hat Enterprise Linux a great product we have a very high quality Upstream there's still problems because when you build you know 3

000 plus packages to build a distro there's it's not trivial there's all kinds of weird things that can crop up and need debugging but in general for most run-of-the-mill packages like this one they're they're pretty solid so do we have any other questions looks like we built it I want to actually we were you know I'm gonna go off on a little tangent here because we were talking about other distros and it's um it's important to note if you're not familiar with mock or or this process Mach is a fedora tool and it's very it's used a lot across the Spectrum right this is not

just a rocky Linux thing so if you go into slash Etc mock configuration directory very interesting here there are a lot as you can see of distros and the power of this tool is that remember when we create a CH root and begin our build process in there it doesn't have you know this is a rocky 9 system we just built Rocky 9 bash but it doesn't have to be that way we could specify hey we want to build you know Synthol 7 and takes you know A bash design for that and build that right and we could do it right here on the system

or a fedora one or an Open Source One or whatever it's uh the only limitation is that you have to have an art you have to be an RPM based distro yeah there are a lot in there yes there are there's there's an awful lot of derivatives and distributions and all kinds of things and I think we'll uh we'll explore a little bit um so you'll see the one that I was using is the default is Rocky nine it's default on this system because they kind of assume that if you you know the packages of mock say hey you're using Rocky 9 you probably want

to build Rocky 9 packages which is a fair assumption and you'll see this is really just a a python config file here it's it's a bit of python code if you're familiar with it this is a python dictionary and it's really cool how the the settings you know that's how the settings are set and let's check out this template file because this is the real interesting one here and we'll show you kind of um high in the curtain here with mock very interesting if you've ever edited yum or dnf config files you will be familiar with this right and it's it's fascinating because you have

to you have to remember when you're building an RPM package it's the the location that you grab its dependencies from matters a lot like it's hugely important and so it's really cool because in mock you can manipulate this to be whatever you want it to be right so right now like yeah this is this is pretty default but you can point this you know you can you can change the dnf uh priorities to say hey I want my own repository that I hold on to to I want you to get your GCC or your dependencies or whatever from there first and you can manipulate the

versions that you're building against right so let's say um common I wouldn't say common but issues we have buildings sometimes where like hey this Ruby package will not build because new openssl breaks it so let's build it against a slightly older open SSL at build time so that it compiles correctly right then there's all kinds of all kinds of fun things you can do to inject your own dependencies to change your build route um there's the sky's the limit here because you can literally you know this is you customizing your uh system that you build or that you build your RPM on so very cool

very cool stuff but easy to edit too like it's literally just some text so what's the process like for creating a new one of these good oh boy so it's um it's really not bad um you you uh I'll give you an example here and when you say new one you mean a new config file right well a new config file but also like you know you and the team uh just put out a whole new distro in a sense of Rocky 9 and not only is there not a config file for it but there's also not repositories for it to drop and it's true

you have to start somewhere right and um you can there's several ways to do it um fortunately for us because Rocky by its nature is a downstream distribution we have excellent upstreams in Red Hat Enterprise Linux 9 and uh cintas9 stream further Upstream and um so what we've done uh to get started is um we have bootstrapped rocky Linux 9 off of red hat 9 beta right which was released oh gosh I want to say it was like the December or January December last year January this year and you can see I'll uh kind of show it off here because I'm heavily involved in this

um I have a um a web server that was kind of um the project allows me to use here and we'll go into we'll look at the arch 64 here this is Remember by the way in in real life Rocky linuxland we have to do this for I think five different architectures we compile for the arm processors like Raspberry Pi we compile for uh 32-bit I'll explain that in a minute we compile for Intel 64-bit this is your default you know laptop desktop server processors s390x which is the IBM mainframe system Z processors and power PC which is another IBM derived processor line and so

all of these are generally they're fine right they're very consistent but occasionally we'll have a problem where oh gosh there's a you know it compiles for everything but s390x and we have to figure out exactly why and there's there's a lot to that but um yeah you'll see this is this was the this repository here is huge there's like I think 8 000 plus packages in this repository and this was hey skip needs to go through and begin a effectively a complete rebuild of what's in Red Hat Enterprise Linux 9 and some of cintas9 stream in order for us as a build team to get

going and so yeah this is how we start and we we effectively You Know download source code put together Source RPMs and begin this mock process over and over and over again and there's there's tools and automation to help us right so it's not like I'm just sitting here you know can't buy Candlelight you know pressing you know oh gosh I'm gonna I'm gonna build this and then build this and three thousand more times or whatever now it's it's we have tools to you know make the machine do the work but uh yeah it's a lot of effort though and it's a lot of time

but so you see and these are free to browse you can see how rocky Linux 9 was bootstrapped and it's uh it's pretty crazy I hope you have a lot of memory in your web browser because these are some big listings so once you save bootstrap once you have that set of packages that you get from somewhere and you you build you build brachiolinux packages against them do you then go back and rebuild all the Rockets packages yes so this is only you'll notice here this this directory stage one right it's so there's there's more and that brings us into uh Peridot which I think

we'll talk about just briefly um let's go ahead and load it up this is a public site Peridot dot build.resf.org um I'll put it in the chat here and if anybody everybody wants to Pace it up you can it's very uh you said public site anybody can browse this not everybody can import and build stuff but everyone can browse it right and let's just check out Rocky Linux 9.

see how we're doing here and let's go into builds let's just we're going to pick out a couple recent ones here and we'll see node.js hey that's a cool one right everybody's favorite JavaScript server I'll be honest I don't understand it very much but uh that's yeah some people seem to like it a lot all right so and you can see here in this there's a bunch of tasks that happen and these are the interesting ones here it says build for x86 build for i-686 these are the different architectures that we're building for and if you 've gone to build is rather long so we

got to get all the way up here give me a second I gotta scroll having trouble scrolling here I don't know what's up with my browser and those people are watching I guess uh let's go Ben let's pick another one here yeah we hey bind everybody's favorite DNS server all right a new version of bind okay and if we go up here boy this is a lot all the way to the top here usually I click home for this but I'm not sure why that's not working right now there we go okay and you'll see here you'll notice that this text looks awfully familiar right

and that is because when the this Peridot which is our build system I guess gooey it's a lot of things API GUI important build system all it does and uh Koji which is the Fedora Centos build system um all they do they are very organized elaborate ways of calling Mock and RPM build right and so like this this text out here is almost identical to what we were just doing in our if I can back into my build directory here you'll see a little clearer here like this X here like we built we compile her we uh we install a bunch of initial packages then

we install a bunch of packages that the the RPM we're building requires and then it executes RPM build just like we just did right and so this is an excellent way of doing local testing or local builds and you know if you set your mock config correctly you can make it completely compatible with what the real Rocky Linux project or even the real Centos or or red hat Enterprise Linux project are doing and um uh actually I see that question there yeah got a question mark can you cross compile no uh and there's I'll explain why um RPM in general does not natively support cross-compiling

um you can but the the logic to do it has got to be built into the spec file I've seen ones there's some qmu ones in particular that are like this but there's really most packages are not going to bother doing that because they they assume that if you want to perform a cross compilation you have access or able to you know you're able to have a system that also has that compiler um and if you know for for bootstrapping initial systems it gets I'm not that's kind of beyond the scope of this talk but it gets into like well you have to you're gonna

have to cross compile things manually enough to get RPM and some basic packages going let's say that if you completely new processor architecture comes out and we have to build software for it right there's going to be some more fundamental work before you can get to RPM land and so and that and the the goal should be really when we begin to you know we begin porting or a system for this the goal is to get enough stuff to get to this build route right this initial set of packages that we have inside of mock once we have that we can get rolling we can

say okay we'll we'll build you know we'll build very slowly I guess some basic packages get our C compiler going etc etc right so there's a um that's a very not going to get into that process very deep very complicated but the short answer is no what about uh i-686 packages on an x8664 system yes so that is fine um mostly and same ditto goes for um um the ditto for uh if you think about arm 64 uh you can compile as long as the processor supports it so we know x8664 processors Intel processors support 32-bit mode um not all of them but many arm

64 processors are also backwards compatible with arm32 in the same way and yes apps because what we do and we can you know let's check it out here actually let's look at the i-686 build presumably you'll still need like a 32-bit bootstrap to or environment to build against but other than yeah and that and that makes the whole difference right because as long as you as long as you have some RPM macros which mock does for you set to be set to the proper processor architecture and then you have a proper build route and build environment that supports it then you're golden right and we

can look up here um way up here and I'm not sure normally I just press home and it takes me to the top of the log I'm not sure what's going on today but the exact same time must be here we go so yeah you see you'll notice that when we're installing here this entire little system were installed is all i-686 there's no 64-bit stuff going on here right and that's because well you know uh it's 32-bit packages do not need 64-bit packages in fact they they actively don't want them in order to build so um and going beyond that a little bit because I

I can sense your next question which is um it's story time for me um uh the Y build 32-bit packages because Rocky Linux and red hat Enterprise Linux does not release a 32-bit version my question was actually where is my 32-bit ISO yep so I can I can read your mind and the answer to that the reason that we build 32-bit packages is because um if you look at your Rocky Linux repositories and and red hat Upstream Red Hat repositories there are certain packages like openssl several others that do have they include 32-bit variants bundled in so if you want the 32-bit version for whatever

reason you can you can install that and they're for compatibility sake for for various you know a lot of commercial software they might you know distribute a 32-bit version still God Knows Why and they need 32-bit open SSL or whatever to work right and the rocky team uh in the beginning said oh sure this is going to be fine right we're just going to compile you know these you know 20 32-bit packages right we'll compile open SSL 32-bit Oh look The compile open SSL 32-bit we need these three other packages okay well that's fine we'll compile those three other ones oh look these three other

ones require 10 more packages for 32-bit right okay we'll do those we'll do that and once we got to about 150 we were like wait a minute actually we're compiling everything and and yeah that's the conclusion and you know uh really the conclusion that synthos before us came to is in order to build these 32-bit packages these few we effectively have to build 32-bit for everything and um it's uh um I'm not going to go into it right now but if you connect to the Peridot dnf repo or we build eight and Koji still the Koji repos the 32-bit packages for literally everything that's supported

are in there there are some packages I think Firefox comes to mind that will actually refuse to build with 32-bit they're intentionally excluded but most of them are there and so yeah there was um we it was a sad realization we thought it was going to be super easy to throw these you know 20 32-bit packages in and then we found out you know we did a couple days of building and we're like oh God there's the dependencies of dependencies of dependencies we have to build we might as well build everything and so we did do you do a 32-bit kernel also or is that

no that's one of the packages that is not that excludes 32-bit and that's a big reason why we don't have a 32-bit ISO right um it would be you I mean hypothetically this project idea for some anybody who really wants a 32-bit system you could take the 32-bit builds that we've done for all of user space and figure out a way to build a compatible 32-bit kernel you know package put them together and produce an ISO or an image or something and you know I don't see what reason why it wouldn't work it's a lot of work though I'm not sure yeah I'm not sure

it's worth it any uh 32-bit you know old Hardware aficionandos out there it's becoming increasingly irrelevant I'm afraid so it's just not something we're interested in doing sure so the the last big thing that we haven't really touched on in terms of things that kind of cross the boundary and aren't part of that isolation is the kernel itself so even though it's a container presumably as I understand when you're running mock you're doing the build with the kernel of the host system no matter what you're you're targeting has that ever come up is that an issue usually in in in ways you'd maybe not wouldn't

think about right so um good example is uh during the rocky Linux 9 building I believe there was a ruby package that um it required um we were so back up in uh at the time and I think even still now we're we're building Rocky Linux 9 on Rocky Linux 8 systems right so these have you know they're running they're running containers but they have a rocky Linux 8 kernel you know it's a little little older but still well supported and there is a ruby package I can't remember which one but it's related to Ruby that for its compilation um it requires uh it runs

some testing and it requires a kernel to support I think it's um not only temp FS temp FS the temporary file system feature which we have in our Rocky 8 kernel but oh there's a a certain feature of temp FS called like o underscore Temp and I think it's for I I can't remember exactly the feature it provides but it's a new thing in the nine kernel and the Ruby tests would not pass um you know the tests are done at the end of compilation for an RPM make sure the binaries you produced are working properly and yeah we ran into a problem we actually

uh um in order to make sure everything was okay I believe we had to for a couple of our build machines we had to upgrade the kernel on them so that it would support this new temp FS feature and that's just an example of how that can come up have you ever encountered a situation where it works in the other direction where you have a newer kernel but something you're trying to build requires an older one my memory is very fuzzy on this I want to say yes but I don't have a specific example in mind because we've God knows we've run into an awful

lot of problems like that that we've had to investigate and fix if the question is has a problem occurred then the answer is almost certainly yes at least once a broken thing so many ways you make your head spin but again that's usually people are like oh it's you know it's so easy you're just calling the RPM builds over and over again and well yes and if all of them completed on the first try yeah my job would be simple and you know I'm I'm very I'm happy to give it up to anybody who wants to do it but um the problem is when things

don't go right and we you know you'll have to spend you know in some cases hours some cases days of trying to figure out hey why the heck won't this work and why did it work before and there's a lot that goes into that oftentimes it has to do with again the versions of things that you're bringing in and building against because they sometimes a new version comes out and it it break it will break a at build time it will break something in an unexpected way yeah so it's very how did this ever work before is the worst question in systems engineering oh comes

up more than you would think I'm building yes especially again this is building in mock here is great if you want to build you know two or three four or five packages but when we're talking about you know industrial capacity and we need to build five thousand packages or whatever stuff like this comes in handy right we can do Mass builds and we say Hey you know we we're not going to do this one at a time we're going to you know kick off a million or whatever so skip are you running across users out there that are trying to take some of these packages

that are just a default do something to them and then like you said earlier put them into their own repos so they have something specific that's required for their company their environment that brings me to another great point is that I mentioned that um we already know that we can get our source RPMs from you know our download site or again they're they're available via dnf command right if you check out your your um uh inside of or sorry yum dot repos dot d here it is um Rocky Linux and other Distributors come with Source repositories and all they do is point to these Source

RPMs however these Source RPMs have to come from somewhere right and I'm just going to go into that real quick get.rockeylinux.org we want to put that up on the screen it's another great site I'm here a lot quite frankly and so let's go into staging RPMs and then the sort the source RPM name so let's talk about Basher right and it's my fault I misspelled it typo using RPMs and Bash without an apostrophe at the end and you'll see here we've got some branches and branches are funny when it comes to distros here this is Rocky 8 Rocky 9 we never merge branches really these

are just different versions that we keep track of and you can see you know when when things were imported I think um yeah we the latest version of bash for Rocky 9 was imported five months ago and built I think it hasn't there hasn't been any updates from Red Hat since then but you'll notice here sources and specs let me pull up my old uh if you remember this guy here this is the source RPM that we got from here and if you browse it this Source here I'm going to put it on top here so that we can kind of see them side by

side you'll notice so specs bash.spec is right up here and if you go into sources here you'll see all these patch files and here they are here they should match exactly right and that's where you want to know where these Source RPMs come from check this out all right and you can this is open open to everybody you can clone it you can Muck with it you can do whatever you want with it and you can build your own you can you know don't want don't want our bash bill you know make your own fixed bash like put your own patches or whatever and and

um yeah so this is um and our sources in turn come from uh git.centos.org is where uh which is where Red Hat publishes their official source code for and we'll see go into branches here just like us they have sentos branches you know you want the synthos floor bash here it is all right we're not really interested in that we'll check out there is no cintas9 really but um they still call it C9 but yeah this is the this is the red hat source code and this is exactly where we got it it gets pulled down and tagged into our git here so you can

kind of see the flow of where these things come from and if you're interested in modifying it it's pretty easy well I won't say it's easy I'm no C programmer right but it's it's easy to get at anyway see you again never mind I got a question sorry come here nope nope no question I thought we had a question but I was I had a question okay all right good stuff yeah so let me let me check my notes over here real quick but I think that's um that's about what I wanted to cover just uh please if you're building RPMs please consider mock the

old especially if you're trying to use just plain old RPM build it's it's hard and it's outdated and I just I used to hate doing this you know when my company back in the day would be like oh skip we need a customized RPM build for such and such a program like oh no all right give me a day and I'll see if I can figure it out you know like this makes this much much smoother right we have a if we kind of Mark is done for package building especially RPM package building what really containers have kind of done for developers we have a

standardized base that we can build on and you know we can make sure that when I build a package in my mock it's going to be the same as a package built in Jonathan's Mock and Zane's mock and as long as our configurations are the same we should get the same result and it's really excellent for that please consider it if you're still using raw RPM build to build packages nobody should be doing that because it's it's rough like quite frankly never have to configure RPM macros ever yes I'm not saying that but for most things yes and and configuring RPM macros are are just

configuring mock right like it's inside that mock configuration file you can set macros just like you can do everything else and so it's much easier than having the muck about on your file system with God knows where wherever RPM macros are kept right oh that's great I don't think we have any more questions guys I really appreciate you coming on skip thanks for putting this together it's great to see you glad to see you like I'm glad it went well because I don't uh whenever I do demos Things Fall Apart it's uh not today it's been great we really appreciate stuff appreciate it so if

uh do not anything else I don't see any other questions I really appreciate you if you want to uh join us next week and like And subscribe we appreciate it see you next week all right thanks guys foreign

Built for scale. Chosen by the world’s best.

2.75M+

Rocky Linux instances

Being used world wide

90%

Of fortune 100 companies

Use CIQ supported technologies

250k

Avg. monthly downloads

Rocky Linux

Have questions about your infrastructure?

Talk to a CIQ engineer about Rocky Linux, HPC, and AI infrastructure.

Talk to an Expert