(Yes, I seem to be spamming this list. If it's any excuse, please know that I spend 24/48/more hours trying to solve each problem on my own before asking for help here.) I'm trying to build the current openSUSE kernel. This isn't something I want to be spending time on, but for the reasons why, see https://lists.opensuse.org/archives/list/factory@lists.opensuse.org/thread/X... I've done the following: ``` $ git clone https://github.com/openSUSE/kernel $ cp -p /boot/config-6.3.9-1.g0df701d-default .config $ make olddefconfig $ make menuconfig ``` The last ("menuconfig") is required to make some changes to fix: ``` make[2]: *** No rule to make target '.kernel_signing_key.pem', needed by 'certs/signing_key.x509'. Stop. make[2]: *** Waiting for unfinished jobs.... CERT certs/x509_certificate_list make[1]: *** [scripts/Makefile.build:495: certs] Error 2 make[1]: *** Waiting for unfinished jobs.... ... make: *** [Makefile:2041: .] Error 2 ``` Finding the magic settings to fix that wasn't easy, but no matter. Continuing: ``` $ make binrpm-pkg ... depmod: ERROR: could not open directory /usr/local/home/mark/rpmbuild/BUILDROOT/kernel-6.4.0_rc7_1.g0df701d_default+-1.x86_64/usr/lib/modules/99.98.6.4.0-rc7-1.g0df701d-default+: No such file or directory depmod: FATAL: could not search modules: No such file or directory make[2]: *** [Makefile:1971: modules_install] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.UXaZfI (%install) ... RPM build errors: Bad exit status from /var/tmp/rpm-tmp.UXaZfI (%install) make[1]: *** [scripts/Makefile.package:91: binrpm-pkg] Error 1 make: *** [Makefile:1672: binrpm-pkg] Error 2 ``` Much investigation reveals that `rpmbuild`, invoked from "scripts/Makefile.package" via the "binrpm-pkg" target ... ``` binrpm-pkg: $(MAKE) -f $(srctree)/Makefile $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ $(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec ``` ... is creating a "/var/tmp/rpm-tmp.<some-tempname-hash>" file which is later executed. That script creates many directories, but not the missing one in the error message above. I've tried to hack in some workarounds, but all fail. It doesn't do any good to edit the /var/tmp/rmp-tmp.<hash> file because a new one is created on the next run of `make binrpm-pkg`. Likewise, creating the missing directory doesn't help because the script first cleans up the previous run with `rm -rf /usr/local/home/mark/rpmbuild/BUILDROOT/..." before recreating that whole directory tree, and that wipes out the hack-in subdirectory. So ... the questions (for anyone who has experience building kernels and would be willing to offer help): - Is there any reason why the "binrpm" target doesn't work or shouldn't be used? It seems (and is documented online) to be a better alternative to `make install` because it can't break the running system (it can be done as a non-root user and the resulting RPM later installed). - Is this a bug either in `rpmbuild` or the makefile's invocation of it? - Is doing `make rpm-pkg` (which is advertised to make two RPMs, one binary and one source) necessary instead? I've tried, and it errors with yet more problems which I'm trying to address, but predict that once it makes the source RPM it will break on the binary (the only thing I really want) with the same failure I'm already seeing. - Is doing `make module_install` followed by `make install` what everyone uses, and I'm going down some untested and unsupported path? As always, thanks for any advice or suggestions (including, I suppose, "If you don't know how to build the kernel you shouldn't be doing it.")
Hi Mark, On 26.06.23 00:29, Mark Rubin via openSUSE Factory wrote:
(Yes, I seem to be spamming this list. If it's any excuse, please know that I spend 24/48/more hours trying to solve each problem on my own before asking for help here.)
I'm trying to build the current openSUSE kernel. This isn't something I want to be spending time on, but for the reasons why, see https://lists.opensuse.org/archives/list/factory@lists.opensuse.org/thread/X...
I've done the following: [...] Finding the magic settings to fix that wasn't easy, but no matter. Continuing:
``` $ make binrpm-pkg
From what I seem to remember, the rpm targets are not really working or supported on the openSUSE kernel (or even on openSUSE with an upstream kernel source? I don't know). But, at least for me, they are also not really necessary since the kernel relatively cleanly installs in /boot and /lib/modules/<version> subdirectory and can easily be removed manually. I'll write down what I'm doing (from memory, so it might be slightly off...) to build a test kernel for my machine cd /my/sources/linux mkdir out zcat /proc/config.gz > out/.config make oldconfig O=out make menuconfig O=out # or edit out/.config I usually change CONFIG_LOCALVERSION="-seife" so that the custom kernel is easily identified. I also usually do unset CONFIG_DEBUG_INFO, as it saves a huge amount of disk space make -j 8 O=out sudo make install O=out sudo make modules_install O=out I like to have the built objects all in a extra directory for easy cleanup, thus the "O=out" If I know that there will be many builds (e.g. bisecting a bad kernel version), then I'm often also using ccache. Before rebooting into the new kernel, I often use "sudo grub2-emu" to check if it really is properly inserted into the grub menu, but that has always worked well for me. I think you need to have the "kernel-install-tools" package installed nowadays for the "make install" to work, but I have not had to build a kernel since this was changed :-) Best regards, and good luck.
So ... the questions (for anyone who has experience building kernels and would be willing to offer help):
the kernel@lists.opensuse.org mailing list would have connected you more directly with people that can give a definitive answer to these questions :-)
- Is there any reason why the "binrpm" target doesn't work or shouldn't be used? It seems (and is documented online) to be a better alternative to `make install` because it can't break the running system (it can be done as a non-root user and the resulting RPM later installed).
- Is this a bug either in `rpmbuild` or the makefile's invocation of it?
- Is doing `make rpm-pkg` (which is advertised to make two RPMs, one binary and one source) necessary instead? I've tried, and it errors with yet more problems which I'm trying to address, but predict that once it makes the source RPM it will break on the binary (the only thing I really want) with the same failure I'm already seeing.
- Is doing `make module_install` followed by `make install` what everyone uses, and I'm going down some untested and unsupported path?
I think so, but that's just me remembering things from the past.
As always, thanks for any advice or suggestions (including, I suppose, "If you don't know how to build the kernel you shouldn't be doing it.")
I think building kernels is not that hard (and it shouldn't be), so maybe one solution to the "make <something-rpm>" not working in opensuse would be to actually patch it out and replace it with some explanatory message... -- Stefan Seyfried "For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." -- Richard Feynman
Stefan Seyfried wrote:
From what I seem to remember, the rpm targets are not really working or supported on the openSUSE kernel (or even on openSUSE with an upstream kernel source? I don't know).
Thanks very much for confirming this. When something goes wrong the hardest thing is to decide between going down the "it's broken" vs the "I'm doing it wrong" path to try to find a fix.
But, at least for me, they are also not really necessary since the kernel relatively cleanly installs in /boot and /lib/modules/<version> subdirectory and can easily be removed manually. I'll write down what I'm doing (from memory, so it might be slightly off...) to build a test kernel for my machine cd /my/sources/linux mkdir out zcat /proc/config.gz > out/.config
I've found that /boot/config-<current_version> (always?) matches /proc/config.gz (after `gunzip`'ing), but yes, that should be the same as what I did.
make oldconfig O=out make menuconfig O=out # or edit out/.config I usually change CONFIG_LOCALVERSION="-seife" so that the custom kernel is easily identified. I also usually do unset CONFIG_DEBUG_INFO, as it saves a huge amount of disk space make -j 8 O=out sudo make install O=out sudo make modules_install O=out
Thanks, I'll try that. What wasn't clear to me were things like if `make install` did the compression of vmlinux (which plain `make` successfully created for me) to vmlinuz, and whether I'd have to run `dracut` or something else manually to create the /boot/initrd-<version> file, etc. I'd hope the Makefile would do it for me, but after my experiences with the "binrpm-pkg" target I didn't have a lot of confidence in it.
I like to have the built objects all in a extra directory for easy cleanup, thus the "O=out"
A nice trick, although I think `make clean` has been working for me without it. Side note: This is the first time I've tried to compile the kernel from source since I was on Slackware almost 30 years ago (before there were kernel modules, if I remember correctly). What I *do* remember from back then was the humorously-named `make mrproper` target, and I was nostalgically amused that it's still in the Makefile.
Before rebooting into the new kernel, I often use "sudo grub2-emu" to check if it really is properly inserted into the grub menu, but that has always worked well for me.
I wondered the same thing (grub configuration) but from what I saw looking around in the the /etc/grub.d/* files is that on openSUSE they dynamically create the menus at boot time from the kernels/initrds in the /boot directory. Very nice, and it seemed to work during my experiments zypper-installing pre-built kernels from RPMs (there was no change to the /etc/grub.d/* files but the new kernel(s) appeared in the boot menus anyway). Scouring the web for information I found instructions for other distros which explicitly required manual steps to reconfigure grub each time. It's one more example of why I think openSUSE gets things right (like the graphical installer which supports all the custom configuration capabilities listed in the Arch and Gentoo manuals, yet lets a naive user do a default install with a few mouse clicks instead of typing dozens of error-prone commands and inputs in a shell terminal).
I think you need to have the "kernel-install-tools" package installed nowadays for the "make install" to work, but I have not had to build a kernel since this was changed :-)
Thanks for the tip. I'll check, and maybe install it anyway just in case. ;)
Best regards, and good luck.
Thanks again. Hopefully I won't need too much more of it.
the kernel@lists.opensuse.org mailing list would have connected you more directly with people that can give a definitive answer to these questions :-)
If I run out of luck again I'll try "wearing out my welcome" over there next time. ;)
I think building kernels is not that hard (and it shouldn't be), so maybe one solution to the "make <something-rpm>" not working in opensuse would be to actually patch it out and replace it with some explanatory message...
I agree ("shouldn't be") and about removing (or a least documenting) non-functioning options. Like I said above, it would save the wasted time trying to find a user-error explanation for something that isn't going to work in the first place.
On 26.06.2023 10:34, Mark Rubin via openSUSE Factory wrote:
Thanks, I'll try that. What wasn't clear to me were things like if `make install` did the compression of vmlinux (which plain `make` successfully created for me) to vmlinuz, and whether I'd have to run `dracut` or something else manually to create the /boot/initrd-<version> file, etc.
I'd hope the Makefile would do it for me,
No, Makefile calls /sbin/installkernel if it is available and it is up to this program. kernel-install-tools package provides /sbin/installkernel that creates initrd. ...
I wondered the same thing (grub configuration) but from what I saw looking around in the the /etc/grub.d/* files is that on openSUSE they dynamically create the menus at boot time from the kernels/initrds in the /boot directory.
No, kernels are added to static grub.cfg, there is no boot time detection. Again, /sbin/installkernel from kernel-install-tools does it for you. Without this package (or comparable script) you need to update grub.cfg manually.
Very nice, and it seemed to work during my experiments zypper-installing pre-built kernels from RPMs
RPMs use hook scripts at installation time to create initrd and update bootoader configuration.
FWIW, I finally found what I believe is the problem which causes the kernel's `make binrpm-pkg` target to fail. The fix is simple (finding it wasn't, at least not for me), and I plan to submit a pull request at GitHub to include it. Will see how that goes.
Mark Rubin wrote:
FWIW, I finally found what I believe is the problem which causes the kernel's `make binrpm-pkg` target to fail. The fix is simple (finding it wasn't, at least not for me), and I plan to submit a pull request at GitHub to include it. Will see how that goes.
Linux doesn't accept pull requests. If you send me the patch, I can help you send it to the correct mailing lists or I can just send it upstream for you.
On 2023-06-30, Mark Rubin via openSUSE Factory <markrubn@yahoo.com> wrote:
FWIW, I finally found what I believe is the problem which causes the kernel's `make binrpm-pkg` target to fail. The fix is simple (finding it wasn't, at least not for me), and I plan to submit a pull request at GitHub to include it. Will see how that goes.
Linux doesn't accept pull requests. If you send me the patch (or a link to your branch on GitHub), I can help you send it to the correct mailing lists or I can just send it upstream for you. I just hit the same issue, it must've broken somewhat recently... -- Aleksa Sarai Senior Software Engineer (Containers) SUSE Linux GmbH <https://www.cyphar.com/>
On 7/20/23 01:12, Aleksa Sarai wrote:
Linux doesn't accept pull requests. If you send me the patch (or a link to your branch on GitHub), I can help you send it to the correct mailing lists or I can just send it upstream for you.
Thanks for your interest in this problem. I'm attaching my patch here, and will also add a response at [Kmod's new usr-lib-modules.patch breaks Vanilla kernel RPM building](https://lists.opensuse.org/archives/list/kernel@lists.opensuse.org/thread/S2...) as per Stefan Seyfried's suggestion for that being the more appropriate list. But it seems that similar patches, along with proposals for better fixes, have been posted at [Bug 1212835 - make modules_install fails with kmod-30-4.1](https://bugzilla.opensuse.org/show_bug.cgi?id=1212835), in addition to an extensive discussion regarding the root cause of the problem at https://lore.kernel.org/linux-modules/20230711153126.28876-1-msuchanek@suse....
I just hit the same issue, it must've broken somewhat recently...
Our definitions of "recent" may differ. ;) I started this thread (admittedly on the wrong list) on 25 Jun, the post on the openSUSE kernel list and the Bugzilla ticket were on 29 Jun, and the linux-modules thread started on 11 Jul. I'm not currently building kernels as my reason for doing so was to test some nouveau module fixes which now seem to be (slowly) making their way into the upstream sources and hopefully from there into openSUSE. But I still hope the "binrpm-pkg" target gets a permanent fix because IMO it's a much better workflow for a newbie like me (the full build is done without root permissions, and the resulting RPM can be safely installed -- and cleanly uninstalled in the case of problems -- via zypper or YaST).
participants (6)
-
Aleksa Sarai
-
Aleksa Sarai
-
Andrei Borzenkov
-
Mark Rubin
-
mark_at_yahoo
-
Stefan Seyfried